Index: ResultView.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/search/ResultView.java,v retrieving revision 1.28 diff -u -r1.28 ResultView.java --- ResultView.java 20 Sep 2004 08:02:59 -0000 1.28 +++ ResultView.java 6 Oct 2004 09:16:33 -0000 @@ -30,7 +30,9 @@ import java.util.Observable; import java.util.Observer; import javax.accessibility.AccessibleContext; +import javax.swing.AbstractAction; import javax.swing.AbstractButton; +import javax.swing.Action; import javax.swing.ActionMap; import javax.swing.BorderFactory; import javax.swing.Box; @@ -827,6 +829,9 @@ /** */ private class RootNode extends AbstractNode { + + /** */ + private Action expandAllAction; /** */ @@ -838,6 +843,60 @@ */ void changeChildren(final Children children) { super.setChildren(children); + } + + /** + */ + public Action[] getActions(boolean contextActions) { + if (contextActions) { + return super.getActions(contextActions); + } else if (isEmpty()) { + return new Action[0]; + } else { + if (expandAllAction == null) { + expandAllAction = new ExpandAllAction(); + } + return new Action[] { expandAllAction }; + } + } + + /** + */ + private boolean isEmpty() { + if (isLeaf()) { + return true; + } + + try { + ResultTreeChildren children = (ResultTreeChildren) getChildren(); + return children.isEmpty(); + } catch (ClassCastException ex) { + assert false; + ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, + ex); + } + return false; + } + + /** + */ + private final class ExpandAllAction extends AbstractAction { + + /** + */ + private ExpandAllAction() { + String name = NbBundle.getMessage( + getClass(), + "TEXT_LABEL_ExpandAllActionName");//NOI18N + putValue(Action.NAME, name); + } + + /** + */ + public void actionPerformed(ActionEvent e) { + ResultView.this.treeView.expandAll(); + } + } } Index: ResultTreeChildren.java =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/search/ResultTreeChildren.java,v retrieving revision 1.5 diff -u -r1.5 ResultTreeChildren.java --- ResultTreeChildren.java 19 Aug 2004 08:10:08 -0000 1.5 +++ ResultTreeChildren.java 6 Oct 2004 09:16:33 -0000 @@ -215,6 +215,7 @@ removed = keys.remove(foundObject); } if (removed) { + size--; sort(sorted); } } Index: Bundle.properties =================================================================== RCS file: /cvs/utilities/src/org/netbeans/modules/search/Bundle.properties,v retrieving revision 1.28 diff -u -r1.28 Bundle.properties --- Bundle.properties 3 Aug 2004 15:01:44 -0000 1.28 +++ Bundle.properties 6 Oct 2004 09:16:33 -0000 @@ -67,6 +67,9 @@ # RemoveFromSearchAction TEXT_LABEL_RemoveFromSearchActionName=Remove From Search +# ExpandAllAction +TEXT_LABEL_ExpandAllActionName=Expand All + #Result view texts TEXT_MSG_NO_NODE_FOUND=No matching nodes were found. TEXT_MSG_FOUND_X_NODES=Found {0} matching nodes.