Beispiel #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();
  }
Beispiel #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();
     }
   }
 }
 /**
  * Mouse Click Event.
  *
  * @param e MouseEvent Object.
  */
 public void mouseClicked(MouseEvent e) {
   int x = e.getX();
   int y = e.getY();
   int row = tree.getRowForLocation(x, y);
   TreePath path = tree.getPathForRow(row);
   if (path != null) {
     CheckNode node = (CheckNode) path.getLastPathComponent();
     boolean isSelected = !(node.isSelected());
     node.setSelected(isSelected);
     if (node.getSelectionMode() == CheckNode.DIG_IN_SELECTION) {
       if (isSelected) {
         tree.expandPath(path);
       } else {
         tree.collapsePath(path);
       }
     }
     ((DefaultTreeModel) tree.getModel()).nodeChanged(node);
     if (row == 0) {
       tree.revalidate();
       tree.repaint();
     }
   }
 }