1 19 20 package org.netbeans.core.ui; 21 22 import java.awt.Image ; 23 import java.beans.BeanInfo ; 24 import javax.swing.Action ; 25 import org.netbeans.core.LoaderPoolNode; 26 import org.openide.actions.PropertiesAction; 27 import org.openide.actions.ReorderAction; 28 import org.openide.actions.ToolsAction; 29 import org.openide.nodes.FilterNode; 30 import org.openide.nodes.Node; 31 import org.openide.nodes.Node.PropertySet; 32 import org.openide.util.Utilities; 33 import org.openide.util.actions.SystemAction; 34 35 39 public final class UINodes { 40 41 private final static String objectTypesIconURL = "org/netbeans/core/resources/objectTypes.gif"; private final static String objectTypesIcon32URL = "org/netbeans/core/resources/objectTypes32.gif"; 44 45 private static final PropertySet[] NO_PROPERTY_SETS = {}; 46 47 48 private UINodes() { 49 } 50 51 54 public static Node createObjectTypes () { 55 return new ObjectTypesNode (); 56 } 57 58 59 private static class IconSubstituteNode extends FilterNode { 60 61 62 private String iconURL, icon32URL; 63 64 IconSubstituteNode (Node ref, String iconURL, String icon32URL) { 65 super (ref); 66 this.iconURL = iconURL; 67 this.icon32URL = icon32URL; 68 } 69 70 public Image getIcon (int type) { 71 if ((type == BeanInfo.ICON_COLOR_16x16) || (type == BeanInfo.ICON_MONO_16x16)) { 72 return Utilities.loadImage (iconURL); 73 } 74 else { 75 return Utilities.loadImage (icon32URL); 76 } 77 } 78 79 public Image getOpenedIcon (int type) { 80 return getIcon(type); 81 } 82 83 public String getHtmlDisplayName() { 84 return null; 85 } 86 87 88 public PropertySet[] getPropertySets () { 89 return NO_PROPERTY_SETS; 90 } 91 92 public boolean canDestroy () { 93 return false; 94 } 95 96 public boolean canCut () { 97 return false; 98 } 99 100 public boolean canRename () { 101 return false; 102 } 103 } 104 105 106 private static class ObjectTypesNode extends IconSubstituteNode { 107 108 public ObjectTypesNode() { 109 this (LoaderPoolNode.getLoaderPoolNode()); 110 } 111 112 public ObjectTypesNode(Node ref) { 113 super(ref, objectTypesIconURL, objectTypesIcon32URL); 114 } 115 116 public Action [] getActions(boolean context) { 117 return new Action [] { 118 SystemAction.get(ReorderAction.class), 119 null, 120 SystemAction.get(ToolsAction.class), 121 SystemAction.get(PropertiesAction.class) 122 }; 123 } 124 } 125 126 } 127 | Popular Tags |