Re: setting package on new Java objects

Cliff Draper <[email protected]> Mon, 18 Aug 2003 15:07:58 -0700 (PDT)
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>
From: Svata Dedic <[email protected]>
Date: Sat, 16 Aug 2003 15:29:21 +0200
> Please check the setup of the project you are working with. Could you 
> please send back output from
> 	ClassPath cp = ProjectPath.find(javaObject, ProjectPath.PATH_SOURCE);
> 	System.err.println(cp);
> this should pring out what the project thinks the source roots are.
> You may get in trouble if the source is not in any project; maybe there 
> may be some issue left for template sources (those coming from 
> system/project filesystem), let us know if it is your case.

Using the following code,
        ClassPath cp = ProjectPath.find(javaObject, ProjectPath.PATH_SOURCE);
        System.err.println("cp.class="+cp.getClass());
        System.err.println("cp="+cp);
        FileObject[] roots = cp.getRoots();
        for (int i = 0; i < roots.length; ++i)
            System.err.println("root="+roots[i]);
        System.err.println("entries="+cp.entries());
        System.err.println("type="+cp.getType());
        System.err.println("resources="+cp.getResources());
        System.err.println("allResources="+cp.getAllResources());

I got the following output:
cp.class=class org.netbeans.modules.java.classpath.DefaultProxyClassPath
cp=org.netbeans.modules.java.classpath.DefaultProxyClassPath@7463b3
root=/home/cliffwd/cvs/sequoia/ffjuserdir/samples/src
entries=[org.netbeans.spi.java.classpath.ClassPathBase$CPEntryImpl@1d62b0c]
type=source
resources=[org.netbeans.modules.java.project.SourceContainer$ResourceImpl@1bb5d98]
allResources=[org.netbeans.modules.java.project.SourceContainer$ResourceImpl@1bb5d98]

And I'm getting a package Identifier of
".home.cliffwd.cvs.sequoia.ffjuserdir.samples.src.examples" where I
expect "examples".

The source java file is being created by the module.  It's source is
underneath the project's source root.

regards,
Cliff Draper    Sun Microsystems, Forte Tools
My opinions may or may not reflect those of my employer.
---------------------------- food for thought ---------------------------
"Programmer, noun: A red-eyed, mumbling mammal capable of conversing with
inanimate objects." [email protected]