@Override
 public UpdateInfoTree showUpdateProjectInfo(
     UpdatedFiles updatedFiles,
     String displayActionName,
     ActionInfo actionInfo,
     boolean canceled) {
   if (!myProject.isOpen() || myProject.isDisposed()) return null;
   ContentManager contentManager = getContentManager();
   if (contentManager == null) {
     return null; // content manager is made null during dispose; flag is set later
   }
   final UpdateInfoTree updateInfoTree =
       new UpdateInfoTree(contentManager, myProject, updatedFiles, displayActionName, actionInfo);
   Content content =
       ContentFactory.SERVICE
           .getInstance()
           .createContent(
               updateInfoTree,
               canceled
                   ? VcsBundle.message(
                       "toolwindow.title.update.action.canceled.info", displayActionName)
                   : VcsBundle.message("toolwindow.title.update.action.info", displayActionName),
               true);
   Disposer.register(content, updateInfoTree);
   ContentsUtil.addContent(contentManager, content, true);
   ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.VCS).activate(null);
   updateInfoTree.expandRootChildren();
   return updateInfoTree;
 }
  private Content getOrCreateConsoleContent(final ContentManager contentManager) {
    final String displayName = VcsBundle.message("vcs.console.toolwindow.display.name");
    Content content = contentManager.findContent(displayName);
    if (content == null) {
      releaseEditor();
      final EditorFactory editorFactory = EditorFactory.getInstance();
      final Editor editor = editorFactory.createViewer(editorFactory.createDocument(""), myProject);
      EditorSettings editorSettings = editor.getSettings();
      editorSettings.setLineMarkerAreaShown(false);
      editorSettings.setIndentGuidesShown(false);
      editorSettings.setLineNumbersShown(false);
      editorSettings.setFoldingOutlineShown(false);

      ((EditorEx) editor).getScrollPane().setBorder(null);
      myEditorAdapter = new EditorAdapter(editor, myProject, false);
      final JPanel panel = new JPanel(new BorderLayout());
      panel.add(editor.getComponent(), BorderLayout.CENTER);

      content = ContentFactory.SERVICE.getInstance().createContent(panel, displayName, true);
      contentManager.addContent(content);

      for (Pair<String, TextAttributes> pair : myPendingOutput) {
        myEditorAdapter.appendString(pair.first, pair.second);
      }
      myPendingOutput.clear();
    }
    return content;
  }
 public void setCanGroupByChangeList(final boolean canGroupByChangeList) {
   myCanGroupByChangeList = canGroupByChangeList;
   if (myCanGroupByChangeList) {
     myLoadingChangeListsLabel = new JLabel(VcsBundle.message("update.info.loading.changelists"));
     add(myLoadingChangeListsLabel, BorderLayout.SOUTH);
     myGroupByChangeList = VcsConfiguration.getInstance(myProject).UPDATE_GROUP_BY_CHANGELIST;
     if (myGroupByChangeList) {
       final CardLayout cardLayout = (CardLayout) myCenterPanel.getLayout();
       cardLayout.show(myCenterPanel, CARD_CHANGES);
     }
   }
 }
    public static Image createImage(final JTree tree) {
      final TreeSelectionModel model = tree.getSelectionModel();
      final TreePath[] paths = model.getSelectionPaths();

      int count = 0;
      final List<ChangesBrowserNode> nodes = new ArrayList<ChangesBrowserNode>();
      for (final TreePath path : paths) {
        final ChangesBrowserNode node = (ChangesBrowserNode) path.getLastPathComponent();
        if (!node.isLeaf()) {
          nodes.add(node);
          count += node.getCount();
        }
      }

      for (TreePath path : paths) {
        final ChangesBrowserNode element = (ChangesBrowserNode) path.getLastPathComponent();
        boolean child = false;
        for (final ChangesBrowserNode node : nodes) {
          if (node.isNodeChild(element)) {
            child = true;
            break;
          }
        }

        if (!child) {
          if (element.isLeaf()) count++;
        } else if (!element.isLeaf()) {
          count -= element.getCount();
        }
      }

      final JLabel label = new JLabel(VcsBundle.message("changes.view.dnd.label", count));
      label.setOpaque(true);
      label.setForeground(tree.getForeground());
      label.setBackground(tree.getBackground());
      label.setFont(tree.getFont());
      label.setSize(label.getPreferredSize());
      final BufferedImage image =
          new BufferedImage(label.getWidth(), label.getHeight(), BufferedImage.TYPE_INT_ARGB);

      Graphics2D g2 = (Graphics2D) image.getGraphics();
      g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.7f));
      label.paint(g2);
      g2.dispose();

      return image;
    }
public interface FileStatus {
  Color COLOR_NOT_CHANGED = null; // deliberately null, do not use hardcoded Color.BLACK
  Color COLOR_NOT_CHANGED_RECURSIVE = new Color(138, 164, 200);
  Color COLOR_NOT_CHANGED_IMMEDIATE = new Color(50, 100, 180);

  Color COLOR_MERGE = new Color(117, 3, 220);
  Color COLOR_MODIFIED = new Color(0, 50, 160);
  Color COLOR_MISSING = Gray._97;
  Color COLOR_ADDED = new Color(10, 119, 0);
  Color COLOR_OUT_OF_DATE = Color.yellow.darker().darker();
  Color COLOR_HIJACKED = Color.ORANGE.darker();
  Color COLOR_SWITCHED = new Color(8, 151, 143);
  Color COLOR_UNKNOWN = new Color(153, 51, 0);

  FileStatus NOT_CHANGED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "NOT_CHANGED", VcsBundle.message("file.status.name.up.to.date"), COLOR_NOT_CHANGED);
  FileStatus NOT_CHANGED_IMMEDIATE =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "NOT_CHANGED_IMMEDIATE",
              VcsBundle.message("file.status.name.up.to.date.immediate.children"),
              COLOR_NOT_CHANGED_IMMEDIATE);
  FileStatus NOT_CHANGED_RECURSIVE =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "NOT_CHANGED_RECURSIVE",
              VcsBundle.message("file.status.name.up.to.date.recursive.children"),
              COLOR_NOT_CHANGED_RECURSIVE);
  FileStatus DELETED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "DELETED", VcsBundle.message("file.status.name.deleted"), COLOR_MISSING);
  FileStatus MODIFIED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "MODIFIED", VcsBundle.message("file.status.name.modified"), COLOR_MODIFIED);
  FileStatus ADDED =
      FileStatusFactory.getInstance()
          .createFileStatus("ADDED", VcsBundle.message("file.status.name.added"), COLOR_ADDED);
  FileStatus MERGE =
      FileStatusFactory.getInstance()
          .createFileStatus("MERGED", VcsBundle.message("file.status.name.merged"), COLOR_MERGE);
  FileStatus UNKNOWN =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "UNKNOWN", VcsBundle.message("file.status.name.unknown"), COLOR_UNKNOWN);
  FileStatus IGNORED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "IDEA_FILESTATUS_IGNORED",
              VcsBundle.message("file.status.name.ignored"),
              new Color(114, 114, 56));
  FileStatus HIJACKED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "HIJACKED", VcsBundle.message("file.status.name.hijacked"), COLOR_HIJACKED);
  FileStatus MERGED_WITH_CONFLICTS =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "IDEA_FILESTATUS_MERGED_WITH_CONFLICTS",
              VcsBundle.message("file.status.name.merged.with.conflicts"),
              Color.red);
  FileStatus MERGED_WITH_BOTH_CONFLICTS =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "IDEA_FILESTATUS_MERGED_WITH_BOTH_CONFLICTS",
              VcsBundle.message("file.status.name.merged.with.both.conflicts"),
              Color.red);
  FileStatus MERGED_WITH_PROPERTY_CONFLICTS =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "IDEA_FILESTATUS_MERGED_WITH_PROPERTY_CONFLICTS",
              VcsBundle.message("file.status.name.merged.with.property.conflicts"),
              Color.red);
  FileStatus DELETED_FROM_FS =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "IDEA_FILESTATUS_DELETED_FROM_FILE_SYSTEM",
              VcsBundle.message("file.status.name.deleted.from.file.system"),
              new Color(119, 56, 149));
  FileStatus SWITCHED =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "SWITCHED", VcsBundle.message("file.status.name.switched"), COLOR_SWITCHED);
  FileStatus OBSOLETE =
      FileStatusFactory.getInstance()
          .createFileStatus(
              "OBSOLETE", VcsBundle.message("file.status.name.obsolete"), COLOR_OUT_OF_DATE);

  String getText();

  Color getColor();

  @NotNull
  ColorKey getColorKey();

  @NotNull
  String getId();
}
 public GroupByChangeListAction() {
   super(
       VcsBundle.message("update.info.group.by.changelist"),
       null,
       AllIcons.ObjectBrowser.Browser);
 }
 public MyGroupByPackagesAction() {
   super(
       VcsBundle.message("action.name.group.by.packages"),
       null,
       PlatformIcons.GROUP_BY_PACKAGES);
 }