1 19 package org.netbeans.test.editor.app.gui.actions; 20 21 import org.netbeans.test.editor.app.core.cookies.LoggingCookie; 22 import org.netbeans.test.editor.app.gui.tree.TestNodeDelegate; 23 24 29 public class TestStopLoggingAction extends TreeNodeAction { 30 31 private static String STOPLOG="Stop logging"; 32 33 public TestStopLoggingAction() { 34 } 35 36 public String getName() { 37 return STOPLOG; 38 } 39 40 public boolean enable(TestNodeDelegate[] activatedNodes) { 41 if (activatedNodes.length == 1) { 42 LoggingCookie lc = (LoggingCookie) activatedNodes[0].getTestNode().getCookie(LoggingCookie.class); 43 if (lc != null) { 44 if (lc.isLogging()) { 45 return true; 46 } else { 47 return false; 48 } 49 } 50 } 51 return false; 52 } 53 54 public void performAction(TestNodeDelegate[] activatedNodes) { 55 for(int i=0;i < activatedNodes.length;i++) { 56 LoggingCookie lc = (LoggingCookie) activatedNodes[i].getTestNode().getCookie(LoggingCookie.class); 57 if (lc != null) { 58 if (lc.isLogging()) { 59 lc.stop(); 60 } 61 } 62 } 63 } 64 65 public String getHelpCtx() { 66 return "Stop Logging - write logged events to node."; 67 } 68 } 69 | Popular Tags |