1 19 20 package org.openide.filesystems.data; 21 22 import java.awt.Image ; 23 import java.awt.Toolkit ; 24 import java.awt.datatransfer.Transferable ; 25 import java.util.List ; 26 import java.util.ResourceBundle ; 27 28 import org.openide.nodes.*; 29 import org.openide.actions.*; 30 import org.openide.loaders.DataFolder; 31 import org.openide.util.datatransfer.NewType; 32 import org.openide.util.actions.SystemAction; 33 import org.openide.util.HelpCtx; 34 import org.openide.util.NbBundle; 35 36 38 public final class JavaSrc { 39 40 41 static SystemAction[] staticActions; 42 43 static SystemAction[] topStaticActions; 44 45 private static final Node.PropertySet[] NO_PROPERTIES = new Node.PropertySet[0]; 46 47 public JavaSrc() { 48 } 49 50 52 JavaSrc(DataFolder folder) { 53 } 54 55 public HelpCtx getHelpCtx () { 56 return new HelpCtx (Object .class); 57 } 58 59 62 public NewType[] getNewTypes () { 63 return new NewType[0]; 64 } 65 66 protected void createPasteTypes (Transferable t, List s) { 67 s.clear (); 68 } 69 70 73 public SystemAction[] getActions () { 74 if (staticActions == null) 75 topStaticActions = new SystemAction [] { 76 SystemAction.get (FileSystemAction.class), 77 null, 78 SystemAction.get(ToolsAction.class), 79 SystemAction.get(PropertiesAction.class), 80 }; 81 return topStaticActions; 82 } 83 84 85 public Node.PropertySet[] getPropertySets () { 86 return NO_PROPERTIES; 87 } 88 89 public boolean canDestroy () { 90 return false; 91 } 92 93 public boolean canCut () { 94 return false; 95 } 96 97 public boolean canRename () { 98 return false; 99 } 100 101 104 static final class ActionsPoolChildren extends FilterNode.Children { 105 106 107 public ActionsPoolChildren (DataFolder folder) { 108 super(folder.getNodeDelegate ()); 109 } 110 111 116 protected Node copyNode (Node node) { 117 DataFolder df = (DataFolder)node.getCookie(DataFolder.class); 118 if (df != null) { 119 return null; 120 } 121 return new ActionItemNode(node); 122 } 123 124 } 125 126 static final class ActionItemNode extends FilterNode { 127 128 static Image itemIcon; 129 static Image itemIcon32; 130 131 132 static SystemAction[] staticActions; 133 134 135 ActionItemNode (Node filter) { 136 super(filter, Children.LEAF); 137 } 138 139 159 160 163 public SystemAction[] getActions () { 164 if (staticActions == null) { 165 staticActions = new SystemAction [] { 166 SystemAction.get(CopyAction.class), 167 null, 168 SystemAction.get(ToolsAction.class), 169 SystemAction.get(PropertiesAction.class), 170 }; 171 } 172 return staticActions; 173 } 174 175 177 public boolean canRename () { 178 return false; 179 } 180 181 public boolean canDestroy () { 182 return false; 183 } 184 185 public boolean canCut () { 186 return false; 187 } 188 189 190 public Node.PropertySet[] getPropertySets () { 191 204 return new Node.PropertySet[] { }; 205 } 206 207 } 209 } 210 | Popular Tags |