ASF Bugzilla – Attachment 20753 Details for
Bug 43283
Save action should add extension .jmx if not present
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Suggested patch
patch_for_43283.patch (text/plain), 3.68 KB, created by
Alf Hogemark
on 2007-09-02 04:18:22 UTC
(
hide
)
Description:
Suggested patch
Filename:
MIME Type:
Creator:
Alf Hogemark
Created:
2007-09-02 04:18:22 UTC
Size:
3.68 KB
patch
obsolete
>Index: C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/gui/action/Save.java >=================================================================== >--- C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/gui/action/Save.java (revision 571739) >+++ C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/gui/action/Save.java (working copy) >@@ -19,6 +19,7 @@ > package org.apache.jmeter.gui.action; > > import java.awt.event.ActionEvent; >+import java.io.File; > import java.io.FileOutputStream; > import java.util.HashSet; > import java.util.Iterator; >@@ -26,6 +27,7 @@ > import java.util.Set; > > import javax.swing.JFileChooser; >+import javax.swing.JOptionPane; > > import org.apache.jmeter.exceptions.IllegalUserActionException; > import org.apache.jmeter.gui.GuiPackage; >@@ -34,6 +36,7 @@ > import org.apache.jmeter.save.OldSaveService; > import org.apache.jmeter.save.SaveService; > import org.apache.jmeter.testelement.TestElement; >+import org.apache.jmeter.util.JMeterUtils; > import org.apache.jorphan.collections.HashTree; > import org.apache.jorphan.logging.LoggingManager; > import org.apache.jorphan.util.JOrphanUtils; >@@ -48,6 +51,8 @@ > public class Save implements Command { > private static final Logger log = LoggingManager.getLoggerForClass(); > >+ public final static String JMX_FILE_EXTENSION = ".jmx"; // $NON-NLS-1$ >+ > private static Set commands = new HashSet(); > static { > commands.add(ActionNames.SAVE_AS); // Save (Selection) As >@@ -85,11 +90,30 @@ > if (!ActionNames.SAVE.equals(e.getActionCommand()) || updateFile == null) { > JFileChooser chooser = FileDialoger.promptToSaveFile(GuiPackage.getInstance().getTreeListener() > .getCurrentNode().getName() >- + ".jmx"); // $NON-NLS-1$ >+ + JMX_FILE_EXTENSION); > if (chooser == null) { > return; > } > updateFile = chooser.getSelectedFile().getAbsolutePath(); >+ // Make sure the file ends with proper extension >+ if(!updateFile.toLowerCase().endsWith(JMX_FILE_EXTENSION)) { >+ updateFile = updateFile + JMX_FILE_EXTENSION; >+ } >+ // Check if the user is trying to save to an existing file >+ if(!e.getActionCommand().equals(ActionNames.SAVE)) { >+ File f = new File(updateFile); >+ 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 >+ } >+ } >+ } >+ > if (!e.getActionCommand().equals(ActionNames.SAVE_AS)) { > GuiPackage.getInstance().setTestPlanFile(updateFile); > } >Index: C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/resources/messages.properties >=================================================================== >--- C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/resources/messages.properties (revision 571739) >+++ C:/Documents and Settings/alf/workspace/Jmeter 2.2 writable/src/core/org/apache/jmeter/resources/messages.properties (working copy) >@@ -623,6 +626,7 @@ > save_graphics=Save Graph > save_label=Save Label > save_latency=Save Latency >+save_overwrite_existing_file=The selected file already exists, do you want to overwrite it? > save_message=Save Response Message > save_requestheaders=Save Request Headers > save_responsedata=Save Response Data >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 43283
: 20753