예제 #1
0
  // reorder the nodes
  private void reorder(Vector nodes) {

    debug("reorder nodes");

    // remove all the children of topNode (they'll be added back later)
    topNode.removeAllChildren();

    // Create an array of the elements for sorting & copy the elements
    // into the array.
    DefaultMutableTreeNode[] array = new DefaultMutableTreeNode[nodes.size()];
    nodes.copyInto(array);

    // Sort the array (Quick Sort)
    quickSort(array, 0, array.length - 1);

    // Reload the topNode. Everthing is in order now.
    for (int i = 0; i < array.length; i++) {
      topNode.add((DefaultMutableTreeNode) array[i]);
    }

    // Tell the tree to repaint itself
    ((DefaultTreeModel) tree.getModel()).reload();
    tree.invalidate();
    tree.repaint();
  }
예제 #2
0
 // {{{ updateHighlightStatus() method
 private void updateHighlightStatus() {
   String prop = jEdit.getProperty(HIGHLIGHT_PROP);
   if (prop != null && !prop.isEmpty())
     highlight.setIcon(
         GUIUtilities.loadIcon(jEdit.getProperty("hypersearch-results.match.highlight.icon")));
   else
     highlight.setIcon(
         GUIUtilities.loadIcon(jEdit.getProperty("hypersearch-results.match.normal.icon")));
   resultTree.repaint();
 } // }}}
 private void editToolbarIcon(String actionId, DefaultMutableTreeNode node) {
   final AnAction anAction = ActionManager.getInstance().getAction(actionId);
   if (isToolbarAction(node)
       && anAction.getTemplatePresentation() != null
       && anAction.getTemplatePresentation().getIcon() == null) {
     final int exitCode =
         Messages.showOkCancelDialog(
             IdeBundle.message("error.adding.action.without.icon.to.toolbar"),
             IdeBundle.message("title.unable.to.add.action.without.icon.to.toolbar"),
             Messages.getInformationIcon());
     if (exitCode == Messages.OK) {
       mySelectedSchema.addIconCustomization(actionId, null);
       anAction.getTemplatePresentation().setIcon(AllIcons.Toolbar.Unknown);
       anAction.setDefaultIcon(false);
       node.setUserObject(Pair.create(actionId, AllIcons.Toolbar.Unknown));
       myActionsTree.repaint();
       setCustomizationSchemaForCurrentProjects();
     }
   }
 }