Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 343894

Summary: Save could not be completed after revert
Product: [Modeling] TMF Reporter: Benjamin Schwertfeger <benjamin.schwertfeger>
Component: XtextAssignee: Project Inbox <tmf.xtext-inbox>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: sven.efftinge
Version: 2.0.0Flags: sven.efftinge: indigo+
Target Milestone: RC1   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:
Attachments:
Description Flags
Patch XtextDocumentProvider.isSynchronized sven.efftinge: iplog+

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