use of org.apache.jmeter.gui.tree.JMeterTreeListener in project jmeter by apache.
the class Duplicate method doAction.
@Override
public void doAction(ActionEvent e) {
GuiPackage instance = GuiPackage.getInstance();
JMeterTreeListener treeListener = instance.getTreeListener();
JMeterTreeNode[] copiedNodes = Copy.cloneTreeNodes(treeListener.getSelectedNodes());
JMeterTreeNode currentNode = treeListener.getCurrentNode();
JMeterTreeNode parentNode = (JMeterTreeNode) currentNode.getParent();
JMeterTreeModel treeModel = instance.getTreeModel();
for (JMeterTreeNode copiedNode : copiedNodes) {
int index = parentNode.getIndex(currentNode) + 1;
treeModel.insertNodeInto(copiedNode, parentNode, index);
}
instance.getMainFrame().repaint();
}
use of org.apache.jmeter.gui.tree.JMeterTreeListener in project jmeter by apache.
the class Paste method doAction.
/**
* @see Command#doAction(ActionEvent)
*/
@Override
public void doAction(ActionEvent e) {
JMeterTreeNode[] draggedNodes = Copy.getCopiedNodes();
if (draggedNodes == null) {
Toolkit.getDefaultToolkit().beep();
return;
}
JMeterTreeListener treeListener = GuiPackage.getInstance().getTreeListener();
JMeterTreeNode currentNode = treeListener.getCurrentNode();
if (MenuFactory.canAddTo(currentNode, draggedNodes)) {
for (JMeterTreeNode draggedNode : draggedNodes) {
if (draggedNode != null) {
addNode(currentNode, draggedNode);
}
}
} else {
Toolkit.getDefaultToolkit().beep();
}
GuiPackage.getInstance().getMainFrame().repaint();
}
Aggregations