Bug 275153 - Regressions introduced by SaveablesCompareEditorInput
Summary: Regressions introduced by SaveablesCompareEditorInput
Status: CLOSED WONTFIX
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Platform Team Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
Depends on: 273450 312893 318826 347557 347560 358909 358911
Blocks:
  Show dependency tree
 
Reported: 2009-05-06 09:56 EDT by Tomasz Zarna CLA
Modified: 2020-05-14 05:35 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2009-05-06 09:56:17 EDT
Implementation of a compare editor input that supports editing on both sides introduced in bug 193324 has unintentionally introduced several issues exposed by bug 262557 (see bug 262557 comment 7).

The issues are:
1. the worker that computes the AST is canceled by Compare and hence the exception
   ==> the StructureCreate has to be prepared that an OperationCanceledException 
       is thrown by anyone that check the monitor

2. createStructure is called twice for both sides on save:
   - once in UI thread via:
       org.eclipse.team.ui.mapping.SaveableComparison.doSave(IProgressMonitor)
   - once via org.eclipse.compare.internal.WorkerJob

3. in SaveableHelper.saveModels only left side is saved with Saveable.doSave logic
   ==> when SaveableHelper loop moves to the second saveable (right side) it
       turns out that the model is not dirty thus saving cane be is skipped[1].
       This situation is caused by the way saving the left side is done[2] ie
       flushing viewers results in saving the content of the right side as 
       well[3].

4. TextMergeViewer.flush is called twice for the right side contributor
   - firstly, when flushing content of TextMergeViewer[3] in order to save left
     side saveable (first iteration in SaveableHelper[1])
   - secondly, in reaction[4] to content changed event triggered by the first
     call. Each LocalResourceSaveableComparison listens for content 
     changes[5] and when such occurs save is performed, but in this particular
     case the change is made when saving the left side.

1 and 2 are taken from bug 262557 comment 7, for more info see also bug 262557 comment 9.

Among the things mentioned above, there is also bug 256805 addressing general polishing of SaveablesCompareEditorInput.

[1] SaveableHelper.saveModels
[2] LocalResourceSaveableComparison.performSave(IProgressMonitor)
[3] TextMergeViewer/ContentMergeViewer.flushContent(Object, IProgressMonitor)
[4] LocalResourceSaveableComparison.fireInputChange()
[5] LocalResourceSaveableComparison.initializeContentChangeListeners().new IContentChangeListener() {...}.contentChanged(IContentChangeNotifier)
Comment 1 Tomasz Zarna CLA 2009-05-08 09:50:11 EDT
5. SaveableComparison.doSave sets dirty indicator on CompareEditorInput to false, which is wrong as there still may be other Saveables from the same Compare Editor waiting to be saved.

LocalResourceSaveableComparison does the same thing in performSave, sets dirty flag on the editor input to false. 
Comment 2 Tomasz Zarna CLA 2009-05-08 09:53:53 EDT
5. is another reason for 3. to happen.
Comment 3 Tomasz Zarna CLA 2009-05-12 05:00:42 EDT
We will investigate these issues during 3.6, potentially breaking up this bug into smaller pieces and fixing them one by one. Hopefully we will manage to address all the regressions listed here and others revealed during the investigation or reported by the community. Some of the fixes may be even considered for bakckporting to 3.5.x stream.
Comment 4 Tomasz Zarna CLA 2010-05-12 07:49:55 EDT
SaveablesCompareEditorInput holds 2 Saveable objects, when they are both dirty and the editor is being saved SaveableHelper calls doSave for each of them. The problem is when saving the first saveable, all compare editor viewers are flushed saving both sides of the comparison. This looks like a direct consequence of how IFlushable is designed and a reason for 3. and 4. to happen (comment 0). The good news is that it's being addressed by bug 273450 (see bug 273450, comment 6, last bullet).
Comment 5 Tomasz Zarna CLA 2010-05-14 11:19:18 EDT
Bug 312893 is another issue which showed up while working on bug 273450.
Comment 6 Tomasz Zarna CLA 2010-05-18 07:38:48 EDT
Regressions number 3, 4 and 5 will be addressed at bug 273450. At least, the current shape of the patch there not only fixes the wrong labels in the Save dialog but also fixes the former issues. However, given the possible impact of releasing the patch at this stage I would hold off committing it. Thus I'm removing the target milestone on this bug to better match the reality. Hopefully we will find more time for it in 3.7 (the item has been added to Workspace 3.7 draft plan[1]).

The other two regressions described in comment 0 (1 and 2) are still valid and need to be investigated.

[1] http://wiki.eclipse.org/Workspace3.7
Comment 7 Szymon Brandys CLA 2011-05-31 07:48:24 EDT
Some issues described here were addressed by bug 273450. We will continue working on 1) and 2) from comment 0 during 3.8.
Comment 8 Tomasz Zarna CLA 2011-09-26 11:20:56 EDT
(In reply to comment #7)
> We will continue working on 1) and 2) from comment 0 during 3.8.

1) is bug 358911
2) is bug 358909

From now on this bug serves only as a container for regressions introduced by SaveablesCompareEditorInput. They are represented as blocking bugs. As soon as all of them are fixed, this bug can be closed.
Comment 9 Malgorzata Janczarska CLA 2011-09-28 07:12:49 EDT
Another regression: bug 347560
Comment 10 Malgorzata Janczarska CLA 2011-11-18 07:12:18 EST
All underlying regressions are targeted to M6 the latest so hopefully we'll be done with all by M6.
Comment 11 Malgorzata Janczarska CLA 2012-03-12 05:26:05 EDT
All remaining regressions have been postponed, moving master bug to m7.
Comment 12 Szymon Brandys CLA 2012-05-02 10:12:43 EDT
Moving to 4.3.
Comment 13 Eclipse Genie CLA 2020-05-14 03:36:43 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. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. 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.

--
The automated Eclipse Genie.
Comment 14 Mauro Molinari CLA 2020-05-14 05:35:16 EDT
Maybe this should be reopened?