DevFaqLookupForDataNode

How can I add support for Lookups on nodes representing my file type?

Any object you create can implement Lookup.Provider. The simplest way to create a mutable lookup is by using InstanceContent and AbstractLookup. Simplified typical usage:

public SomeObject implements Lookup.Provider {
   private InstanceContent content = new InstanceContent();
   private final AbstractLookup lkp = new AbstractLookup(content);
 
   public someMethod() {
      ic.set (someCollection...);
   }
 
   public Lookup getLookup() {
      return lkp;
   }
}

This is how you create a lookup with dynamic content of your choosing. See also Tom Wheeler's TodoListManager for an example of some code that illustrates how to do this.

If you are using ProxyLookup to proxy another (or multiple) lookups, and you want to change the set of Lookups you are proxying on the fly, you will need to subclass ProxyLookup and call the protected method setLookups(Lookup... lookups).

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo