Re: Re: project conversion questions
Svata Dedic <[email protected]> Thu, 31 Jul 2003 06:31:07 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.projects.devel |
|---|---|
| Message-ID | <[email protected]> |
Peter Wisnovsky wrote: > Part of my problem is that I'm finding I need to have a Project around > to call various APIs (for example ClassElement.forName) but > SourceElement -- my module is really built around the src API -- does > not provide an accessor for the project this source element is in (I > guess it could be more than one, I'm not sure I have a way of dealing > with this yet.) Would be be possible to have a method > SourceElement.getProjects()? The old techniques for finding stuff I don't think so. Adding accessors for each containing host or included facet of SourceElement is not a great idea, IMHO; but since the Project is alraedy present in the APIs (CE.forName), there might be a helper function. Why don't you use SourceElement.getCookie(ProjectMember.class) ? If the SourceElement was extracted from a project-aware node, it should have that cookie. Only if your action originates from a project-free node, then you have to use Project.findAll() to find out the project. If there's no such cookie, please file a bug -- there should be one, as there's the DataObject cookie. -Svata