[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.tools.jdt] Re: createCompilationUnit() -- new class is created in default package...?

I think that's what I did wrong --

will switch to: /project/src/structures and use "package structures;"

(otherwise I think I have something like /project/structures/structures, 
which is awkward)



"Walter Harley" <wharley@xxxxxxx> wrote in message 
news:f85m22$7oe$1@xxxxxxxxxxxxxxxxxxxx
> "Michael Megliola" <michael.megliola@xxxxxxxxx> wrote in message 
> news:f832cb$ulj$1@xxxxxxxxxxxxxxxxxxxx
>>I am writing a code generator that targets projects which include a 
>>directory:
>>
>> /project/structures
>>
>> this directory is designated as a source entry (using 
>> JavaCore.newSourceEntry)... that all seems fine, but:
>>
>> 1. I get a target package fragment using 
>> IJavaProject.findPackageFragment(new Path("/project/structures"));
>
> It sounds to me like your directory structure does not align with your 
> package structure.
>
> If project/structures is a source directory, and you want something to go 
> in a package inside that, it would be in a subdirectory: for instance, 
> package pa would be /project/structures/pa, and the code would start with 
> "package pa;".
>
> To put something in a package named "structures", you'd want /project to 
> be the source entry.  (Which is generally a bad idea since it means you've 
> got source code at the root of your project.)
>