summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRemy Suen2011-08-09 09:35:59 (EDT)
committer Paul Webster2011-08-25 10:21:59 (EDT)
commit095013a8e7b1e8cc8d9564bc257fd97962c6acb8 (patch)
tree51c1e63c00a782e7d796ea5519813a8602459c66
parent9f3d09331b4424712c16d1ec9d83d4971dbdd576 (diff)
downloadeclipse.platform.ui-095013a8e7b1e8cc8d9564bc257fd97962c6acb8.zip
eclipse.platform.ui-095013a8e7b1e8cc8d9564bc257fd97962c6acb8.tar.gz
eclipse.platform.ui-095013a8e7b1e8cc8d9564bc257fd97962c6acb8.tar.bz2
Bug 352905 [Compatibility] 'Quick Outline' disappears if opened after
opening an editor As the stack renderer uses asynchronous activation requests to activate stacks, the requests can potentially be invalidated when this enqueued request actually gets processed. In the case of this bug, a dialog window gets opened in the interim time between the activation request being enqueued and when it actually gets processed. This causes the dialog to lose focus as the request gets processed and causes the stack itself to be activated. The fix is to not activate the stack if it has determined that it is not currently a part of the activation chain.
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java33
1 files changed, 32 insertions, 1 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
index 8d57d9a..2614322 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/StackRenderer.java
@@ -106,18 +106,49 @@ public class StackRenderer extends LazyStackRenderer {
private ActivationJob activationJob = null;
+ @Inject
+ private MApplication application;
+
// private ToolBar menuTB;
// private boolean menuButtonShowing = false;
// private Control partTB;
private class ActivationJob implements Runnable {
+
+ /**
+ * Returns whether it is acceptable for a stack to be activated. As the
+ * activation occurs asynchronously, the original activation request may
+ * have been invalidated since the request was originally enqueued.
+ * <p>
+ * For example, an activation request that was enqueued no longer should
+ * be honoured if a dialog window gets opened in the interim.
+ * </p>
+ *
+ * @return <code>true</code> if the requested stack should be activated,
+ * <code>false</code> otherwise
+ */
+ private boolean shouldActivate() {
+ if (application != null) {
+ IEclipseContext applicationContext = application.getContext();
+ IEclipseContext activeChild = applicationContext
+ .getActiveChild();
+ if (activeChild == null
+ || activeChild.get(MWindow.class) != application
+ .getSelectedElement()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
public MElementContainer<MUIElement> stackToActivate = null;
public void run() {
activationJob = null;
if (stackToActivate != null
- && stackToActivate.getSelectedElement() != null) {
+ && stackToActivate.getSelectedElement() != null
+ && shouldActivate()) {
// Ensure we're activating a stack in the current perspective,
// when using a dialog to open a perspective
// we end up in the situation where this stack is in the