1 19 20 package org.netbeans.modules.j2ee.jboss4.nodes.actions; 21 22 23 import java.net.MalformedURLException ; 24 import java.net.URL ; 25 import org.netbeans.modules.j2ee.jboss4.nodes.*; 26 import org.openide.ErrorManager; 27 import org.openide.nodes.Node; 28 import org.openide.util.HelpCtx; 29 import org.openide.util.NbBundle; 30 import org.openide.util.actions.CookieAction; 31 import org.openide.awt.HtmlBrowser.URLDisplayer; 32 33 36 public class ShowJMXConsoleAction extends CookieAction { 37 38 protected Class [] cookieClasses() { 39 return new Class [] {}; 40 } 41 42 protected int mode() { 43 return MODE_EXACTLY_ONE; 44 } 46 47 protected void performAction(Node[] nodes) { 48 if( (nodes == null) || (nodes.length < 1) ) 49 return; 50 51 for (int i = 0; i < nodes.length; i++) { 52 Object node = nodes[i].getLookup().lookup(JBManagerNode.class); 53 if (node instanceof JBManagerNode) { 54 try { 55 URL url = new URL (((JBManagerNode) node).getJMXConsoleURL()); 56 URLDisplayer.getDefault().showURL(url); 57 } catch (MalformedURLException ex) { 58 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 59 } 60 61 } 62 } 63 } 64 65 public String getName() { 66 return NbBundle.getMessage(ShowAdminToolAction.class, "LBL_ShowJMXConsoleAction"); 67 } 68 69 public HelpCtx getHelpCtx() { 70 return null; } 74 75 protected boolean enable(Node[] nodes) { 76 return true; 77 } 78 79 protected boolean asynchronous() { 80 return false; 81 } 82 } | Popular Tags |