Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343894 - Save could not be completed after revert
Summary: Save could not be completed after revert
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: PC Mac OS X - Carbon (unsup.)
: P3 normal (vote)
Target Milestone: RC1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 14:46 EDT by Benjamin Schwertfeger CLA
Modified: 2017-09-19 18:17 EDT (History)
1 user (show)

See Also:
sven.efftinge: indigo+


Attachments
Patch XtextDocumentProvider.isSynchronized (1.23 KB, patch)
2011-05-14 04:51 EDT, Benjamin Schwertfeger CLA
sven.efftinge: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benjamin Schwertfeger CLA 2011-04-26 14:46:32 EDT
If you have a dirty editor and revert the underlying file without closing or saving the editor, the save is not possible afterwards at all.


Steps to reproduce:
1) Check out a file for a Xtext-Editor (could be xtext directly)
2) Open the file in the Xtext-Editor
3) Change something and save
4) Save something again and make the editor dirty
5) Revert the file and deny saving it before (with egit you are only asked to replace the file)
6) Try saving it fails now.

Expected:
Other editors ask to replace the file if it changed on the filesystem. If you deny, the input from editor overwrite the reverted file.
Comment 1 Benjamin Schwertfeger CLA 2011-04-26 14:49:28 EDT
Debugging shows, that the AbstractTextEditor only asks to overwrite, if the file was changed outside eclipse. If you revert with eclipse, the workspace knows the new state and doesn't ask to overwrite (see handleExceptionOnSave isSynchronized).

A Java-Editor asks after activating the editor again, if the content should be reloaded. If not, the file overwrites with the next save.
Comment 2 Benjamin Schwertfeger CLA 2011-05-14 04:51:57 EDT
Created attachment 195639 [details]
Patch XtextDocumentProvider.isSynchronized

This patch adds an additional modification check, which works, if the file in the workspace is modified after the document read the Resource.
Comment 3 Sven Efftinge CLA 2011-05-16 06:04:38 EDT
pushed to master
Comment 4 Karsten Thoms CLA 2017-09-19 18:08:07 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 5 Karsten Thoms CLA 2017-09-19 18:17:38 EDT
Closing all bugs that were set to RESOLVED before Neon.0