1 19 20 package org.netbeans.modules.java.navigation.actions; 21 22 import org.netbeans.modules.java.navigation.JavaMembers; 23 import org.openide.filesystems.FileObject; 24 import org.openide.loaders.DataObject; 25 import org.openide.nodes.Node; 26 import org.openide.util.NbBundle; 27 import static javax.lang.model.util.ElementFilter.*; 28 29 34 public final class InspectMembersAction extends AbstractNavigationAction { 35 36 public InspectMembersAction() { 37 putValue("noIconInMenu", Boolean.TRUE); } 39 40 protected void performAction(Node[] activatedNodes) { 41 DataObject dataObject = (DataObject) activatedNodes[0].getLookup() 42 .lookup(DataObject.class); 43 44 if (dataObject != null) { 45 final FileObject fileObject = dataObject.getPrimaryFile(); 46 47 if (fileObject != null && 48 "java".equalsIgnoreCase(fileObject.getExt()) && "text/x-java".equals(fileObject.getMIMEType())) { JavaMembers.show(fileObject); 51 return; 52 } 53 } 54 55 beep(); 56 } 57 58 public String getName() { 59 return NbBundle.getMessage(InspectMembersAction.class, 60 "CTL_InspectMembersAction"); 61 } 62 63 protected Class [] cookieClasses() { 64 return new Class [] { DataObject.class }; 65 } 66 } 67 | Popular Tags |