1 19 20 21 package org.netbeans.modules.form; 22 23 import javax.swing.Action ; 24 import org.netbeans.api.java.loaders.JavaDataSupport; 25 import org.openide.nodes.AbstractNode; 26 import org.openide.nodes.FilterNode; 27 import org.openide.nodes.Node; 28 29 import org.openide.util.actions.SystemAction; 30 31 36 public class FormDataNode extends FilterNode { 37 38 40 41 private static final String FORM_ICON_BASE = "org/netbeans/modules/form/resources/form.gif"; 43 44 public FormDataNode(FormDataObject fdo) { 45 this(JavaDataSupport.createJavaNode(fdo.getPrimaryFile())); 46 } 47 48 private FormDataNode(Node orig) { 49 super(orig); 50 ((AbstractNode) orig).setIconBaseWithExtension(FORM_ICON_BASE); 51 } 52 53 @Override 54 public Action getPreferredAction() { 55 return new javax.swing.AbstractAction () { 57 public void actionPerformed(java.awt.event.ActionEvent e) { 58 FormEditorSupport supp = getCookie(FormEditorSupport.class); 59 supp.openFormEditor(false); 60 } 61 }; 62 } 63 64 @Override 65 public Action [] getActions(boolean context) { 66 Action [] javaActions = super.getActions(context); 67 Action [] formActions = new Action [javaActions.length+2]; 68 formActions[0] = javaActions[0]; formActions[1] = SystemAction.get(org.openide.actions.EditAction.class); 70 formActions[2] = null; 71 System.arraycopy(javaActions, 1, formActions, 3, javaActions.length-1); 72 return formActions; 73 } 74 75 } 76 | Popular Tags |