Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2003-09-12 10:29:59 -0400
committerJean Michel-Lemieux2003-09-12 10:29:59 -0400
commit5f90f14b0a6d3a56c9ed76cb4f508dc769b989a8 (patch)
tree5e73c589123638b857ab088b844ed46f6c10ebf6
parent75977c98b8a5603f4ca18aaf139e7ce37822e915 (diff)
downloadeclipse.platform.team-5f90f14b0a6d3a56c9ed76cb4f508dc769b989a8.tar.gz
eclipse.platform.team-5f90f14b0a6d3a56c9ed76cb4f508dc769b989a8.tar.xz
eclipse.platform.team-5f90f14b0a6d3a56c9ed76cb4f508dc769b989a8.zip
Bug 42921Compare editor can be open but not active.
-rw-r--r--bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java20
1 files changed, 15 insertions, 5 deletions
diff --git a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java
index 791f12ce7..dada7f8a0 100644
--- a/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java
+++ b/bundles/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/sync/actions/OpenInCompareAction.java
@@ -60,12 +60,22 @@ public class OpenInCompareAction extends Action {
public static SyncInfoCompareInput openCompareEditor(SynchronizeView viewer, SyncInfo info, boolean keepFocus) {
SyncInfoCompareInput input = getCompareInput(info);
if(input != null) {
- if (!prefetchFileContents(viewer, info)) return null;
- IEditorPart editor = findReusableCompareEditor(viewer.getSite().getPage());
- if(editor != null && editor instanceof IReusableEditor) {
- CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
+ IWorkbenchPage page = viewer.getSite().getPage();
+ IEditorPart editor = findReusableCompareEditor(page);
+ IEditorInput otherInput = editor.getEditorInput();
+ if(otherInput instanceof SyncInfoCompareInput && otherInput.equals(input)) {
+ // simply provide focus to editor
+ page.activate(editor);
} else {
- CompareUI.openCompareEditor(input);
+ // if editor is currently not open on that input either re-use existing
+ // or open a new editor
+ if (!prefetchFileContents(viewer, info)) return null;
+ if(editor != null && editor instanceof IReusableEditor) {
+ page.activate(editor);
+ CompareUI.reuseCompareEditor(input, (IReusableEditor)editor);
+ } else {
+ CompareUI.openCompareEditor(input);
+ }
}
if(keepFocus) {

Back to the top