Re: Re: project conversion questions

Svata Dedic <[email protected]> 31 Jul 2003 08:36:37 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Message-ID <[email protected]>
On Thu, 2003-07-31 at 06:56, Peter Wisnovsky wrote:
>  > 
>  > If there's no such cookie, please file a bug -- there should be one, as 
>  > there's the DataObject cookie.
> 
> Hmm...this confuses me. How do I know what cookies I should expect to
> find in an object? Your first statement suggests it will usually be
> there, but sometimes may not be. Does this mean I have to always
> program defensively for the possibility that cookie might not be
> there? At least with interfaces I know there is a contract.
Isn't it mentioned anywhere ? Please file a bug on documentation; I will
try to document the cookies injected by java project support to various
places - if my time permits (or does someone want to document it sooner
?)

Every SourceElement extracted from a project-aware context should have
such cookie (to provide exactly the binding to the project you seem to
need). Those created directly on top of a file
(DataObject.getCookie(SourceCookie.class) are not bound to any project -
DataObject is project-neutral.

It should be a part of Java Project API contract, however, that there's
a ProjectMember in the lookup of source / class / method. 
Although for a few carefully selected things, natural for the model it
is OK to have direct getters, I do not know if the Project/ProjectMember
is the case -- what others think ?

-Svata