Search in sources :

Example 1 with Clearable

use of org.apache.jmeter.samplers.Clearable in project jmeter by apache.

the class Clear method doAction.

@Override
public void doAction(ActionEvent e) {
    GuiPackage guiPackage = GuiPackage.getInstance();
    final String actionCommand = e.getActionCommand();
    if (actionCommand.equals(ActionNames.CLEAR)) {
        JMeterGUIComponent guiComp = guiPackage.getCurrentGui();
        if (guiComp instanceof Clearable) {
            ((Clearable) guiComp).clearData();
        }
    } else {
        guiPackage.getMainFrame().clearData();
        for (JMeterTreeNode node : guiPackage.getTreeModel().getNodesOfType(Clearable.class)) {
            JMeterGUIComponent guiComp = guiPackage.getGui(node.getTestElement());
            if (guiComp instanceof Clearable) {
                Clearable item = (Clearable) guiComp;
                try {
                    item.clearData();
                } catch (Exception ex) {
                    log.error("Can't clear: {} {}", node, guiComp, ex);
                }
            }
        }
    }
}
Also used : Clearable(org.apache.jmeter.samplers.Clearable) GuiPackage(org.apache.jmeter.gui.GuiPackage) JMeterTreeNode(org.apache.jmeter.gui.tree.JMeterTreeNode) JMeterGUIComponent(org.apache.jmeter.gui.JMeterGUIComponent)

Aggregations

GuiPackage (org.apache.jmeter.gui.GuiPackage)1 JMeterGUIComponent (org.apache.jmeter.gui.JMeterGUIComponent)1 JMeterTreeNode (org.apache.jmeter.gui.tree.JMeterTreeNode)1 Clearable (org.apache.jmeter.samplers.Clearable)1