Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 354123 - DirtyResource state is not updated in DirtyStateEditorSupport when editor is marked 'clean'
Summary: DirtyResource state is not updated in DirtyStateEditorSupport when editor is ...
Status: CLOSED FIXED
Alias: None
Product: TMF
Classification: Modeling
Component: Xtext (show other bugs)
Version: 2.0.0   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: SR2   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-08 06:38 EDT by Vladimir Piskarev CLA
Modified: 2017-09-19 17:13 EDT (History)
1 user (show)

See Also:
sebastian.zarnekow: indigo+


Attachments
Sample language projects (65.44 KB, application/zip)
2011-08-08 06:40 EDT, Vladimir Piskarev CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Piskarev CLA 2011-08-08 06:38:59 EDT
Build Identifier: I20110613-1736

When an Xtext editor becomes 'clean' the state of DirtyStateEditorSupport's dirtyResource is not updated to reflect the current state of the underlying resource. This may lead to curious behavior in 'undo/redo' scenarios (described below).

Reproducible: Always

Steps to Reproduce:
1. Import the attached projects (abridged 'org.xtext.example.domainmodel') into
the workspace

2. Run the runtime workbench and make a Java project with files 'A.dmodel' and
'B.dmodel' with the following contents: 

A.dmodel: entity A {}
B.dmodel: entity B extends A {}

3. Open 'A.dmodel' and 'B.dmodel'. Select the editor for 'A.dmodel' and modify its contents to be 'entity C {}'. Notice the error tick on the 'B.dmodel' editor

4. Undo the change and notice the error tick on the 'B.dmodel' editor is gone away

5. Redo the change and notice that in this case there is no error tick on the 'B.dmodel' editor (i.e., it has not been validated)


This bug seems to be caused by the call sequence of #markEditorClean and #modelChanged in DirtyStateEditorSupport. Namely, when Undo is done, #markEditorClean is called first and sets 'isDirty' flag to false. Then #modelChanged is called (asynchronously) and since 'isDiry' is false, it does not try to copy the underlying resource state into 'dirtyResource'. Then, when Redo is done, #modelChange decides there is no 'stuctural' change and hence it does not announce 'dirty state change'.
Comment 1 Vladimir Piskarev CLA 2011-08-08 06:40:49 EDT
Created attachment 201070 [details]
Sample language projects
Comment 2 Sebastian Zarnekow CLA 2011-08-08 06:44:18 EDT
Please double check with Xtext 2.0.1. I think I fixed this one.
Comment 3 Sebastian Zarnekow CLA 2011-08-08 06:50:14 EDT
Never mind, I can reproduce this one.
Comment 4 Sebastian Zarnekow CLA 2011-08-11 11:44:41 EDT
Pushed to master.
Comment 5 Karsten Thoms CLA 2017-09-19 17:01:44 EDT
Closing all bugs that were set to RESOLVED before Neon.0
Comment 6 Karsten Thoms CLA 2017-09-19 17:13:03 EDT
Closing all bugs that were set to RESOLVED before Neon.0