Re: project conversion questions

Svatopluk Dedic <[email protected]> Thu, 24 Jul 2003 17:16:30 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>
Peter Wisnovsky wrote:
>  > the Java core module (java/src) does not define any API and from this
>  > reason it does not export any public packages.
>  > Dependence on the JavaDataObject is not desired, this class is going to
>  > be removed in the NetBeans 4.0.
>  > The ProjectMember, EnvironmentProvier and Look should replace all the
>  > DataObejcts in the NB 4.0.
>  > Is it not enough for your module to test if the (ProjectMember or Node)
>  > has certain object in its lookup?
> 
> Well, I need to 1) determine efficiently if the selected node of a
> NodeAction represents a Java class, and 2) be able to get from the
> selected nodes provided to a NodeAction down to the SourceElement of
> the Java object. Is there a new way to do this now?
> 
[assuming (1) means "represents java source file, rather than java class]
1a) node.getLookup().lookup(ProjectMember.class).getOriginal() -> 
FileObject, you can check for mimetype, extension, ...
+ check that the node is indeed a project member...

1b) node.getLookup().lookup(SourceCookie.Editor.class) != null

[assuming (1) means "node represents a java class"]
node.getLookup().lookup(ClassElement.class);

2) node.getLookup().lookup(SourceCookie.class).getSource() ?

-Svata