| java.lang.Object org.openide.nodes.NodeOp
NodeOp | final public class NodeOp extends Object (Code) | | Utility class for operations on nodes.
author: Jaroslav Tulach, Petr Hamernik, Dafe Simonek |
Method Summary | |
public static int[] | computePermutation(Node[] arr1, Node[] arr2) Compute a permutation between two arrays of nodes. | static SystemAction[] | createFromNames(String[] arr) Utility method to remove dependency of this package on
org.openide.actions. | public static String[] | createPath(Node node, Node parent) Find a path (by name) from one node to the root or a parent.
Parameters: node - the node to start in Parameters: parent - parent node to stop in (can be null for the root) list of child names--i.e. | static void | exception(Throwable ex) Notifies an exception to error manager or prints its it to stderr. | public static Action[] | findActions(Node[] nodes) Asks the provided nodes for their actions and those that are common,
to all of them returns. | public static Node | findChild(Node node, String name) Look for a node child of given name. | public static JPopupMenu | findContextMenu(Node[] nodes) Compute common menu for specified nodes. | static JPopupMenu | findContextMenuImpl(Node[] nodes, ActionMap actionMap) Method for finding popup menu for one or more nodes. | public static Node | findPath(Node start, Enumeration<String> names) Traverse a path from a parent node down, by an enumeration of names. | public static Node | findPath(Node start, String[] names) Traverse a path from a parent node down, by an enumeration of names. | public static Node | findRoot(Node node) Find the root for a given node. | public static Node[] | fromHandles(Node.Handle[] handles) Takes array of handles and creates array of nodes. | public static SystemAction[] | getDefaultActions() Get the default actions for all nodes. | public static boolean | isSon(Node parent, Node son) Test whether the second node is a (direct) child of the first one. | public static void | setDefaultActions(SystemAction[] def) | public static Node.Handle[] | toHandles(Node[] nodes) Takes array of nodes and creates array of handles. | static void | warning(Throwable ex) Notifies an exception to error manager or prints its it to stderr. | public static NodeListener | weakNodeListener(NodeListener l, Object source) Creates a weak implementation of NodeListener. |
computePermutation | public static int[] computePermutation(Node[] arr1, Node[] arr2) throws IllegalArgumentException(Code) | | Compute a permutation between two arrays of nodes. The arrays
must have the same size. The permutation then can be
applied to the first array to create the
second array.
Parameters: arr1 - first array Parameters: arr2 - second array the permutation, or null if the arrays are the same exception: IllegalArgumentException - if the arrays cannot be permuted to each other. Eitherthey have different sizes or they do not contain the same elements. |
createFromNames | static SystemAction[] createFromNames(String[] arr)(Code) | | Utility method to remove dependency of this package on
org.openide.actions. This method takes names of classes from
that package and creates their instances.
Parameters: arr - the array of names like "Tools", "Properties", etc. cancontain nulls |
createPath | public static String[] createPath(Node node, Node parent)(Code) | | Find a path (by name) from one node to the root or a parent.
Parameters: node - the node to start in Parameters: parent - parent node to stop in (can be null for the root) list of child names--i.e. a path from the parent to the child node exception: IllegalArgumentException - if node 's getName()method returns null |
exception | static void exception(Throwable ex)(Code) | | Notifies an exception to error manager or prints its it to stderr.
Parameters: ex - exception to notify |
findActions | public static Action[] findActions(Node[] nodes)(Code) | | Asks the provided nodes for their actions and those that are common,
to all of them returns.
Parameters: nodes - array of nodes to compose actions for array of actions for the nodes or empty array if no actionswere found since: 3.29 |
findChild | public static Node findChild(Node node, String name)(Code) | | Look for a node child of given name.
Parameters: node - node to search in Parameters: name - name of child to look for the found child, or null if there is no such child |
findContextMenu | public static JPopupMenu findContextMenu(Node[] nodes)(Code) | | Compute common menu for specified nodes.
Provides only those actions supplied by all nodes in the list.
Parameters: nodes - the nodes the menu for all nodes |
findContextMenuImpl | static JPopupMenu findContextMenuImpl(Node[] nodes, ActionMap actionMap)(Code) | | Method for finding popup menu for one or more nodes.
Parameters: nodes - array of nodes Parameters: actionMap - maps keys to actions or null popup menu for this array |
findPath | public static Node findPath(Node start, Enumeration<String> names) throws NodeNotFoundException(Code) | | Traverse a path from a parent node down, by an enumeration of names.
Parameters: start - node to start searching at Parameters: names - enumeration of names of nodesalong the path the node with such a path from the start node exception: NodeNotFoundException - if the node with such namedoes not exists; the exception contains additional informationabout the failure. |
findPath | public static Node findPath(Node start, String[] names) throws NodeNotFoundException(Code) | | Traverse a path from a parent node down, by an enumeration of names.
Parameters: start - node to start searching at Parameters: names - names of nodesalong the path the node with such a path from the start node exception: NodeNotFoundException - if the node with such namedoes not exists; the exception contains additional informationabout the failure. |
findRoot | public static Node findRoot(Node node)(Code) | | Find the root for a given node.
Parameters: node - the node its root |
fromHandles | public static Node[] fromHandles(Node.Handle[] handles) throws IOException(Code) | | Takes array of handles and creates array of nodes.
Parameters: handles - array of handles array of nodes exception: IOException - if a node cannot be created from the handle |
getDefaultActions | public static SystemAction[] getDefaultActions()(Code) | | Get the default actions for all nodes.
array of default actions |
isSon | public static boolean isSon(Node parent, Node son)(Code) | | Test whether the second node is a (direct) child of the first one.
Parameters: parent - parent node Parameters: son - son node true if so |
toHandles | public static Node.Handle[] toHandles(Node[] nodes)(Code) | | Takes array of nodes and creates array of handles. The nodes that do not
have handles are not included in the resulting array.
Parameters: nodes - array of nodes array of Node.Handles |
warning | static void warning(Throwable ex)(Code) | | Notifies an exception to error manager or prints its it to stderr.
Parameters: ex - exception to notify |
weakNodeListener | public static NodeListener weakNodeListener(NodeListener l, Object source)(Code) | | Creates a weak implementation of NodeListener.
Parameters: l - the listener to delegate to Parameters: source - the source that the listener should detach from whenlistener l is freed, can be null a NodeListener delegating to l . since: 4.10 |
|
|