1 19 package org.openide.nodes; 20 21 import org.openide.util.Lookup; 22 import org.openide.util.UserCancelException; 23 24 import java.awt.BorderLayout ; 25 import java.awt.Component ; 26 import java.awt.Container ; 27 import java.awt.event.ActionEvent ; 28 import java.awt.event.ActionListener ; 29 30 import javax.swing.*; 31 32 33 38 public abstract class NodeOperation { 39 40 protected NodeOperation() { 41 } 42 43 46 public static NodeOperation getDefault() { 47 NodeOperation no = Lookup.getDefault().lookup(NodeOperation.class); 48 49 if (no == null) { 50 throw new IllegalStateException ( 51 "To use NodeOperation you should have its implementation around. For example one from openide-explorer.jar" ); 53 } 54 55 return no; 56 } 57 58 69 public abstract boolean customize(Node n); 70 71 75 public abstract void explore(Node n); 76 77 80 public abstract void showProperties(Node n); 81 82 86 public abstract void showProperties(Node[] n); 87 88 103 public abstract Node[] select(String title, String rootTitle, Node root, NodeAcceptor acceptor, Component top) 104 throws UserCancelException; 105 106 116 public Node[] select(String title, String rootTitle, Node root, NodeAcceptor acceptor) 117 throws UserCancelException { 118 return select(title, rootTitle, root, acceptor, null); 120 } 121 122 131 public final Node select(String title, String rootTitle, Node root) 132 throws UserCancelException { 133 return select( 134 title, rootTitle, root, 135 new NodeAcceptor() { 136 public boolean acceptNodes(Node[] nodes) { 137 return nodes.length == 1; 138 } 139 } 140 )[0]; 141 } 142 } 143 | Popular Tags |