Bug 267454 - [EditorMgmt] Editor dirty state not synchronized after workbench restart
Summary: [EditorMgmt] Editor dirty state not synchronized after workbench restart
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.4.2   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 70363 (view as bug list)
Depends on:
Blocks:
 
Reported: 2009-03-06 17:22 EST by Biörn Biörnstad CLA
Modified: 2019-09-06 15:37 EDT (History)
5 users (show)

See Also:
daniel_megert: review+


Attachments
Proposed patch (2.03 KB, patch)
2009-03-08 18:50 EDT, Biörn Biörnstad CLA
bokowski: iplog+
Details | Diff
patch to revert the change (2.39 KB, patch)
2009-05-11 12:22 EDT, Boris Bokowski CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Biörn Biörnstad CLA 2009-03-06 17:22:53 EST
Build id: M20090211-1700

Steps to reproduce:
1. Open any text file (or any other file with a simple text editor, too keep it simple)
2. Choose 'Window > New Editor' to get a second editor for the resource
3. Change the contents of one editor and observe how both editors become dirty (asterisk in tab)
4a. Make sure that only one of the two editors is visible at a time (stacked, as by default)
4b. Restart the workbench (no need to save the changes made in the editors)
5. Change the contents of one editor (do not touch the other editor in order not to activate it)

Expected result:
Again, both editors should become dirty.

Actual result:
Only the editor where the change text file was changed becomes dirty, the other editor does not change its dirty state. This is inconsistent with the behavior before restarting and non-intuitive for the user.

As soon as the second editor is activated, its dirty state will be updated correctly. I assume the second editor was not able to update the dirty state in sync with the first editor simply because it had not been activated yet.
Comment 1 Boris Bokowski CLA 2009-03-06 18:53:45 EST
Yes. We do not materialize editors until they are shown, at which point we can tell that the two editors operate on the same file.
Comment 2 Biörn Biörnstad CLA 2009-03-08 18:50:39 EDT
Created attachment 127972 [details]
Proposed patch

Considering that an editor description in the workbench's memento provides enough information to restore the editor, shouldn't it be possible to find all editors which operate on the same input as the one being activated, without restoring all editors?

I was curious whether this could be solved without too much effort and gave it a try (attached). Whenever an editor is restored, all editors for the same ID and input are also restored as well. This seems to solve the problem -- but I am not an expert on Platform UI.
Comment 3 Boris Bokowski CLA 2009-03-08 21:41:09 EDT
Thanks for the patch, will have a look at it for M7. The idea sounds good.
Comment 4 Boris Bokowski CLA 2009-04-27 23:25:07 EDT
Released to HEAD. Thanks!
Comment 5 Dani Megert CLA 2009-04-28 06:19:58 EDT
Boris, this fix is a no-go, please revert it: it causes all editors with same input as the active one to be materialized on start up and each time another editor is activated, all similar ones are also activated.

The costs are to high just to have this little '*' in the tab later (assuming someone is even starting to type in that editor).

A correct fix would listen for changes to the dirty property and then update the tab without loading the editor.

Comment 6 Boris Bokowski CLA 2009-04-28 15:52:18 EDT
(In reply to comment #5)
> Boris, this fix is a no-go, please revert it: it causes all editors with same
> input as the active one to be materialized on start up and each time another
> editor is activated, all similar ones are also activated.

Not sure I agree. The editors would have to have the same input and id, and be in the same workbench window. Yes, there is an additional cost of materializing a second copy of the same code, but this is not a very common setup, and when it happens it's potentially confusing.
Comment 7 Dani Megert CLA 2009-04-29 01:58:54 EDT
>Yes, there is an additional cost of materializing
>a second copy of the same code,
Maybe more.

> but this is not a very common setup, and when
>it happens it's potentially confusing.
So far in 7 years no one reported it and if it is not common, why take that risk one week before RC-mode?

Are you sure that the getPart method you changed is not used in any other context/scenario which now also suffers this side effect?

What's the problem implementing the * based on the property change?


I still like to back out of this change (at least for 3.5).
Comment 8 Boris Bokowski CLA 2009-04-29 09:06:59 EDT
*** Bug 70363 has been marked as a duplicate of this bug. ***
Comment 9 Boris Bokowski CLA 2009-05-11 12:22:36 EDT
Created attachment 135166 [details]
patch to revert the change

(In reply to comment #7)
> >Yes, there is an additional cost of materializing
> >a second copy of the same code,
> Maybe more.

Yes - however many editors were open in the last session, with the same editor id and editor input.

> > but this is not a very common setup, and when
> >it happens it's potentially confusing.
> So far in 7 years no one reported it and if it is not common, why take that
> risk one week before RC-mode?

I did not see this as a particularly risky fix, but agree that there is a potential performance effect.

> Are you sure that the getPart method you changed is not used in any other
> context/scenario which now also suffers this side effect?

Whichever context/scenario we had that materializes the editor, yes, it would cause the same side-effect. We try very hard not to materialize editors until the user clicks on the tab, though.

> What's the problem implementing the * based on the property change?

I would expect this to be a more complicated and riskier change. But it's certainly doable.

> I still like to back out of this change (at least for 3.5).

Sure, we can back out of this. Dani, can I get your +1 for this patch?
Comment 10 Dani Megert CLA 2009-05-11 12:31:13 EDT
+1 for https://bugs.eclipse.org/bugs/attachment.cgi?id=135166 for RC1.
Comment 11 Boris Bokowski CLA 2009-05-11 12:52:04 EDT
attachment 135166 [details] released to HEAD. Moving to 3.6.
Comment 12 Boris Bokowski CLA 2009-11-17 13:02:00 EST
Remy is now responsible for watching the [EditorMgmt] component area.
Comment 13 Eclipse Webmaster CLA 2019-09-06 15:37:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.