Re: Re: project conversion questions

Svata Dedic <[email protected]> Fri, 01 Aug 2003 20:38:35 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>
omain>	<[email protected]>	<[email protected]>	<[email protected]>	<[email protected]>	<[email protected]> <[email protected]
domain>
In-Reply-To: <[email protected]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Peter Wisnovsky wrote:
>  > Does your code's execution start with a knowledge of a Node ? If so,
>  > then you could use Node.getLookup().lookup(ProjectMember).
> 
> No, not always, but maybe I need to change this. There are various
> ways in which I am bound to the Java object I'm annotating
> 
> - the editor context menu
> 
... you should be able to get the ProjectMember from the TopComponent's 
Lookup.

> - the node actions
> 
... from Node's Lookup
> - the node filter factory (now obsolete, need to convert to looks)
> 
... from Look.getLookup()

> The module I have is built on the Java module -- it has no data
> objects of its own. It has to access the source element to manipulate
> the class, it needs access to the project member to launch the source
> editor, it needs access to the fileobject to locate the source
> directory to generate any side files that might be needed, and it
> needs access to the Java node to add different look nodes. So the set
> {SourceElement, FileObject, ProjectMember, Node} constitute a logical
> object that I need to navigate easily and efficiently, hopefully
> without having to know details of the implementation. In the past I
> didn't have to think too carefully about where things got started
> since I could always get from each object to each other object. I had
> figured out how to do these navigations in the 3.5 world, but lots of
> things have now changed.
> 
Hopefully the org.openide.src.*Element will get their Lookup (in 
addition to to-be-deprecated getCookie()) soon, so the navigation should 
not be a problem in general.
I would suggest not to rely on that ProjectMember is in ClassElement's 
Lookup (cookies) -- it's more safe to suppose it is only available from 
SourceElement.
This distinction is quite useful when you need to check whether a node 
represents a whole file (has ProjectMember) or a portion of a file (has 
no ProjectMember, but may have another Configurable). Anyway, what 
cookies are added at which objects should be clearly documented.

-Svata