Lines 30-36
Link Here
|
30 |
import java.util.Observable; |
30 |
import java.util.Observable; |
31 |
import java.util.Observer; |
31 |
import java.util.Observer; |
32 |
import javax.accessibility.AccessibleContext; |
32 |
import javax.accessibility.AccessibleContext; |
|
|
33 |
import javax.swing.AbstractAction; |
33 |
import javax.swing.AbstractButton; |
34 |
import javax.swing.AbstractButton; |
|
|
35 |
import javax.swing.Action; |
34 |
import javax.swing.ActionMap; |
36 |
import javax.swing.ActionMap; |
35 |
import javax.swing.BorderFactory; |
37 |
import javax.swing.BorderFactory; |
36 |
import javax.swing.Box; |
38 |
import javax.swing.Box; |
Lines 827-832
Link Here
|
827 |
/** |
829 |
/** |
828 |
*/ |
830 |
*/ |
829 |
private class RootNode extends AbstractNode { |
831 |
private class RootNode extends AbstractNode { |
|
|
832 |
|
833 |
/** */ |
834 |
private Action expandAllAction; |
830 |
|
835 |
|
831 |
/** |
836 |
/** |
832 |
*/ |
837 |
*/ |
Lines 838-843
Link Here
|
838 |
*/ |
843 |
*/ |
839 |
void changeChildren(final Children children) { |
844 |
void changeChildren(final Children children) { |
840 |
super.setChildren(children); |
845 |
super.setChildren(children); |
|
|
846 |
} |
847 |
|
848 |
/** |
849 |
*/ |
850 |
public Action[] getActions(boolean contextActions) { |
851 |
if (contextActions) { |
852 |
return super.getActions(contextActions); |
853 |
} else if (isEmpty()) { |
854 |
return new Action[0]; |
855 |
} else { |
856 |
if (expandAllAction == null) { |
857 |
expandAllAction = new ExpandAllAction(); |
858 |
} |
859 |
return new Action[] { expandAllAction }; |
860 |
} |
861 |
} |
862 |
|
863 |
/** |
864 |
*/ |
865 |
private boolean isEmpty() { |
866 |
if (isLeaf()) { |
867 |
return true; |
868 |
} |
869 |
|
870 |
try { |
871 |
ResultTreeChildren children = (ResultTreeChildren) getChildren(); |
872 |
return children.isEmpty(); |
873 |
} catch (ClassCastException ex) { |
874 |
assert false; |
875 |
ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, |
876 |
ex); |
877 |
} |
878 |
return false; |
879 |
} |
880 |
|
881 |
/** |
882 |
*/ |
883 |
private final class ExpandAllAction extends AbstractAction { |
884 |
|
885 |
/** |
886 |
*/ |
887 |
private ExpandAllAction() { |
888 |
String name = NbBundle.getMessage( |
889 |
getClass(), |
890 |
"TEXT_LABEL_ExpandAllActionName");//NOI18N |
891 |
putValue(Action.NAME, name); |
892 |
} |
893 |
|
894 |
/** |
895 |
*/ |
896 |
public void actionPerformed(ActionEvent e) { |
897 |
ResultView.this.treeView.expandAll(); |
898 |
} |
899 |
|
841 |
} |
900 |
} |
842 |
|
901 |
|
843 |
} |
902 |
} |