Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.modules.projectuiapi/1 1.13.22 5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.netbeans.spi.project.ui
Interface LogicalViewProvider

    public interface LogicalViewProvider

Ability for a `Project` to supply a logical view of itself.

See Also:
  `Project.getLookup()`

Method Summary
`Node` | `createLogicalView()` Create a logical view node.
`Node` | `findPath(Node root, Object target)` Try to find a given node in the logical view.

Method Detail

### createLogicalView

    Node createLogicalView()

  Create a logical view node. Projects should not attempt to cache this node in any way; this call should always create a fresh node with no parent. The node's lookup should contain the project object.

  Returns:
    a node displaying the contents of the project in an intuitive way

### findPath

    Node findPath(Node root,
                  Object target)

  Try to find a given node in the logical view. If some node within the logical view tree has the supplied object in its lookup, it ought to be returned if that is practical. If there are multiple such nodes, the one most suitable for display to the user should be returned.
  This may be used to select nodes corresponding to files, etc. The following constraint should hold:

       private static boolean isAncestor(Node root, Node n) {
           if (n == null) return false;
           if (n == root) return true;
           return isAncestor(root, n.getParentNode());
       }
       // ...
       Node root = ...;
       Object target = ...;
       LogicalViewProvider lvp = ...;
       Node n = lvp.findPath(root, target);
       if (n != null) {
           assert isAncestor(root, n);
           Lookup.Template tmpl = new Lookup.Template(null, null, target);
           Collection res = n.getLookup().lookup(tmpl).allInstances();
           assert Collections.singleton(target).equals(new HashSet(res));
       }

  Parameters:
    `root` - a root node. E.g. a node from `createLogicalView()` or some wapper (FilterNode) around the node. The provider of the functionality is responsible for finding the appropriate node in the wrapper's children.
    `target` - a target cookie, such as a `DataObject`
  Returns:
    a subnode with that cookie, or null

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| org.netbeans.modules.projectuiapi/1 1.13.22 5
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Built on December 7 2006. | Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.