Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 355681 - Add the ability to File->Save As a currently open file
Summary: Add the ability to File->Save As a currently open file
Status: RESOLVED FIXED
Alias: None
Product: BPMN2Modeler
Classification: SOA
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 0.0.1-M2   Edit
Assignee: Robert Brodt CLA
QA Contact:
URL: https://issues.jboss.org/browse/JBPM-...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-24 06:43 EDT by Robert Brodt CLA
Modified: 2012-10-09 11:50 EDT (History)
1 user (show)

See Also:
bbrodt: iplog+


Attachments
BPMN2 Modeler Save As bug fix proposal (9.91 KB, application/x-zip-compressed)
2012-08-01 05:30 EDT, Deepak G CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Robert Brodt CLA 2011-08-24 06:43:16 EDT
Though we're waiting to see what the Graphiti team does for a recent bug found with "rename" not working properly, it would be good to allow users to save a copy of the currently open file as another filename. For example, if the user makes some changes they don't want to pollute the main file with, perhaps they do a "Save As" and add "_rev1" to the filename to differentiate it from the original.

Currently the File->Save As menu is disabled in the BPMN2 Designer editor.
Comment 1 Deepak G CLA 2012-08-01 05:30:04 EDT
Created attachment 219415 [details]
BPMN2 Modeler Save As bug fix proposal
Comment 2 Deepak G CLA 2012-08-01 05:31:24 EDT
Hi,
I have attached a solution proposal for this fix.
Approach is, 
1) When user makes changes to a bpmn file (e.g. process_1.bpmn) and selects save as
2) Get hold of new file (e.g. process_1_rev1.bpmn) from the dialog
3) Create a temporary (e.g. temp.bpmn) file which holds the original/old file contents
4) Save the current bpmn (process_1.bpmn) file
5) Move(IResource.move()) the current file (process_1.bpmn) to new file name(process_1_rev1.bpmn)
6) Move the temp (temp.bpmn)file to old file name (process_1.bpmn)
7) Open the new file editor (process_1_rev1.bpmn) and close the old file (process_1.bpmn) editor

I have tested with an existing bpmn file. 
Open the existing bpmn file editor and try to save as.. and it works.

Please have a look at the attached proposal.
Let me your feedback on this.

Thanks
Deepak
Comment 3 Robert Brodt CLA 2012-08-02 16:51:38 EDT
Thanks for the patch Deepak! I've applied this to the editor code and tested with both helios and indigo builds - looks good!

The only thing I had to change was to replace the IFile.move() with an IFile.copy() because it was interfering with the editor's resource listener. I didn't understand the use of a temp.bpmn file (not a good idea, as this file may already exist!) so I simply removed that part of the code.

If you have time, please test the new changes to make sure I didn't miss anything. We will publish a new build tomorrow which contains this fix.

Thanks!