1 16 17 package org.mc4j.console.cluster; 18 19 import org.mc4j.console.connection.wizard.ConnectionDescriptor; 20 import org.mc4j.ems.connection.settings.ConnectionSettings; 21 import org.openide.DialogDisplayer; 22 import org.openide.ErrorManager; 23 import org.openide.WizardDescriptor; 24 import org.openide.nodes.Node; 25 import org.openide.util.HelpCtx; 26 import org.openide.util.actions.NodeAction; 27 28 import javax.swing.*; 29 import java.awt.*; 30 31 39 public class ClusterAddConnectionAction extends NodeAction { 40 41 protected void performAction(Node[] nodes) { 42 Node node = nodes[0]; 44 45 46 final ConnectionDescriptor desc = new ConnectionDescriptor(); 47 48 49 final Dialog dlg = DialogDisplayer.getDefault().createDialog(desc); 50 try { 52 SwingUtilities.invokeAndWait(new Runnable () { 53 public void run() { 54 dlg.show(); 55 } 56 }); 57 } catch (Exception e) { ErrorManager.getDefault().notify(e); 59 return; 60 } 61 if (desc.getValue() == WizardDescriptor.FINISH_OPTION) { 62 63 ConnectionSettings settings = desc.getSettings(); 65 66 69 80 } 81 } 82 83 protected boolean enable(Node[] nodes) { 84 return true; } 87 88 public String getName() { 89 return java.util.ResourceBundle.getBundle("org/mc4j/console/Bundle").getString("LBL_ConnectAction"); 90 } 91 92 protected String iconResource() { 93 return "org/mc4j/console/connection/ConnectActionIcon.gif"; 94 } 95 96 public HelpCtx getHelpCtx() { 97 return HelpCtx.DEFAULT_HELP; 98 } 101 102 } 103 | Popular Tags |