1 16 17 package org.mc4j.console.connection.create; 18 19 import org.mc4j.console.connection.ConnectionNode; 20 import org.openide.DialogDisplayer; 21 import org.openide.ErrorManager; 22 import org.openide.nodes.Node; 23 import org.openide.util.HelpCtx; 24 import org.openide.util.actions.NodeAction; 25 26 import javax.swing.*; 27 import java.awt.*; 28 29 37 public class CreateMBeanAction extends NodeAction { 38 39 40 public void performAction(Node[] nodes) { 41 ConnectionNode node = (ConnectionNode) nodes[0]; 43 44 final CreateWizardDescriptor desc = new CreateWizardDescriptor(node.getEmsConnection()); 45 46 47 final Dialog dlg = DialogDisplayer.getDefault().createDialog(desc); 48 49 try { 51 SwingUtilities.invokeAndWait(new Runnable () { 52 public void run() { 53 dlg.show(); 54 } 55 }); 56 } catch (Exception e) { ErrorManager.getDefault().notify(e); 58 return; 59 } 60 61 } 62 63 protected boolean enable(Node[] nodes) { 64 65 return nodes.length == 1 && nodes[0] instanceof ConnectionNode; 66 } 67 68 public String getName() { 69 return "Create MBean"; 70 71 } 72 73 protected String iconResource() { 74 return "org/mc4j/console/connection/ConnectActionIcon.gif"; 75 } 76 77 public HelpCtx getHelpCtx() { 78 return HelpCtx.DEFAULT_HELP; 79 } 82 83 } 84 | Popular Tags |