aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarc-Andre Laperle2013-07-22 10:31:03 (EDT)
committerGerrit Code Review @ Eclipse.org2013-07-23 15:31:21 (EDT)
commit15e344c5935f2347ba8920330ced762e34461b95 (patch)
treefc65d6e9d30e2faa60c8a0ea94b972716add7f7d
parent38d75bb81e0b502c0c311f814ce9bafc5983e946 (diff)
downloadeclipse.platform.ui-15e344c5935f2347ba8920330ced762e34461b95.zip
eclipse.platform.ui-15e344c5935f2347ba8920330ced762e34461b95.tar.gz
eclipse.platform.ui-15e344c5935f2347ba8920330ced762e34461b95.tar.bz2
Bug 413278 - Quick switch editor only works for one editorrefs/changes/48/14748/2
Change-Id: I4b0c79133487ce40674d18639238836649ae5065 Signed-off-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java41
1 files changed, 26 insertions, 15 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
index c193d28..91abc84 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbookEditorsHandler.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2012 IBM Corporation and others.
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -7,6 +7,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
+ * Marc-Andre Laperle (Ericsson) - Bug 413278
******************************************************************************/
package org.eclipse.ui.internal;
@@ -20,6 +21,8 @@ import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
import org.eclipse.e4.ui.workbench.renderers.swt.StackRenderer;
import org.eclipse.swt.custom.CTabFolder;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPartReference;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.handlers.HandlerUtil;
@@ -37,24 +40,32 @@ public class WorkbookEditorsHandler extends AbstractHandler {
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
public Object execute(ExecutionEvent event) throws ExecutionException {
- IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
- WorkbenchPage page = (WorkbenchPage) workbenchWindow.getActivePage();
- if (page != null) {
- MUIElement area = page.findSharedArea();
- if (area instanceof MPlaceholder) {
- area = ((MPlaceholder) area).getRef();
- }
+ MUIElement uiElement = null;
- MPartStack activeStack = getActiveStack(area);
- if (activeStack != null) {
- if (activeStack.getRenderer() instanceof StackRenderer
- && activeStack.getWidget() instanceof CTabFolder) {
- StackRenderer stackRenderer = (StackRenderer) activeStack.getRenderer();
- stackRenderer.showAvailableItems(activeStack,
- (CTabFolder) activeStack.getWidget());
+ IEditorPart activeEditor = HandlerUtil.getActiveEditor(event);
+ if (activeEditor != null) {
+ IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);
+ WorkbenchPage page = (WorkbenchPage) workbenchWindow.getActivePage();
+ if (page != null) {
+ IWorkbenchPartReference reference = page.getReference(activeEditor);
+ if (reference != null) {
+ uiElement = page.getActiveElement(reference);
}
}
}
+
+ if (uiElement instanceof MPlaceholder) {
+ uiElement = ((MPlaceholder) uiElement).getRef();
+ }
+
+ MPartStack activeStack = getActiveStack(uiElement);
+ if (activeStack != null) {
+ if (activeStack.getRenderer() instanceof StackRenderer
+ && activeStack.getWidget() instanceof CTabFolder) {
+ StackRenderer stackRenderer = (StackRenderer) activeStack.getRenderer();
+ stackRenderer.showAvailableItems(activeStack, (CTabFolder) activeStack.getWidget());
+ }
+ }
return null;
}