1 19 20 package org.netbeans.modules.java.navigation.actions; 21 22 import org.netbeans.modules.java.navigation.JavaHierarchy; 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 InspectHierarchyAction extends AbstractNavigationAction { 35 36 public InspectHierarchyAction() { 37 putValue("noIconInMenu", Boolean.TRUE); } 39 40 protected void performAction(Node[] activatedNodes) { 41 DataObject dataObject = 42 (DataObject) activatedNodes[0].getLookup().lookup(DataObject.class); 43 44 if (dataObject != null) { 45 final FileObject fileObject = dataObject.getPrimaryFile(); 46 47 if (fileObject != null && 49 "java".equalsIgnoreCase(fileObject.getExt()) && "text/x-java".equals(fileObject.getMIMEType())) { JavaHierarchy.show(fileObject); 53 return; 54 } 55 } 56 57 beep(); 58 } 59 60 public String getName() { 61 return NbBundle.getMessage(InspectMembersAction.class, 62 "CTL_InspectHierarchyAction"); } 64 65 protected Class [] cookieClasses() { 66 return new Class [] { DataObject.class }; 67 } 68 } 69 | Popular Tags |