Re: Moving to new looks?
Vitezslav Stejskal <[email protected]> Tue, 05 Aug 2003 10:26:12 +0200
| Newsgroups | gmane.comp.java.netbeans.modules.projects.devel |
|---|---|
| Message-ID | <[email protected]> |
[email protected] wrote: > >I was using the old looks api to add an action and a lookup to the project >node. Under the new api, I can figure out how to add an action, but I'm having >trouble with the "add a lookup portion". > >Before, I could override attachTo to add my new lookup to the NodeSubstitute. > >Now, I could override getLookupItems(), but returning a Collection is strictly >inferior to returning a Lookup - with a Lookup I can lazily create objects, >etc. > > You still can. The collection doesn't contain instances diractly, but the instances of Lookup.Item class. There is a helper method o.o.util.lookup.Lookups.lookupItem(Object, String) which you can use to create Lookup.Item for your instance. But you are free to implement Lookup.Item on your own and create your instance lazily. >Also, the documentation for DefaultLook.actionBase() is incomplete - it says >you could use the context Looks/Actions/... to declaratively declare actions, >but I can't find an example of this actually being done so I can see how to do >it. > > Well, examples are always good, but this isn't so hard to do. Just create a folder in your module's XML layer which will be located on the path returned from the actionBase method and register actions in that folder (using .instance files as for e.g. main menu). That's it. The flip side of this is that it doesn't work at all for Looks registered in the project nature (and thus loaded from the ProjectFilesystem). See http://www.netbeans.org/issues/show_bug.cgi?id=35271 for details. -vita