Re: Re: project conversion questions

Tomas Zezula <[email protected]> Thu, 31 Jul 2003 08:23:57 +0200
Newsgroups gmane.comp.java.netbeans.modules.projects.devel
Organization Sun Microsystems
Message-ID <[email protected]>
On Thu, 2003-07-31 at 06:56, Peter Wisnovsky wrote:
>  > I don't think so. Adding accessors for each containing host or included 
>  > facet of SourceElement is not a great idea, IMHO; but since the Project 
>  > is alraedy present in the APIs (CE.forName), there might be a helper 
>  > function.
>  > 
>  > Why don't you use SourceElement.getCookie(ProjectMember.class) ?
> 
> How would I have known that there is such an object in the cookie
> list? I tried looking in the debugger but the navigating a weak
> reference table in the debugger is slow going.
> 
>  > If the 
>  > SourceElement was extracted from a project-aware node, it should have 
>  > that cookie. Only if your action originates from a project-free node, 
>  > then you have to use Project.findAll() to find out the project.
>  > 
>  > 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.
> 
The content of CookieSet or Lookup (which is now preferred) should be
described in the documentation.
Yes, the Project can be determined only in the case when the file
belongs to it.
In case that the source is external to a project, e.g. it was opened
from some filesystem browser from location which is not in the project
the project can not be determined.
If the project is missing it is safe for you to warn a user that the
action can not be performed and end the action.
Tomas
> Peter
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>