/* (non-Javadoc) * @see org.openide.util.actions.NodeAction#performAction(org.openide.nodes.Node[]) */ @Override protected void performAction(Node[] nodes) { // context. if (null != nodes) { for (Node currentnode : nodes) { DataObject dObj = currentnode.getLookup().lookup(DataObject.class); // Project pRoot = currentnode.getLookup().lookup(Project.class); Project pRoot = Te2mWizardBase.findProjectThatOwnsNode(currentnode); if (null != dObj) { determineSelectedClass(dObj); FileObject fo = dObj.getPrimaryFile(); JavaSource jsource = JavaSource.forFileObject(fo); if (jsource == null) { StatusDisplayer.getDefault().setStatusText("Not a Java file: " + fo.getPath()); } else { StatusDisplayer.getDefault().setStatusText("Hurray! A Java file: " + fo.getPath()); executeWizard(currentnode); } } } } }
/* (non-Javadoc) * @see org.openide.util.actions.NodeAction#enable(org.openide.nodes.Node[]) */ @Override protected boolean enable(Node[] nodes) { // TODO Solve friend dependency issues to maven module and try again :-/ // boolean isMvn = false; if (null != nodes) { for (Node currentnode : nodes) { DataObject dObj = currentnode.getLookup().lookup(DataObject.class); if (null != dObj) { determineSelectedClass(dObj); } Project pro = Te2mWizardBase.findProjectThatOwnsNode(currentnode); /* if( null!=pro && pro instanceof NbMavenProject ) { isMvn=true; NbMavenProject mvnPro = (NbMavenProject)pro; System.out.println("Works :-)"); } */ } } /* if (isMvn) { return isEnabled(); } return false; */ return isEnabled(); }