1 18 19 package org.apache.jmeter.gui.action; 20 21 import java.awt.event.ActionEvent ; 22 import java.util.HashSet ; 23 import java.util.Set ; 24 25 import org.apache.jmeter.gui.GuiPackage; 26 import org.apache.jmeter.gui.tree.JMeterTreeListener; 27 import org.apache.jmeter.gui.tree.JMeterTreeNode; 28 29 35 public class Paste extends AbstractAction 36 { 37 38 public final static String PASTE = "Paste"; 39 private static Set commands = new HashSet (); 40 static { 41 commands.add(PASTE); 42 } 43 44 47 public Set getActionNames() 48 { 49 return commands; 50 } 51 52 55 public void doAction(ActionEvent e) 56 { 57 JMeterTreeNode draggedNodes[] = Copy.getCopiedNodes(); 58 JMeterTreeListener treeListener = 59 GuiPackage.getInstance().getTreeListener(); 60 JMeterTreeNode currentNode = treeListener.getCurrentNode(); 61 if (DragNDrop.canAddTo(currentNode)) 62 { 63 for(int i=0;i<draggedNodes.length;i++) { 64 if (draggedNodes[i] != null) 65 { 66 GuiPackage.getInstance().getTreeModel().insertNodeInto( 67 draggedNodes[i], 68 currentNode, 69 currentNode.getChildCount()); 70 } 71 } 72 } 73 GuiPackage.getInstance().getMainFrame().repaint(); 74 } 75 } | Popular Tags |