Beispiel #1
1
    public void run() {
      SearchTOCItem tocitem;
      Vector nodes = new Vector();

      // Add all the children of the topnode to the Vector of nodes.
      Enumeration children = topNode.children();
      while (children.hasMoreElements()) {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) children.nextElement();
        nodes.addElement(node);
      }

      debug("items found");
      HelpModel helpmodel = searchnav.getModel();
      HelpSet hs = helpmodel.getHelpSet();
      debug("hs:" + hs.toString());
      Map map = hs.getCombinedMap();
      Enumeration itemEnum = e.getSearchItems();
      while (itemEnum.hasMoreElements()) {
        SearchItem item = (SearchItem) itemEnum.nextElement();
        debug("  item: " + item);
        URL url;
        try {
          url = new URL(item.getBase(), item.getFilename());
        } catch (MalformedURLException me) {
          System.err.println(
              "Failed to create URL from " + item.getBase() + "|" + item.getFilename());
          continue;
        }
        boolean foundNode = false;
        DefaultMutableTreeNode node = null;
        Enumeration nodesEnum = nodes.elements();
        while (nodesEnum.hasMoreElements()) {
          node = (DefaultMutableTreeNode) nodesEnum.nextElement();
          tocitem = (SearchTOCItem) node.getUserObject();
          URL testURL = tocitem.getURL();
          if (testURL != null && url != null && url.sameFile(testURL)) {
            tocitem = (SearchTOCItem) node.getUserObject();
            tocitem.addSearchHit(
                new SearchHit(item.getConfidence(), item.getBegin(), item.getEnd()));
            foundNode = true;
            break;
          }
        }
        if (!foundNode) {
          tocitem = new SearchTOCItem(item);
          node = new DefaultMutableTreeNode(tocitem);
          nodes.addElement(node);
        }
      }
      reorder(nodes);
      ((DefaultTreeModel) tree.getModel()).reload();
    }
Beispiel #2
0
 @Override
 public String convertValueToText(
     Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
   String s = super.convertValueToText(value, selected, expanded, leaf, row, hasFocus);
   String newProp = jEdit.getProperty(HIGHLIGHT_PROP);
   if (newProp == null || newProp.isEmpty()) return s;
   DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;
   while (node != null && !(node.getUserObject() instanceof HyperSearchOperationNode)) {
     node = (DefaultMutableTreeNode) node.getParent();
   }
   if (node == null) return s;
   if (!newProp.equals(prop)) {
     prop = newProp;
     Font f = (resultTree != null) ? resultTree.getFont() : UIManager.getFont("Tree.font");
     styleTag = HtmlUtilities.style2html(prop, f);
   }
   SearchMatcher matcher = ((HyperSearchOperationNode) node.getUserObject()).getSearchMatcher();
   int i = s.indexOf(": ");
   if (i > 0) i += 2;
   else i = 0;
   Match m;
   List<Integer> matches = new ArrayList<Integer>();
   while ((m = matcher.nextMatch(s.substring(i), true, true, true, false)) != null) {
     matches.add(i + m.start);
     matches.add(i + m.end);
     i += m.end;
   }
   return HtmlUtilities.highlightString(s, styleTag, matches);
 }
 @Nullable
 private static String getActionId(DefaultMutableTreeNode node) {
   return (String)
       (node.getUserObject() instanceof String
           ? node.getUserObject()
           : node.getUserObject() instanceof Pair ? ((Pair) node.getUserObject()).first : null);
 }
Beispiel #4
0
  private int compare(DefaultMutableTreeNode node1, DefaultMutableTreeNode node2) {
    SearchTOCItem item1, item2;
    double confidence1, confidence2;
    int hits1, hits2;

    item1 = (SearchTOCItem) node1.getUserObject();
    confidence1 = item1.getConfidence();
    hits1 = item1.hitCount();

    item2 = (SearchTOCItem) node2.getUserObject();
    confidence2 = item2.getConfidence();
    hits2 = item2.hitCount();

    // confidence is a penality. The lower the better
    if (confidence1 > confidence2) {
      // node1 is less than node2
      return -1;
    } else if (confidence1 < confidence2) {
      // node1 is greater than node2
      return 1;
    } else {
      // confidences are the same check the hits
      if (hits1 < hits2) {
        // node1 is less than node2
        return -1;
      } else if (hits1 > hits2) {
        // node2 is greater than node2
        return 1;
      }
    }
    // nodes1 and nodes2 are equivalent
    return 0;
  }
Beispiel #5
0
  private void goToSelectedNode(int mode) {
    TreePath path = resultTree.getSelectionPath();
    if (path == null) return;

    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
    Object value = node.getUserObject();

    // do nothing if clicked "foo (showing n occurrences in m files)"
    if (node.getParent() != resultTreeRoot && value instanceof HyperSearchNode) {
      HyperSearchNode n = (HyperSearchNode) value;
      Buffer buffer = n.getBuffer(view);
      if (buffer == null) return;

      EditPane pane;

      switch (mode) {
        case M_OPEN:
          pane = view.goToBuffer(buffer);
          break;
        case M_OPEN_NEW_VIEW:
          pane = jEdit.newView(view, buffer, false).getEditPane();
          break;
        case M_OPEN_NEW_PLAIN_VIEW:
          pane = jEdit.newView(view, buffer, true).getEditPane();
          break;
        case M_OPEN_NEW_SPLIT:
          pane = view.splitHorizontally();
          break;
        default:
          throw new IllegalArgumentException("Bad mode: " + mode);
      }

      n.goTo(pane);
    }
  } // }}}
  public DefaultMutableTreeNode findNode(DefaultMutableTreeNode parent, String match) {
    if (parent == null) return null;
    // Commented by Balan on 15/03/03
    // String treename =  (String)parent.getUserObject ();
    // Comment Ends

    // Added by Balan  on 15/03/03
    String treename = "" + ((Hashtable) parent.getUserObject()).get("TREE-NAME");
    // Add Ends

    if (treename != null) {
      if (treename.equals(match)) return parent;
    }

    if (frame.model.isLeaf(parent)) return null;

    Enumeration en = parent.children();
    if ((en == null) || (!en.hasMoreElements())) return null;
    for (; en.hasMoreElements(); ) {

      DefaultMutableTreeNode child = (DefaultMutableTreeNode) en.nextElement();
      DefaultMutableTreeNode returnNode = findNode(child, match);
      if (returnNode != null) return returnNode;
    }
    return null;
  }
 /**
  * Called when the selection changed in the tree. Loads the selected certificate.
  *
  * @param e the event
  */
 private void valueChangedPerformed(TreeSelectionEvent e) {
   Object o = e.getNewLeadSelectionPath().getLastPathComponent();
   if (o instanceof DefaultMutableTreeNode) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) o;
     infoTextPane.setText(toString(node.getUserObject()));
   }
 }
 void deleteNode(DefaultMutableTreeNode node) throws Exception {
   DefaultTreeModel model = (DefaultTreeModel) m_tree.getModel();
   HRMBusinessLogic logic = new HRMBusinessLogic(m_conn);
   logic.orgLogic.deleteOrganization(
       logic, m_sessionid, IDBConstants.MODUL_MASTER_DATA, ((Organization) node.getUserObject()));
   model.removeNodeFromParent(node);
 }
  void onEdit() {
    DefaultTreeModel model = (DefaultTreeModel) m_tree.getModel();
    TreePath path = m_tree.getSelectionPath();
    DefaultMutableTreeNode node = (DefaultMutableTreeNode) path.getLastPathComponent();
    DefaultMutableTreeNode parent = (DefaultMutableTreeNode) node.getParent();
    Organization org = (Organization) node.getUserObject();
    OrganizationEditorDlg dlg = null;

    if (parent == model.getRoot())
      dlg =
          new OrganizationEditorDlg(
              pohaci.gumunda.cgui.GumundaMainFrame.getMainFrame(), m_conn, m_sessionid, null, org);
    else
      dlg =
          new OrganizationEditorDlg(
              pohaci.gumunda.cgui.GumundaMainFrame.getMainFrame(),
              m_conn,
              m_sessionid,
              (DefaultMutableTreeNode) node.getParent(),
              org);
    dlg.setVisible(true);

    if (dlg.getResponse() == JOptionPane.OK_OPTION) {
      node.setUserObject(dlg.getOrganization());
      model.nodeChanged(node);
    }
  }
  private void doSave() {
    ObjectOutputStream objectStream = getObjectOutputStream();

    if (objectStream != null) {
      try {
        System.out.println("Saving " + selectedChildrenPaths.size() + " Selected Generations...");

        for (int i = 0; i < selectedChildrenPaths.size(); i++) {
          // Get the userObject at the supplied path
          Object selectedPath =
              ((TreePath) selectedChildrenPaths.elementAt(i)).getLastPathComponent();
          DefaultMutableTreeNode selectedNode = (DefaultMutableTreeNode) selectedPath;

          objectStream.writeObject(selectedNode.getUserObject());
        }

        objectStream.close();
        System.out.println("Save completed successfully.");
      } catch (IOException e) {
        System.err.println(e);
      }
    } else {
      System.out.println("Save Selected Files has been aborted!");
    }
  }
Beispiel #11
0
    @Override
    public void actionPerformed(ActionEvent evt) {
      JCheckBoxMenuItem menuItem = (JCheckBoxMenuItem) evt.getSource();
      boolean curState = menuItem.isSelected();

      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();

      HyperSearchOperationNode operNodeObj = (HyperSearchOperationNode) operNode.getUserObject();
      if (curState) operNodeObj.cacheResultNodes(operNode);
      operNode.removeAllChildren();
      if (curState) {
        Exception excp = null;
        try {
          operNodeObj.insertTreeNodes(resultTree, operNode);
        } catch (Exception ex) {
          operNodeObj.restoreFlatNodes(resultTree, operNode);
          menuItem.setSelected(false);
          excp = ex;
        } finally {
          ((DefaultTreeModel) resultTree.getModel()).nodeStructureChanged(operNode);
          expandAllNodes(operNode);
          resultTree.scrollPathToVisible(new TreePath(operNode.getPath()));
        }
        if (excp != null) throw new RuntimeException(excp);
      } else operNodeObj.restoreFlatNodes(resultTree, operNode);

      operNodeObj.setTreeViewDisplayed(menuItem.isSelected());
    }
    // ===============================================================
    // ===============================================================
    public Component getTreeCellRendererComponent(
        JTree tree,
        Object obj,
        boolean sel,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {

      super.getTreeCellRendererComponent(tree, obj, sel, expanded, leaf, row, hasFocus);

      setBackgroundNonSelectionColor(background);
      setForeground(Color.black);
      setBackgroundSelectionColor(Color.lightGray);
      if (row == 0) {
        //	ROOT
        setFont(fonts[TITLE]);
        setIcon(tango_icon);
      } else {
        DefaultMutableTreeNode node = (DefaultMutableTreeNode) obj;

        if (node.getUserObject() instanceof PollThread) {
          setFont(fonts[THREAD]);
          setIcon(class_icon);
        } else {
          setFont(fonts[DEVICE]);
          setIcon(cmd_icon);
        }
      }
      return this;
    }
 // ===============================================================
 // ===============================================================
 private int getNextThreadNum() {
   int num = 0;
   for (int i = 0; i < root.getChildCount(); i++) {
     DefaultMutableTreeNode th_node = (DefaultMutableTreeNode) root.getChildAt(i);
     num = ((PollThread) th_node.getUserObject()).num;
   }
   return ++num;
 }
Beispiel #14
0
    // {{{ getTreeCellRendererComponent() method
    @Override
    protected void configureTreeCellRendererComponent(
        JTree tree,
        Object value,
        boolean sel,
        boolean expanded,
        boolean leaf,
        int row,
        boolean hasFocus) {
      setIcon(null);
      DefaultMutableTreeNode node = (DefaultMutableTreeNode) value;

      if (node.getUserObject() instanceof HyperSearchOperationNode) {
        setFont(boldFont);

        CountNodes countNodes = new CountNodes();
        traverseNodes(node, countNodes);

        setText(
            jEdit.getProperty(
                "hypersearch-results.result-caption",
                new Object[] {
                  node.toString(),
                  Integer.valueOf(countNodes.resultCount),
                  Integer.valueOf(countNodes.bufferCount)
                }));
      } else if (node.getUserObject() instanceof HyperSearchFolderNode) {
        setFont(plainFont);
        setText(node.toString() + " (" + node.getChildCount() + " files/folders)");
      } else if (node.getUserObject() instanceof HyperSearchFileNode) {
        // file name
        setFont(boldFont);
        HyperSearchFileNode hyperSearchFileNode = (HyperSearchFileNode) node.getUserObject();
        setText(
            jEdit.getProperty(
                "hypersearch-results.file-caption",
                new Object[] {
                  hyperSearchFileNode,
                  Integer.valueOf(hyperSearchFileNode.getCount()),
                  Integer.valueOf(node.getChildCount())
                }));
      } else {
        setFont(plainFont);
      }
    } // }}}
Beispiel #15
0
  /** A value has changed. This is used as a TreeSelectionListener. */
  public void valueChanged(TreeSelectionEvent e) {

    JHelpNavigator navigator = getHelpNavigator();
    HelpModel helpmodel = navigator.getModel();

    debug("ValueChanged: " + e);
    debug("  model: " + helpmodel);

    // send selected items into navigator
    TreeItem[] items = null;
    TreePath[] paths = tree.getSelectionPaths();
    if (paths != null) {
      items = new TreeItem[paths.length];
      for (int i = 0; i < paths.length; i++) {
        if (paths[i] != null) {
          DefaultMutableTreeNode node = (DefaultMutableTreeNode) paths[i].getLastPathComponent();
          items[i] = (TreeItem) node.getUserObject();
        }
      }
    }
    navigator.setSelectedItems(items);

    // change current id only if one items is selected
    if (items != null && items.length == 1) {
      SearchTOCItem item = (SearchTOCItem) items[0];
      if (item != null) {
        if (item.getID() != null) {
          try {
            // navigator.setCurrentID(item.getID());
            helpmodel.setCurrentID(item.getID(), item.getName(), navigator);
          } catch (InvalidHelpSetContextException ex) {
            System.err.println("BadID: " + item.getID());
            return;
          }
        } else if (item.getURL() != null) {
          // navigator.setCurrentURL(item.getURL());
          helpmodel.setCurrentURL(item.getURL(), item.getName(), navigator);
        } else {
          // no ID, no URL
          return;
        }
        if (helpmodel instanceof TextHelpModel) {
          DefaultHighlight h[] = new DefaultHighlight[item.hitCount()];
          int i = 0;
          Enumeration enum1 = item.getSearchHits();
          while (enum1.hasMoreElements()) {
            SearchHit info = (SearchHit) enum1.nextElement();
            h[i] = new DefaultHighlight(info.getBegin(), info.getEnd());
            i++;
          }
          // using setHighlights() instead of removeAll + add
          // avoids one highlighting event
          ((TextHelpModel) helpmodel).setHighlights(h);
        }
      }
    }
  }
Beispiel #16
0
 @Nullable
 public static TreeNode findNodeWithObject(
     final Object object, final TreeModel model, final Object parent) {
   for (int i = 0; i < model.getChildCount(parent); i++) {
     final DefaultMutableTreeNode childNode = (DefaultMutableTreeNode) model.getChild(parent, i);
     if (childNode.getUserObject().equals(object)) return childNode;
   }
   return null;
 }
Beispiel #17
0
 @Override
 public boolean processNode(DefaultMutableTreeNode node) {
   Object userObject = node.getUserObject();
   if (userObject instanceof HyperSearchFileNode) {
     resultCount += ((HyperSearchFileNode) userObject).getCount();
     bufferCount++;
   }
   return true;
 }
 @Nullable
 private static Navigatable getNavigatableForNode(@NotNull DefaultMutableTreeNode node) {
   Object userObject = node.getUserObject();
   if (userObject instanceof Navigatable) {
     final Navigatable navigatable = (Navigatable) userObject;
     return navigatable.canNavigate() ? navigatable : null;
   }
   return null;
 }
  @Nullable
  private static TreePath findNodePath(MavenArchetype object, TreeModel model, Object parent) {
    for (int i = 0; i < model.getChildCount(parent); i++) {
      DefaultMutableTreeNode each = (DefaultMutableTreeNode) model.getChild(parent, i);
      if (each.getUserObject().equals(object)) return new TreePath(each.getPath());

      TreePath result = findNodePath(object, model, each);
      if (result != null) return result;
    }
    return null;
  }
  // ===============================================================
  // ===============================================================
  private void moveLeaf(
      DefaultMutableTreeNode collec_node, DefaultMutableTreeNode leaf_node, int pos) {
    Object obj = collec_node.getUserObject();
    if (obj instanceof PollThread) {
      treeModel.removeNodeFromParent(leaf_node);
      if (pos < 0) treeModel.insertNodeInto(leaf_node, collec_node, collec_node.getChildCount());
      else treeModel.insertNodeInto(leaf_node, collec_node, pos);

      expandNode(leaf_node);
    }
  }
Beispiel #21
0
 public void editSelected() {
   TreePath selected = tree.getSelectionPath();
   if (selected != null) {
     DefaultMutableTreeNode node = (DefaultMutableTreeNode) selected.getLastPathComponent();
     Object obj = node.getUserObject();
     if (obj instanceof CavityDBObject) {
       CavityDBObject dbObj = (CavityDBObject) obj;
       new ObjectEditingFrame(new ObjectEditingPanel(dbObj));
     }
   }
 }
  /**
   * Update the layouts tree.
   *
   * @param current The name of the current layout or <CODE>null</CODE> if none.
   */
  public void updateLayouts(Path current) throws PipelineException {
    DefaultMutableTreeNode root = null;
    {
      root = new DefaultMutableTreeNode(new TreeData(), true);

      {
        Path path = new Path(PackageInfo.getSettingsPath(), "layouts");
        rebuildTreeModel(path, new Path("/"), root);
      }

      DefaultTreeModel model = (DefaultTreeModel) pTree.getModel();
      model.setRoot(root);

      {
        Enumeration e = root.depthFirstEnumeration();
        if (e != null) {
          while (e.hasMoreElements()) {
            DefaultMutableTreeNode tnode = (DefaultMutableTreeNode) e.nextElement();
            pTree.expandPath(new TreePath(tnode.getPath()));
          }
        }
      }
    }

    pTree.clearSelection();
    if (current != null) {
      TreePath tpath = null;
      DefaultMutableTreeNode tnode = root;
      for (String comp : current.getComponents()) {
        DefaultMutableTreeNode next = null;
        Enumeration e = tnode.children();
        if (e != null) {
          while (e.hasMoreElements()) {
            DefaultMutableTreeNode child = (DefaultMutableTreeNode) e.nextElement();
            TreeData data = (TreeData) child.getUserObject();
            if (data.toString().equals(comp)) {
              tpath = new TreePath(child.getPath());
              next = child;
              break;
            }
          }
        }

        if (next == null) break;

        tnode = next;
      }

      if (tpath != null) {
        pTree.setSelectionPath(tpath);
        pTree.makeVisible(tpath);
      }
    }
  }
Beispiel #23
0
    @Override
    public void actionPerformed(ActionEvent evt) {
      TreePath path = resultTree.getSelectionPath();
      DefaultMutableTreeNode operNode = (DefaultMutableTreeNode) path.getLastPathComponent();
      HyperSearchFolderNode nodeObj = (HyperSearchFolderNode) operNode.getUserObject();

      String glob = "*";
      SearchFileSet dirList = SearchAndReplace.getSearchFileSet();
      if (dirList instanceof DirectoryListSet) glob = ((DirectoryListSet) dirList).getFileFilter();
      SearchAndReplace.setSearchFileSet(
          new DirectoryListSet(nodeObj.getNodeFile().getAbsolutePath(), glob, true));
      SearchDialog.showSearchDialog(view, null, SearchDialog.DIRECTORY);
    }
Beispiel #24
0
 @Override
 public boolean processNode(DefaultMutableTreeNode node) {
   Object userObject = node.getUserObject();
   if (userObject instanceof HyperSearchFileNode)
     nodesString.append(((HyperSearchFileNode) userObject).path);
   else if (userObject instanceof HyperSearchResult) {
     HyperSearchResult hsr = (HyperSearchResult) userObject;
     // Copy the ORIGINAL line from the buffer!
     nodesString.append(hsr.buffer == null ? hsr.toString() : hsr.buffer.getLineText(hsr.line));
   } else nodesString.append(userObject.toString());
   nodesString.append('\n');
   return true;
 }
  protected boolean doSetIcon(
      DefaultMutableTreeNode node, @Nullable String path, Component component) {
    if (StringUtil.isNotEmpty(path) && !new File(path).isFile()) {
      Messages.showErrorDialog(
          component,
          IdeBundle.message("error.file.not.found.message", path),
          IdeBundle.message("title.choose.action.icon"));
      return false;
    }

    String actionId = getActionId(node);
    if (actionId == null) return false;

    final AnAction action = ActionManager.getInstance().getAction(actionId);
    if (action != null && action.getTemplatePresentation() != null) {
      if (StringUtil.isNotEmpty(path)) {
        Image image = null;
        try {
          image =
              ImageLoader.loadFromStream(
                  VfsUtil.convertToURL(VfsUtil.pathToUrl(path.replace(File.separatorChar, '/')))
                      .openStream());
        } catch (IOException e) {
          LOG.debug(e);
        }
        Icon icon = new File(path).exists() ? IconLoader.getIcon(image) : null;
        if (icon != null) {
          if (icon.getIconWidth() > EmptyIcon.ICON_18.getIconWidth()
              || icon.getIconHeight() > EmptyIcon.ICON_18.getIconHeight()) {
            Messages.showErrorDialog(
                component,
                IdeBundle.message("custom.icon.validation.message"),
                IdeBundle.message("title.choose.action.icon"));
            return false;
          }
          node.setUserObject(Pair.create(actionId, icon));
          mySelectedSchema.addIconCustomization(actionId, path);
        }
      } else {
        node.setUserObject(Pair.create(actionId, null));
        mySelectedSchema.removeIconCustomization(actionId);
        final DefaultMutableTreeNode nodeOnToolbar = findNodeOnToolbar(actionId);
        if (nodeOnToolbar != null) {
          editToolbarIcon(actionId, nodeOnToolbar);
          node.setUserObject(nodeOnToolbar.getUserObject());
        }
      }
      return true;
    }
    return false;
  }
    @Nullable
    public Set<Object> getTreeSelectedActionIds() {
      TreePath[] paths = myTree.getSelectionPaths();
      if (paths == null) return null;

      Set<Object> actions = new HashSet<Object>();
      for (TreePath path : paths) {
        Object node = path.getLastPathComponent();
        if (node instanceof DefaultMutableTreeNode) {
          DefaultMutableTreeNode defNode = (DefaultMutableTreeNode) node;
          Object userObject = defNode.getUserObject();
          actions.add(userObject);
        }
      }
      return actions;
    }
 // ======================================================
 // ======================================================
 private void treeMousePressed(java.awt.event.MouseEvent evt) {
   int mask = evt.getModifiers();
   if ((mask & MouseEvent.BUTTON1_MASK) != 0) {
     TreePath selectedPath = getPathForLocation(evt.getX(), evt.getY());
     if (selectedPath == null) return;
     DefaultMutableTreeNode node =
         (DefaultMutableTreeNode) selectedPath.getPathComponent(selectedPath.getPathCount() - 1);
     Object o = node.getUserObject();
     if (o instanceof String) {
       TransferHandler transfer = this.getTransferHandler();
       transfer.exportAsDrag(this, evt, TransferHandler.COPY);
       dragged_node = node;
       parent.setCursor(renderer.getNodeCursor(node));
     }
   }
 }
Beispiel #28
0
 @Nullable
 public static DefaultMutableTreeNode findNodeWithObject(
     final DefaultMutableTreeNode aRoot, final Object aObject) {
   if (Comparing.equal(aRoot.getUserObject(), aObject)) {
     return aRoot;
   } else {
     for (int i = 0; i < aRoot.getChildCount(); i++) {
       final DefaultMutableTreeNode candidate =
           findNodeWithObject((DefaultMutableTreeNode) aRoot.getChildAt(i), aObject);
       if (null != candidate) {
         return candidate;
       }
     }
     return null;
   }
 }
Beispiel #29
0
 @NotNull
 public static <T> List<T> collectSelectedObjectsOfType(JTree tree, Class<T> clazz) {
   final TreePath[] selections = tree.getSelectionPaths();
   if (selections != null) {
     final ArrayList<T> result = new ArrayList<T>();
     for (TreePath selection : selections) {
       final DefaultMutableTreeNode node =
           (DefaultMutableTreeNode) selection.getLastPathComponent();
       final Object userObject = node.getUserObject();
       if (clazz.isInstance(userObject)) {
         //noinspection unchecked
         result.add((T) userObject);
       }
     }
     return result;
   }
   return Collections.emptyList();
 }
 protected void doOKAction() {
   if (myNode != null) {
     if (!doSetIcon(myNode, myTextField.getText(), getContentPane())) {
       return;
     }
     final Object userObject = myNode.getUserObject();
     if (userObject instanceof Pair) {
       String actionId = (String) ((Pair) userObject).first;
       final AnAction action = ActionManager.getInstance().getAction(actionId);
       final Icon icon = (Icon) ((Pair) userObject).second;
       action.getTemplatePresentation().setIcon(icon);
       action.setDefaultIcon(icon == null);
       editToolbarIcon(actionId, myNode);
     }
     myActionsTree.repaint();
   }
   setCustomizationSchemaForCurrentProjects();
   super.doOKAction();
 }