Bug 291213 - [Sync View] Linking from Sync view to compare editors doesn't work
Summary: [Sync View] Linking from Sync view to compare editors doesn't work
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.6 M6   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 291217 297055
  Show dependency tree
 
Reported: 2009-10-02 11:27 EDT by Tomasz Zarna CLA
Modified: 2010-02-23 10:28 EST (History)
1 user (show)

See Also:


Attachments
Fix v01 (3.49 KB, patch)
2010-02-16 06:24 EST, Tomasz Zarna CLA
no flags Details | Diff
mylyn/context/zip (165.57 KB, application/octet-stream)
2010-02-16 06:24 EST, Tomasz Zarna CLA
no flags Details
Fix v02 (3.83 KB, patch)
2010-02-18 06:14 EST, Tomasz Zarna CLA
no flags Details | Diff
Fix v03 (2.62 KB, patch)
2010-02-22 08:23 EST, Tomasz Zarna CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2009-10-02 11:27:07 EDT
Bug 219570 introduced an option to link Sync view with editors, but it doesn't work with compare editors.
Comment 1 Tomasz Zarna CLA 2009-10-15 10:42:04 EDT
Setting an IElementComparer which is aware of SyncInfoModelElements and is able to match them with IResources or IResourceVariants (which is basically what the fix for bug 291215 does) would fix this issue as well. However linking from Sync View to compare editors is a little bit harder since compare editors do not work with FileEditorInputs so the method org.eclipse.ui.internal.WorkbenchPage.findEditor(IEditorInput) will return null. Of course, compare editor can adapt to IEditorInput but this will work only if the editor active.

So my question to Dani is: are you OK with having an option to link (Link with Editor + Show In) from a compare editor to sync view but not the other way (from view to a compare editor)? If yes I would be happy to update the bug so it no longer blocks bug 219570 and change the summary to something like "Linking from sync view to compare editors doesn't work". What do you think?
Comment 2 Dani Megert CLA 2009-10-16 02:49:35 EDT
As a first step I'm happy with it but for final 3.6 it should work in both directions.

Personally I will not miss Sync > Compare Editor because I use single click ;-)
Comment 3 Tomasz Zarna CLA 2010-02-16 06:24:11 EST
Created attachment 159165 [details]
Fix v01

EditorMatchingStrategy for Compare Editors.
Comment 4 Tomasz Zarna CLA 2010-02-16 06:24:22 EST
Created attachment 159166 [details]
mylyn/context/zip
Comment 5 Tomasz Zarna CLA 2010-02-18 06:14:39 EST
Created attachment 159412 [details]
Fix v02

A much better fix. The previous one was giving to many false positives.
Comment 6 Tomasz Zarna CLA 2010-02-22 06:48:45 EST
Implementing IEditorMatchingStrategy is a very convenient way of fixing this bug, but it has a side effect: if a compare editor for a file is opened it will be brought to the top if a user opens the file from Package Explorer (for instance). This differs from current behavior where, in reaction to opening a file, the compare editor will be activated only if it's already on the top of editors stack (iirc this is true only for Java files, as our rationale was that the Java Compare started to be more like regular Java editor - bug 169386). Otherwise a regular editor for the file will be opened. 

This is a natural consequence of having a custom matching strategy associated with compare editor. However I'm not sue if such 'side effect' is acceptable. If no, I could try to get references to all editors opened and return 'false' when matching with a compare editor when a regular one is available. Dani, what do you think?
Comment 7 Dani Megert CLA 2010-02-22 07:19:36 EST
> However I'm not sue if such 'side effect' is acceptable.
>Dani, what do you think?
That would not be acceptable. In fact there are still voices that also don't like the current "open" behavior where we don't open/activate the Java editor if the compare editor is the active one.
Comment 8 Tomasz Zarna CLA 2010-02-22 08:23:53 EST
Created attachment 159772 [details]
Fix v03
Comment 9 Tomasz Zarna CLA 2010-02-22 08:35:11 EST
(In reply to comment #8)
> Created an attachment (id=159772)
> Fix v03
... has the same matching logic as in EditorMatchingStrategy from 'Fix v02', but this time it is used by Sync view only. Regular editors are preferred to compare editors.
Comment 10 Tomasz Zarna CLA 2010-02-23 10:28:55 EST
The latest fix applied to HEAD, available in builds >I20100223-0800.