1 18 19 package org.apache.jmeter.gui.action; 20 21 import java.awt.event.ActionEvent ; 22 import java.util.Iterator ; 23 import java.util.LinkedList ; 24 import java.util.Set ; 25 26 import org.apache.jmeter.control.ReplaceableController; 27 import org.apache.jmeter.gui.tree.JMeterTreeNode; 28 import org.apache.jmeter.testelement.TestElement; 29 import org.apache.jorphan.collections.HashTree; 30 import org.apache.jorphan.logging.LoggingManager; 31 import org.apache.log.Logger; 32 33 37 public abstract class AbstractAction implements Command 38 { 39 private static final Logger log = LoggingManager.getLoggerForClass(); 40 41 44 public void doAction(ActionEvent e) 45 { 46 } 47 48 51 abstract public Set getActionNames(); 52 53 protected void convertSubTree(HashTree tree) 54 { 55 Iterator iter = new LinkedList (tree.list()).iterator(); 56 while (iter.hasNext()) 57 { 58 JMeterTreeNode item = (JMeterTreeNode) iter.next(); 59 if (item.isEnabled()) 60 { 61 if (item.getUserObject() instanceof ReplaceableController) 62 { 63 ReplaceableController rc = 64 (ReplaceableController) item.getTestElement(); 65 HashTree subTree = tree.getTree(item); 66 67 if (subTree != null) 68 { 69 rc.replace(subTree); 70 convertSubTree(subTree); 71 tree.replace(item, rc.getReplacement()); 72 } 73 } 74 else 75 { 76 convertSubTree(tree.getTree(item)); 77 TestElement testElement = item.getTestElement(); 78 tree.replace(item, testElement); 79 } 80 } 81 else 82 { 83 tree.remove(item); 84 } 85 86 } 87 } 88 } 89 | Popular Tags |