Bug 184183 - [Sync View] Reuse open compare editors tweak
Summary: [Sync View] Reuse open compare editors tweak
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Team (show other bugs)
Version: 3.3   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.3 RC1   Edit
Assignee: Tomasz Zarna CLA
QA Contact:
URL:
Whiteboard:
Keywords: contributed
Depends on:
Blocks:
 
Reported: 2007-04-26 05:25 EDT by Tomasz Zarna CLA
Modified: 2007-06-05 15:14 EDT (History)
0 users

See Also:
Michael.Valenta: review+


Attachments
Patch (1.66 KB, patch)
2007-05-07 09:59 EDT, Tomasz Zarna CLA
no flags Details | Diff
Patch v2 (2.04 KB, patch)
2007-05-08 03:36 EDT, 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 2007-04-26 05:25:56 EDT
Build ID: I20070424-0930

Steps To Reproduce:
1. Set "Team>Reuse open compare editors" preference on
2. Open Synchronize View with at least two outgoing changes
3. Select two files with outgoing changes and select "Open in Compare Editor" from context menu
4. Two compare editors will open for both files
5. Select the later file and select "Open in Compare Editor" from context menu
6. First editor will be used for comparision, which will result with 2 editors opened for the same outgoing change. I think that using the one with the file already opened would be a better solution.
Comment 1 Michael Valenta CLA 2007-04-26 09:49:29 EDT
This should be a fairly straight forward fix.
Comment 2 Tomasz Zarna CLA 2007-05-07 09:59:06 EDT
Created attachment 66103 [details]
Patch

I've divided the loop from the findReusableCompareEditor into 2 loops. First one is  looking for an editor with the same input. If none is found and "Reuse open compare editors" preference is on the method will return a non-dirty editor (if available).
Comment 3 Michael Valenta CLA 2007-05-07 11:15:31 EDT
The second loop is missing the condition used in the first loop. I think it needs it.
Comment 4 Tomasz Zarna CLA 2007-05-07 11:24:08 EDT
The second loop is run only when isReuseOpenEditor() is true. I've moved the condition you're talking about to the line before the second loop. This way it's checked only once which should have the same result as checking it for every element inside the loop.
Comment 5 Michael Valenta CLA 2007-05-07 11:34:03 EDT
I'm talking about this check:

if(part != null 
   && (part.getEditorInput() instanceof SyncInfoCompareInput 
       || part.getEditorInput() instanceof ModelCompareEditorInput) 
   && part instanceof IReusableEditor)

It appears in the first loop but not the second. Without it, the code will return the first non-dirty editor it finds.
Comment 6 Tomasz Zarna CLA 2007-05-08 03:36:53 EDT
Created attachment 66247 [details]
Patch v2

You're absolutely right Michael. Sorry, it's my fault. I hope this patch looks much better.
Comment 7 Michael Valenta CLA 2007-05-08 10:16:58 EDT
Patch reviewed and released.
Comment 8 Tomasz Zarna CLA 2007-05-18 10:08:06 EDT
Verified in I20070517-0010.