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 37 public class ShowAdminToolAction extends CookieAction { 38 39 protected Class [] cookieClasses() { 40 return new Class [] {}; 41 } 42 43 protected int mode() { 44 return MODE_EXACTLY_ONE; 45 } 47 48 protected void performAction(Node[] nodes) { 49 if( (nodes == null) || (nodes.length < 1) ) 50 return; 51 52 for (int i = 0; i < nodes.length; i++) { 53 Object node = nodes[i].getLookup().lookup(JBManagerNode.class); 54 if (node instanceof JBManagerNode) { 55 try { 56 URL url = new URL (((JBManagerNode) node).getAdminURL()); 57 URLDisplayer.getDefault().showURL(url); 58 } catch (MalformedURLException ex) { 59 ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, ex); 60 } 61 } 62 } 63 } 64 65 public String getName() { 66 return NbBundle.getMessage(ShowAdminToolAction.class, "LBL_ShowAdminGUIAction"); 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 |