com.intellij.openapi.vcs.ui.Refreshable Java Examples

The following examples show how to use com.intellij.openapi.vcs.ui.Refreshable. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SelectWorkItemsAction.java    From azure-devops-intellij with MIT License 6 votes vote down vote up
@Override
public void actionPerformed(AnActionEvent anActionEvent) {
    final DataContext dc = anActionEvent.getDataContext();
    final Project project = CommonDataKeys.PROJECT.getData(dc);
    final Refreshable panel = CheckinProjectPanel.PANEL_KEY.getData(dc);
    final CommitMessageI commitMessageI = (panel instanceof CommitMessageI) ? (CommitMessageI) panel : VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(dc);

    if (commitMessageI != null && project != null) {
        String commitMessage = "";
        // Attempt to append the message instead of overwriting it
        if (commitMessageI instanceof CommitChangeListDialog) {
            commitMessage = ((CommitChangeListDialog) commitMessageI).getCommitMessage();
        }

        SelectWorkItemsDialog dialog = new SelectWorkItemsDialog(project);
        if (dialog.showAndGet()) {
            if (StringUtils.isNotEmpty(commitMessage)) {
                commitMessage += "\n" + dialog.getComment();
            } else {
                commitMessage = dialog.getComment();
            }

            commitMessageI.setCommitMessage(commitMessage);
        }
    }
}
 
Example #2
Source File: CreateCommitAction.java    From commit-template-idea-plugin with Apache License 2.0 5 votes vote down vote up
@Nullable
private static CommitMessageI getCommitPanel(@Nullable AnActionEvent e) {
    if (e == null) {
        return null;
    }
    Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext());
    if (data instanceof CommitMessageI) {
        return (CommitMessageI) data;
    }
    return VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.getDataContext());
}
 
Example #3
Source File: GetCommitMessageAction.java    From GitCommitMessage with Apache License 2.0 5 votes vote down vote up
@Nullable
private static CommitMessageI getCommitPanel(@Nullable AnActionEvent e) {
    if (e == null) {
        return null;
    }

    Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext());
    if (data instanceof CommitMessageI) {
        return (CommitMessageI) data;
    }
    return VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.getDataContext());
}
 
Example #4
Source File: OpenPanelAction.java    From GitCommitMessage with Apache License 2.0 5 votes vote down vote up
@Nullable
private static CommitMessageI getCommitPanel(@Nullable AnActionEvent e) {
    if (e == null) {
        return null;
    }
    Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext());
    if (data instanceof CommitMessageI) {
        return (CommitMessageI) data;
    }
    return VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.getDataContext());
}
 
Example #5
Source File: CommitMessageTemplateAction.java    From intellij-commit-message-template-plugin with MIT License 5 votes vote down vote up
@Nullable
private static CommitMessageI getCheckinPanel(@Nullable AnActionEvent e) {
    if (e == null) {
        return null;
    }
    Refreshable data = Refreshable.PANEL_KEY.getData(e.getDataContext());
    if (data instanceof CommitMessageI) {
        return (CommitMessageI) data;
    }
    CommitMessageI commitMessageI = VcsDataKeys.COMMIT_MESSAGE_CONTROL.getData(e.getDataContext());
    if (commitMessageI != null) {
        return commitMessageI;
    }
    return null;
}
 
Example #6
Source File: CheckCommitMessageSpellingAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@javax.annotation.Nullable
private static CommitMessageI getCheckinPanel(@javax.annotation.Nullable AnActionEvent e) {
  if (e == null) {
    return null;
  }
  Refreshable data = e.getData(Refreshable.PANEL_KEY);
  if (data instanceof CommitMessageI) {
    return (CommitMessageI)data;
  }
  CommitMessageI commitMessageI = e.getData(VcsDataKeys.COMMIT_MESSAGE_CONTROL);
  if (commitMessageI != null) {
    return commitMessageI;
  }
  return null;
}
 
Example #7
Source File: VcsActionPromoter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public List<AnAction> promote(List<AnAction> actions, DataContext context) {
  if (context.getData(Refreshable.PANEL_KEY) != null) {
    for (AnAction action : actions) {
      if (action instanceof ShowMessageHistoryAction) {
        return Arrays.asList(action);
      }
    }
  }
  return Collections.emptyList();
}
 
Example #8
Source File: CommitChangeListDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void calcData(Key<?> key, DataSink sink) {
  if (key == Refreshable.PANEL_KEY) {
    sink.put(Refreshable.PANEL_KEY, this);
  }
  else {
    myBrowser.calcData(key, sink);
  }
}
 
Example #9
Source File: VcsContextWrapper.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Refreshable getRefreshableDialog() {
  return myContext.getData(Refreshable.PANEL_KEY);
}
 
Example #10
Source File: CachedVcsContext.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public Refreshable getRefreshableDialog() {
  return myRefreshablePanel;
}
 
Example #11
Source File: VcsContext.java    From consulo with Apache License 2.0 votes vote down vote up
Refreshable getRefreshableDialog();