sebb 2003/10/05 08:07:05
Modified: src/core/org/apache/jmeter/gui/action Start.java
src/core/org/apache/jmeter/gui/util JMeterMenuBar.java
Log:
Added controlled Shutdown menu item
Revision Changes Path
1.11 +14 -5 jakarta-jmeter/src/core/org/apache/jmeter/gui/action/Start.java
Index: Start.java
===================================================================
RCS file: /home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/action/Start.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- Start.java 15 Sep 2003 23:13:16 -0000 1.10
+++ Start.java 5 Oct 2003 15:07:05 -0000 1.11
@@ -65,6 +65,7 @@
import org.apache.jmeter.engine.TreeCloner;
import org.apache.jmeter.engine.util.DisabledComponentRemover;
import org.apache.jmeter.gui.GuiPackage;
+import org.apache.jmeter.gui.util.JMeterMenuBar;
import org.apache.jmeter.testelement.TestPlan;
import org.apache.jmeter.util.JMeterUtils;
import org.apache.jorphan.collections.HashTree;
@@ -79,11 +80,13 @@
public class Start extends AbstractAction
{
private static Logger log = LoggingManager.getLoggerForClass();
+
private static Set commands = new HashSet();
static {
- commands.add("start");
- commands.add("stop");
+ commands.add(JMeterMenuBar.ACTION_START);
+ commands.add(JMeterMenuBar.ACTION_STOP);
+ commands.add(JMeterMenuBar.ACTION_SHUTDOWN);
}
private StandardJMeterEngine engine;
@@ -107,15 +110,21 @@
public void doAction(ActionEvent e)
{
- if (e.getActionCommand().equals("start"))
+ if (e.getActionCommand().equals(JMeterMenuBar.ACTION_START))
{
startEngine();
}
- else if (e.getActionCommand().equals("stop"))
+ else if (e.getActionCommand().equals(JMeterMenuBar.ACTION_STOP))
{
GuiPackage.getInstance().getMainFrame().showStoppingMessage("");
engine.stopTest();
engine = null;
+ }
+ else if (e.getActionCommand().equals(JMeterMenuBar.ACTION_SHUTDOWN))
+ {
+ GuiPackage.getInstance().getMainFrame().showStoppingMessage("");
+ engine.askThreadsToStop();
+ engine = null;
}
}
1.16 +23 -3
jakarta-jmeter/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java
Index: JMeterMenuBar.java
===================================================================
RCS file:
/home/cvs/jakarta-jmeter/src/core/org/apache/jmeter/gui/util/JMeterMenuBar.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- JMeterMenuBar.java 7 Sep 2003 18:54:54 -0000 1.15
+++ JMeterMenuBar.java 5 Oct 2003 15:07:05 -0000 1.16
@@ -99,6 +99,7 @@
JMenuItem remote_start_all;
Collection remote_engine_start;
JMenuItem run_stop;
+ private JMenuItem run_shut; // all the others could be private too?
JMenu remote_stop;
JMenuItem remote_stop_all;
Collection remote_engine_stop;
@@ -338,6 +339,15 @@
return languageMenu;
}
+ /*
+ * Strings used to set up and process actions in this menu
+ * The strings need to agree with the those in the Action routines
+ */
+ public static final String ACTION_SHUTDOWN = "shutdown";
+ public static final String ACTION_STOP = "stop";
+ public static final String ACTION_START = "start";
+
+
private void makeRunMenu()
{
// RUN MENU
@@ -347,13 +357,21 @@
run_start.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_R, KeyEvent.CTRL_MASK));
run_start.addActionListener(ActionRouter.getInstance());
- run_start.setActionCommand("start");
+ run_start.setActionCommand(ACTION_START);
run_stop = new JMenuItem(JMeterUtils.getResString("stop"), 'T');
run_stop.setAccelerator(
KeyStroke.getKeyStroke(KeyEvent.VK_PERIOD, KeyEvent.CTRL_MASK));
run_stop.setEnabled(false);
run_stop.addActionListener(ActionRouter.getInstance());
- run_stop.setActionCommand("stop");
+ run_stop.setActionCommand(ACTION_STOP);
+
+ run_shut = new JMenuItem(JMeterUtils.getResString("shutdown"), 'Y');
+ run_shut.setAccelerator(
+ KeyStroke.getKeyStroke(KeyEvent.VK_COMMA, KeyEvent.CTRL_MASK));
+ run_shut.setEnabled(false);
+ run_shut.addActionListener(ActionRouter.getInstance());
+ run_shut.setActionCommand(ACTION_SHUTDOWN);
+
run_clear = new JMenuItem(JMeterUtils.getResString("clear"), 'C');
run_clear.addActionListener(ActionRouter.getInstance());
run_clear.setActionCommand(org.apache.jmeter.gui.action.Clear.CLEAR);
@@ -378,6 +396,7 @@
remote_start_all.setActionCommand("remote_start_all");
runMenu.add(remote_start_all);
runMenu.add(run_stop);
+ runMenu.add(run_shut);
if (remote_stop != null)
{
runMenu.add(remote_stop);
@@ -473,6 +492,7 @@
{
run_start.setEnabled(!enable);
run_stop.setEnabled(enable);
+ run_shut.setEnabled(enable);
}
private void getRemoteItems()
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]