Re: svn commit: r1233093 - in /jmeter/trunk/src/core/org/apache/jmeter: gui/action/Remove.java resources/messages.properties resources/messages_fr.properties
Hello, I can add a property (in jmeter.properties) to revert to default behavior (remove without confirmation) but I don't think it is necessary. Milamber Le 18/01/2012 22:18, milam...@apache.org a ecrit : > Author: milamber > Date: Wed Jan 18 22:18:57 2012 > New Revision: 1233093 > > URL: http://svn.apache.org/viewvc?rev=1233093&view=rev > Log: > Add a dialog box to confirm removing the element(s) when Remove action is > called > > Modified: > jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java > jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties > jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties > > Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java?rev=1233093&r1=1233092&r2=1233093&view=diff > == > --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java (original) > +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java Wed Jan 18 > 22:18:57 2012 > @@ -28,6 +28,7 @@ import javax.swing.tree.TreePath; > import org.apache.jmeter.gui.GuiPackage; > import org.apache.jmeter.gui.tree.JMeterTreeNode; > import org.apache.jmeter.testelement.TestElement; > +import org.apache.jmeter.util.JMeterUtils; > > /** > * Implements the Remove menu item. > @@ -56,17 +57,24 @@ public class Remove implements Command { > } > > public void doAction(ActionEvent e) { > -// TODO - removes the nodes from the CheckDirty map - should it be > done later, in case some can't be removed? > -ActionRouter.getInstance().actionPerformed(new > ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_REMOVE)); > -GuiPackage guiPackage = GuiPackage.getInstance(); > -JMeterTreeNode[] nodes = > guiPackage.getTreeListener().getSelectedNodes(); > -TreePath newTreePath = // Save parent node for later > -guiPackage.getTreeListener().removedSelectedNode(); > -for (int i = nodes.length - 1; i >= 0; i--) { > -removeNode(nodes[i]); > +int isConfirm = JOptionPane.showConfirmDialog(null, > +JMeterUtils.getResString("remove_confirm_msg"),// $NON-NLS-1$ > +JMeterUtils.getResString("remove_confirm_title"), // > $NON-NLS-1$ > +JOptionPane.WARNING_MESSAGE, > +JOptionPane.YES_NO_OPTION); > +if (isConfirm == JOptionPane.YES_OPTION) { > +// TODO - removes the nodes from the CheckDirty map - should it > be done later, in case some can't be removed? > +ActionRouter.getInstance().actionPerformed(new > ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_REMOVE)); > +GuiPackage guiPackage = GuiPackage.getInstance(); > +JMeterTreeNode[] nodes = > guiPackage.getTreeListener().getSelectedNodes(); > +TreePath newTreePath = // Save parent node for later > +guiPackage.getTreeListener().removedSelectedNode(); > +for (int i = nodes.length - 1; i >= 0; i--) { > +removeNode(nodes[i]); > +} > + > guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath); > +guiPackage.updateCurrentGui(); > } > - > guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath); > -guiPackage.updateCurrentGui(); > } > > private static void removeNode(JMeterTreeNode node) { > > Modified: > jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1233093&r1=1233092&r2=1233093&view=diff > == > --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties > (original) > +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties Wed > Jan 18 22:18:57 2012 > @@ -695,6 +695,8 @@ remote_start_all=Remote Start All > remote_stop=Remote Stop > remote_stop_all=Remote Stop All > remove=Remove > +remove_confirm_title=Confirm remove? > +remove_confirm_msg=Are you sure you want remove this element(s)? > rename=Rename entry > report=Report > report_bar_chart=Bar Chart > > Modified: > jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties > URL: > http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1233093&r1=1233092&r2=1233093&view=diff > == > --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties > (original) > +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties > Wed Jan 18 22:18:57 2012 > @@ -689,6 +689,8 @@ remote_start_all=D\u00E9
Re: svn commit: r1233093 - in /jmeter/trunk/src/core/org/apache/jmeter: gui/action/Remove.java resources/messages.properties resources/messages_fr.properties
On 18 January 2012 22:24, Milamber wrote: > Hello, > > I can add a property (in jmeter.properties) to revert to default > behavior (remove without confirmation) but I don't think it is necessary. I found the new behaviour annoying, so I added a property to skip the dialogue. By default JMeter will still prompt. > Milamber > > Le 18/01/2012 22:18, milam...@apache.org a ecrit : >> Author: milamber >> Date: Wed Jan 18 22:18:57 2012 >> New Revision: 1233093 >> >> URL: http://svn.apache.org/viewvc?rev=1233093&view=rev >> Log: >> Add a dialog box to confirm removing the element(s) when Remove action is >> called >> >> Modified: >> jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java >> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >> >> Modified: jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java?rev=1233093&r1=1233092&r2=1233093&view=diff >> == >> --- jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java (original) >> +++ jmeter/trunk/src/core/org/apache/jmeter/gui/action/Remove.java Wed Jan >> 18 22:18:57 2012 >> @@ -28,6 +28,7 @@ import javax.swing.tree.TreePath; >> import org.apache.jmeter.gui.GuiPackage; >> import org.apache.jmeter.gui.tree.JMeterTreeNode; >> import org.apache.jmeter.testelement.TestElement; >> +import org.apache.jmeter.util.JMeterUtils; >> >> /** >> * Implements the Remove menu item. >> @@ -56,17 +57,24 @@ public class Remove implements Command { >> } >> >> public void doAction(ActionEvent e) { >> - // TODO - removes the nodes from the CheckDirty map - should it be >> done later, in case some can't be removed? >> - ActionRouter.getInstance().actionPerformed(new >> ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_REMOVE)); >> - GuiPackage guiPackage = GuiPackage.getInstance(); >> - JMeterTreeNode[] nodes = >> guiPackage.getTreeListener().getSelectedNodes(); >> - TreePath newTreePath = // Save parent node for later >> - guiPackage.getTreeListener().removedSelectedNode(); >> - for (int i = nodes.length - 1; i >= 0; i--) { >> - removeNode(nodes[i]); >> + int isConfirm = JOptionPane.showConfirmDialog(null, >> + JMeterUtils.getResString("remove_confirm_msg"),// >> $NON-NLS-1$ >> + JMeterUtils.getResString("remove_confirm_title"), // >> $NON-NLS-1$ >> + JOptionPane.WARNING_MESSAGE, >> + JOptionPane.YES_NO_OPTION); >> + if (isConfirm == JOptionPane.YES_OPTION) { >> + // TODO - removes the nodes from the CheckDirty map - should it >> be done later, in case some can't be removed? >> + ActionRouter.getInstance().actionPerformed(new >> ActionEvent(e.getSource(), e.getID(), ActionNames.CHECK_REMOVE)); >> + GuiPackage guiPackage = GuiPackage.getInstance(); >> + JMeterTreeNode[] nodes = >> guiPackage.getTreeListener().getSelectedNodes(); >> + TreePath newTreePath = // Save parent node for later >> + guiPackage.getTreeListener().removedSelectedNode(); >> + for (int i = nodes.length - 1; i >= 0; i--) { >> + removeNode(nodes[i]); >> + } >> + >> guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath); >> + guiPackage.updateCurrentGui(); >> } >> - >> guiPackage.getTreeListener().getJTree().setSelectionPath(newTreePath); >> - guiPackage.updateCurrentGui(); >> } >> >> private static void removeNode(JMeterTreeNode node) { >> >> Modified: >> jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties?rev=1233093&r1=1233092&r2=1233093&view=diff >> == >> --- jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >> (original) >> +++ jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties >> Wed Jan 18 22:18:57 2012 >> @@ -695,6 +695,8 @@ remote_start_all=Remote Start All >> remote_stop=Remote Stop >> remote_stop_all=Remote Stop All >> remove=Remove >> +remove_confirm_title=Confirm remove? >> +remove_confirm_msg=Are you sure you want remove this element(s)? >> rename=Rename entry >> report=Report >> report_bar_chart=Bar Chart >> >> Modified: >> jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties >> URL: >> http://svn.apache.org/viewvc/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties?rev=1233093&r1=1233092&r2=1233093&view=diff >> =