Bug 331332 - [target] Target editor should update its content, if the target file was edited with another eclipse editor
Summary: [target] Target editor should update its content, if the target file was edit...
Status: VERIFIED FIXED
Alias: None
Product: PDE
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.0   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 3.7 M5   Edit
Assignee: Curtis Windatt CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2010-11-29 07:41 EST by Felix Riegger CLA
Modified: 2011-01-25 05:05 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch fixing resource change handling and more (15.49 KB, patch)
2011-01-04 10:48 EST, Felix Riegger CLA
curtis.windatt.public: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Felix Riegger CLA 2010-11-29 07:41:37 EST
Build Identifier: 20100917-0705

If the underlying target file was changed by another editor in eclipse (i.e. the text editor) while the target editor is opened, the target editor doesn't recognize the changes. As a consequence the 'Set as target platform' command in the target editor will apply the out-dated configuration shown in the target editor. Also doing further changes in the target editor will overwrite changes made in the text editor.
The editor has to be closed and opened again to get the changes.

The resourceChanged(IResourceChangeEvent event) method of the target editor's FileInputListener is probably the right place to handle this.


Reproducible: Always

Steps to Reproduce:
1. open a .target file in the target editor
2. open the same file in the text editor (while the target editor is still open)
3. make changed to the file in the text editor
4. target editor doesn't reflect the made changes
Comment 1 Curtis Windatt CLA 2010-11-29 10:48:03 EST
Thought this was a duplicate report, but I can't find an equivalent bug.  It would be better to listen for resource changes.  Marking as help wanted.
Comment 2 Felix Riegger CLA 2011-01-04 10:48:11 EST
Created attachment 186014 [details]
Proposed patch fixing resource change handling and more

This patch introduces the following fixes:
- Resource change handling implemented. There is no user interaction, similar to 
  the behavior of the manifest editor.
- Save As action works properly
  (currently broken)
- Failing save operations are reported to the user and editor stays dirty
  (currently only error log is written, editor becomes clean without saving)
- In case the target definition cannot be read, the editor doesn’t open, but 
  displays an error message to the user
  (currently the editor opens on an empty model assigned to some meta file  
  location and pretends everything is fine)

As target definitions cannot be read from “out of sync” files, the patch also fixes the issue described in bug 317842, not very elegant though.
Comment 3 Curtis Windatt CLA 2011-01-04 11:38:39 EST
Thanks for the work!  Hopefully we can review and commit it for M5.
Comment 4 Curtis Windatt CLA 2011-01-04 13:31:08 EST
I tried out the patch a bit and it is great.  Might put it in today.
Comment 5 Curtis Windatt CLA 2011-01-04 13:41:29 EST
Fixed up copyrights and some javadoc.  Committed to HEAD.  Thanks for the contribution.
Comment 6 Felix Riegger CLA 2011-01-05 04:45:10 EST
Wow, that was fast. Thank you.
Comment 7 Ankur Sharma CLA 2011-01-25 05:05:29 EST
Verified in I20110124-1800