import java.lang.reflect.Field; import javax.swing.tree.TreePath; import org.netbeans.jellytools.ExplorerOperator; import org.netbeans.jellytools.nodes.Node; public class NodeTest { public static void main(java.lang.String[] args) { ExplorerOperator exp = new ExplorerOperator (); Field f; try { f = Node.class.getDeclaredField("treePath"); f.setAccessible(true); // FIRST searching for node // This contructor creates object that represents node in explorer-runtime tab // It does not return until it finds right node in explorer-runtime tab Node n1 = new Node (exp.runtimeTab ().tree (), "CORBA Interface Repository|IR|A"); // Waiting for a while try { Thread.sleep (1000); } catch (Exception e) {} // SECOND searching for node // This contructor creates object that represents node in explorer-runtime tab // It does not return until it finds right node in explorer-runtime tab Node n2 = new Node (exp.runtimeTab ().tree (), "CORBA Interface Repository|IR|A"); // Getting right names of found nodes (treepaths) TreePath tp1 = (TreePath) f.get (n1); TreePath tp2 = (TreePath) f.get (n2); String l1 = tp1.getLastPathComponent().toString (); String l2 = tp2.getLastPathComponent().toString (); // Printing right names System.out.println ("FIRST NODE: " + l1); System.out.println ("SECOND NODE: " + l2); // Comparing right names System.out.println ("COMPARING FOUND NODES:"); if (l1.endsWith("...") || l2.endsWith ("...") || !l1.equals (l2)) System.out.println("ERROR: Invalid nodes"); else System.out.println("OK: No problem"); } catch (Exception e) { e.printStackTrace(); } } }