use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.
the class EnableComponent method toggleComponents.
private void toggleComponents(JMeterTreeNode[] nodes) {
GuiPackage pack = GuiPackage.getInstance();
for (JMeterTreeNode node : nodes) {
boolean enable = !node.isEnabled();
node.setEnabled(enable);
pack.getGui(node.getTestElement()).setEnabled(enable);
}
}
use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.
the class EnableComponent method enableComponents.
private void enableComponents(JMeterTreeNode[] nodes, boolean enable) {
GuiPackage pack = GuiPackage.getInstance();
for (JMeterTreeNode node : nodes) {
node.setEnabled(enable);
pack.getGui(node.getTestElement()).setEnabled(enable);
}
}
use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.
the class JMeterUtils method reportErrorToUser.
/**
* Report an error through a dialog box in GUI mode
* or in logs and stdout in Non GUI mode
*
* @param errorMsg - the error message.
* @param titleMsg - title string
* @param exception Exception
*/
public static void reportErrorToUser(String errorMsg, String titleMsg, Exception exception) {
if (errorMsg == null) {
errorMsg = "Unknown error - see log file";
log.warn("Unknown error", new Throwable("errorMsg == null"));
}
GuiPackage instance = GuiPackage.getInstance();
if (instance == null) {
if (exception != null) {
log.error(errorMsg, exception);
} else {
log.error(errorMsg);
}
// NOSONAR intentional
System.out.println(errorMsg);
// Done
return;
}
try {
JOptionPane.showMessageDialog(instance.getMainFrame(), errorMsg, titleMsg, JOptionPane.ERROR_MESSAGE);
} catch (HeadlessException e) {
log.warn("reportErrorToUser(\"" + errorMsg + "\") caused", e);
}
}
use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.
the class AddParent method addParentToTree.
protected void addParentToTree(TestElement newParent) {
GuiPackage guiPackage = GuiPackage.getInstance();
JMeterTreeNode newNode = new JMeterTreeNode(newParent, guiPackage.getTreeModel());
JMeterTreeNode currentNode = guiPackage.getTreeListener().getCurrentNode();
JMeterTreeNode parentNode = (JMeterTreeNode) currentNode.getParent();
int index = parentNode.getIndex(currentNode);
guiPackage.getTreeModel().insertNodeInto(newNode, parentNode, index);
JMeterTreeNode[] nodes = guiPackage.getTreeListener().getSelectedNodes();
for (JMeterTreeNode node : nodes) {
moveNode(guiPackage, node, newNode);
}
}
use of org.apache.jmeter.gui.GuiPackage in project jmeter by apache.
the class AddThinkTimeBetweenEachStep method doAction.
@Override
public void doAction(ActionEvent e) {
GuiPackage guiPackage = GuiPackage.getInstance();
JMeterTreeNode currentNode = guiPackage.getTreeListener().getCurrentNode();
if (!(currentNode.getUserObject() instanceof Controller || currentNode.getUserObject() instanceof ThreadGroup)) {
Toolkit.getDefaultToolkit().beep();
return;
}
try {
addThinkTimeToChildren(guiPackage, currentNode);
} catch (Exception err) {
Toolkit.getDefaultToolkit().beep();
log.error("Failed to add think times", err);
JMeterUtils.reportErrorToUser("Failed to add think times", err);
}
}
Aggregations