Re: unable to look up current project
markiewb <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.devel |
|---|---|
| Message-ID | <[email protected]> |
Hej Peter, Thanks for the praise. I am not from the NB team nor employed by Oracle. But I know some APIs through my own plugins, NB platform courses, NB books and NB patches, I provided. Best regards, markiewb Från: mcheung63 Skickat: Sonntag, 10. April 2016 07:11 Till: [email protected] Ämne: [nbdev] unable to look up current project Thanks you Mr Markiweb, you are a good. I copy these code from google and it works :-) Are you in netbeans official dev team? You are so familiar with netbeans development. Code: private Project getProject() { Lookup context = Utilities.actionsGlobalContext(); Project prj = context.lookup(Project.class); if (prj == null) { Node node = context.lookup(Node.class); if (node != null) { DataObject dataObject = node.getLookup().lookup(DataObject.class); if (dataObject == null) { return null; } FileObject fileObject = dataObject.getPrimaryFile(); prj = FileOwnerQuery.getOwner(fileObject); } } return prj; } thanks from Peter[/code]