1 19 package org.netbeans.modules.j2ee.websphere6.ui.nodes.actions; 20 21 import java.io.File ; 22 import org.netbeans.modules.j2ee.websphere6.WSDeploymentManager; 23 import org.netbeans.modules.j2ee.websphere6.ui.nodes.WSManagerNode; 24 import org.netbeans.modules.j2ee.websphere6.util.WSDebug; 25 import org.netbeans.modules.j2ee.websphere6.util.WSTailer; 26 import org.openide.nodes.Node; 27 import org.openide.util.HelpCtx; 28 import org.openide.util.NbBundle; 29 import org.openide.util.actions.CookieAction; 30 31 35 public class ShowServerLogAction extends CookieAction { 36 protected void performAction(Node[] nodes) { 37 if( (nodes == null) || (nodes.length < 1)) { 38 return; 39 } 40 41 for (int i = 0; i < nodes.length; i++) { 42 Object node = nodes[i].getLookup().lookup(WSManagerNode.class); 43 if (node instanceof WSManagerNode) { 44 try{ 45 File file = 46 new File (((WSManagerNode) node).getLogFilePath()); 47 48 WSDebug.notify(file.getAbsolutePath()); 49 50 51 WSDeploymentManager dm = ((WSManagerNode) node). 52 getDeploymentManager(); 53 54 new WSTailer(file, 55 NbBundle.getMessage( 56 ShowServerLogAction.class, 57 "LBL_LogWindowTitle", 58 dm.getServerTitleMessage())).start(); } catch (Exception e){ 60 return; } 62 } 63 } 64 } 65 66 public String getName() { 67 return NbBundle.getMessage(ShowAdminConsoleAction.class, "LBL_ShowServerLog"); 68 } 69 70 protected int mode() { 71 return MODE_EXACTLY_ONE; 72 } 73 74 public HelpCtx getHelpCtx() { 75 return null; 76 } 77 78 protected Class [] cookieClasses() { 79 return new Class []{}; 80 } 81 82 protected boolean enable(Node[] nodes) { 83 if (nodes == null || nodes.length < 1) { 84 return false; 85 } 86 87 boolean local = true; 88 89 for (int i = 0; i < nodes.length; i++) { 90 Object node = nodes[i].getLookup().lookup(WSManagerNode.class); 91 if (!(node instanceof WSManagerNode)) { 92 local = false; 93 break; 94 } 95 96 WSDeploymentManager dm = 97 ((WSManagerNode) node).getDeploymentManager(); 98 99 local = dm.getIsLocal().equals("true"); } 101 102 return local; 103 } 104 105 protected boolean asynchronous() { 106 return false; 107 } 108 } | Popular Tags |