Re: project conversion questions

Svata Dedic <[email protected]> Sun, 27 Jul 2003 23:26:11 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>
domain>
In-Reply-To: <[email protected]>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit

Peter Wisnovsky wrote:
>  > > 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?
> 
> Thanks for all the help. Now I have a related question. How do I get
> from a new file I've created to the source cookie? I used to have
> 
>         DataFolder folder = model.getSourceDataFolder();
>         FileObject packageObject = folder.getPrimaryFile();
> ...
>         servantFileObject = packageObject.createData(servantName, "java");
>         JavaDataObject servantInterfaceJavaObject = (JavaDataObject) DataObject.find(servantInterfaceFileObject);
>         JavaDataObject servantJavaObject = (JavaDataObject) DataObject.find(servantFileObject);
>         SourceCookie servantSourceCookie = (SourceCookie) servantJavaObject.getCookie(SourceCookie.class);
>         SourceElement servantSourceElement = servantSourceCookie.getSource();

Instead of DataObject.find() just use 
theProjectInstance.getProjectMember(theFile) to get a ProjectMember 
(file's representant within the project).

-Svata