1 19 20 package org.netbeans.modules.db.explorer.actions; 21 22 import org.openide.nodes.Node; 23 24 import org.netbeans.modules.db.explorer.infos.DatabaseNodeInfo; 25 26 public class EnableDebugAction extends DatabaseAction { 27 static final long serialVersionUID =-4578856899499264469L; 28 29 protected boolean enable(Node[] activatedNodes) { 30 Node node; 31 if (activatedNodes != null && activatedNodes.length > 0) 32 node = activatedNodes[0]; 33 else 34 return false; 35 36 DatabaseNodeInfo nfo = (DatabaseNodeInfo) node.getCookie(DatabaseNodeInfo.class); 37 if (nfo != null) 38 return !nfo.isDebugMode(); 39 else 40 return false; 41 } 42 43 public void performAction (Node[] activatedNodes) { 44 Node node; 45 if (activatedNodes != null && activatedNodes.length > 0) 46 node = activatedNodes[0]; 47 else 48 return; 49 50 DatabaseNodeInfo nfo = (DatabaseNodeInfo) node.getCookie(DatabaseNodeInfo.class); 51 nfo.setDebugMode(true); 52 } 53 } 54 | Popular Tags |