Re: setting package on new Java objects
Svata Dedic <[email protected]> Sat, 16 Aug 2003 15:29:21 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.projects.devel |
|---|---|
| Message-ID | <[email protected]> |
Cliff Draper wrote: > Am I way off base here, it seems like the following code using good > old fashioned SourceElement and Identifier should work, but the > package comes out as > ".home.cliffwd.cvs.sequoia.ffjuserdir.samples.src.pkg", instead of the > expected "pkg". > > ProjectMember javaObject = ... > SourceCookie sourceCookie = (SourceCookie) javaObject.getLookup().lookup(SourceCookie.class); > > SourceElement sourceElement = sourceCookie.getSource(); > sourceElement.prepare().waitFinished(); > Identifier packageIdentifier = sourceElement.getPackage(); > packageIdentifier.getSourceName()... > Please check the setup of the project you are working with. Could you please send back output from ClassPath cp = ProjectPath.find(javaObject, ProjectPath.PATH_SOURCE); System.err.println(cp); this should pring out what the project thinks the source roots are. You may get in trouble if the source is not in any project; maybe there may be some issue left for template sources (those coming from system/project filesystem), let us know if it is your case. -Svata