jakarta-jmeter-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject svn commit: r582016 - in /jakarta/jmeter/trunk: src/core/org/apache/jmeter/gui/action/SaveGraphics.java xdocs/changes.xml
Date Thu, 04 Oct 2007 21:32:00 GMT
Author: sebb
Date: Thu Oct  4 14:31:59 2007
New Revision: 582016

URL: http://svn.apache.org/viewvc?rev=582016&view=rev
Log:
Save graphics function now prompts before overwriting an existing file

Modified:
    jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SaveGraphics.java
    jakarta/jmeter/trunk/xdocs/changes.xml

Modified: jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SaveGraphics.java
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SaveGraphics.java?rev=582016&r1=582015&r2=582016&view=diff
==============================================================================
--- jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SaveGraphics.java (original)
+++ jakarta/jmeter/trunk/src/core/org/apache/jmeter/gui/action/SaveGraphics.java Thu Oct 
4 14:31:59 2007
@@ -19,17 +19,20 @@
 package org.apache.jmeter.gui.action;
 
 import java.awt.event.ActionEvent;
+import java.io.File;
 import java.util.HashSet;
 import java.util.Set;
 
 import javax.swing.JComponent;
 import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
 
 import org.apache.jmeter.exceptions.IllegalUserActionException;
 import org.apache.jmeter.gui.JMeterGUIComponent;
 import org.apache.jmeter.gui.GuiPackage;
 import org.apache.jmeter.gui.util.FileDialoger;
 import org.apache.jmeter.save.SaveGraphicsService;
+import org.apache.jmeter.util.JMeterUtils;
 import org.apache.jmeter.visualizers.Printable;
 
 /**
@@ -99,6 +102,17 @@
         // the file extension.
         filename = chooser.getSelectedFile().getAbsolutePath();
         if (filename != null) {
+			File f = new File(filename);
+			if(f.exists()) {
+				int response = JOptionPane.showConfirmDialog(GuiPackage.getInstance().getMainFrame(),

+						JMeterUtils.getResString("save_overwrite_existing_file"), // $NON-NLS-1$
+						JMeterUtils.getResString("save?"),  // $NON-NLS-1$
+						JOptionPane.YES_NO_OPTION,
+						JOptionPane.QUESTION_MESSAGE);
+				if (response == JOptionPane.CLOSED_OPTION || response == JOptionPane.NO_OPTION) {
+					return ; // Do not save, user does not want to overwrite
+				}
+			}
             SaveGraphicsService save = new SaveGraphicsService();
             String ext = filename.substring(filename.length() - 4);
             String name = filename.substring(0, filename.length() - 4);

Modified: jakarta/jmeter/trunk/xdocs/changes.xml
URL: http://svn.apache.org/viewvc/jakarta/jmeter/trunk/xdocs/changes.xml?rev=582016&r1=582015&r2=582016&view=diff
==============================================================================
--- jakarta/jmeter/trunk/xdocs/changes.xml (original)
+++ jakarta/jmeter/trunk/xdocs/changes.xml Thu Oct  4 14:31:59 2007
@@ -53,6 +53,7 @@
 <h4>Non-functional Improvements</h4>
 <ul>
 <li>Functor code tightened up; Functor can now be used with interfaces, as well as
pre-defined targets and parameters.</li>
+<li>Save graphics function now prompts before overwriting an existing file</li>
 </ul>
 
 <!--  ===================  -->



---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-dev-help@jakarta.apache.org


Mime
View raw message