unable to look up current project
"mcheung63" <[email protected]>
| Newsgroups | gmane.comp.java.netbeans.devel |
|---|---|
| Message-ID | <[email protected]> |
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]