1 16 17 package org.mc4j.console.connection; 18 19 import org.openide.ErrorManager; 20 import org.openide.nodes.Children; 21 22 30 public class ConnectionNodeChildren extends Children.Array { 31 32 private ConnectionNode connectionNode; 33 34 35 public void setConnectionNode(ConnectionNode node) { 36 this.connectionNode = node; 37 } 38 39 protected void addNotify() { 40 super.addNotify(); 41 42 Thread connector = new Thread (new Runnable () { 43 public void run() { 44 exposeDomains(); 45 } 46 }, "Mc4j Connection Thread"); 47 48 connector.start(); 49 } 50 51 protected void exposeDomains() { 52 if (this.connectionNode.isConnected()) { 53 this.connectionNode.refresh(); 54 } else { 55 try { 56 this.connectionNode.connect(); 57 } catch (Exception e) { 58 ErrorManager.getDefault().notify(e); 59 } 60 } 61 } 62 } 63 | Popular Tags |