Re: Re: project conversion questions

Tomas Zezula <[email protected]> Thu, 31 Jul 2003 08:33:01 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Organization Sun Microsystems
Message-ID <[email protected]>
On Thu, 2003-07-31 at 06:31, Svata Dedic wrote:
> 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.
I agree with Svata, the only problem is that Project is not a
Node.Cookie :-(
To allow this I will need to extend the Element interface by getLookup()
method.
Tomas
> 
> If there's no such cookie, please file a bug -- there should be one, as 
> there's the DataObject cookie.
> 
> -Svata
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>