Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 313742 - xml editor automatically refreshes files that change in the file system
Summary: xml editor automatically refreshes files that change in the file system
Status: RESOLVED FIXED
Alias: None
Product: WTP Source Editing
Classification: WebTools
Component: wst.xml (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 M6   Edit
Assignee: Rakesh CLA
QA Contact: Nitin Dahyabhai CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-20 10:56 EDT by Karen Butzke CLA
Modified: 2011-02-22 09:35 EST (History)
2 users (show)

See Also:
nsand.dev: review+


Attachments
Patch problem 1) (5.86 KB, patch)
2010-06-10 07:04 EDT, Rakesh CLA
no flags Details | Diff
Corrected patch problem 1 (10.71 KB, patch)
2010-06-10 10:01 EDT, Rakesh CLA
no flags Details | Diff
Patch problem 2 (1.31 KB, patch)
2010-06-11 02:10 EDT, Rakesh CLA
nsand.dev: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Karen Butzke CLA 2010-05-20 10:56:22 EDT
1.Create a generic project and create 2 xml files opening them in the XML Editor.
2.Make sure the preference General->Workspace->Refresh Automatically is false.
3.Go to the file system and edit the xml files and save them
4.Return to Eclipse and select the editor, you will see the file refresh automatically. You might have to switch to the other xml file to see the refresh.

If you have the file closed when you edit them outside of eclipse when you come back and open in the xml editor you see the 'file is out of sync with the file system' message editor open briefly before the file is automatically refreshed.

If you instead open the files in the regular text editor, you will see the platform behavior. An editor informing you the file is out of sync, or if the editor is already open a dialog pops up informing you of the same and asking if you want to refresh.

This is a regression from WTP 3.5.2.
Comment 1 Rakesh CLA 2010-06-08 11:08:31 EDT
This will happen whenever AbstractTextEditor is used as a nested editor. It contains a boolean 'fHasBeenActivated'.This variable  is used by handleEditorInputChanged() function to open MessageDialog, whenever input is outOfSync with file system.It is always false for nested TextEditor.
One solution would be to override handleEditorInputChanged() in SSE.
Comment 2 Rakesh CLA 2010-06-10 06:50:04 EDT
There are two parts of this problem
1) Open a xml file in xml editor(don't close it).Change file in file system ,no pop dialog comes up telling us that it is out of sync.It comes up in normal Text Editor.

2)(Copied from description)If you have the file closed when you edit them outside of eclipse when you come back and open in the xml editor you see the 'file is out of sync with the file system' message editor open briefly before the file is automatically refreshed.

These two problems are unrelated.
Comment 3 Rakesh CLA 2010-06-10 07:04:09 EDT
Created attachment 171623 [details]
Patch problem 1)

It is the patch for problem 1 mentioned in comment 2 .
Comment 4 Rakesh CLA 2010-06-10 08:41:35 EDT
(In reply to comment #3)
> Created an attachment (id=171623) [details]
> Patch problem 1)
> 
> It is the patch for problem 1 mentioned in comment 2 .

This patch is wrong .It fails for jsp and html editor.
Comment 5 Rakesh CLA 2010-06-10 10:01:22 EDT
Created attachment 171633 [details]
Corrected patch problem 1

I had to use activation listener in SSE.
Comment 6 Rakesh CLA 2010-06-11 02:10:46 EDT
Created attachment 171689 [details]
Patch problem 2

Whenever we open a non synchronized file , it gets automatically refreshed by DelegatingSourceValidatorForXML. I have turned it off for non-synchronized files,since user won't be able to see error,warnings markers in editor , unless he refreshes it.
Comment 7 Nitin Dahyabhai CLA 2010-07-26 08:59:29 EDT
Adding Valentin as a reviewer due to the changes to the DelegatingSourceValidatorForXML.
Comment 8 Nick Sandonato CLA 2011-02-22 09:21:32 EST
I can agree with the patch for the DelegatingSourceValidatorForXML, but not on the part activation listener. I opened Bug 337719 so that the abstract text editor will check if the active part can adapt to a text editor. Otherwise, it's a lot of redundant code in our editor.

Code's been checked in.