Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnton Leherbauer2015-09-30 12:20:23 +0000
committerAnton Leherbauer2015-09-30 12:20:23 +0000
commitf4c23662572adaf59d34cc2c26d5d34a3239a3f0 (patch)
tree7946ea55744661543f3622fdd0ee88d1fe3d061f
parent2ff2e7a814522289fa9cac7558a18cda68ce830f (diff)
downloadeclipse.platform.debug-f4c23662572adaf59d34cc2c26d5d34a3239a3f0.tar.gz
eclipse.platform.debug-f4c23662572adaf59d34cc2c26d5d34a3239a3f0.tar.xz
eclipse.platform.debug-f4c23662572adaf59d34cc2c26d5d34a3239a3f0.zip
Change-Id: I996b7f5cb3ce1099b222d1a92baa741c30d75a91 Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java18
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java18
2 files changed, 29 insertions, 7 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
index f3d20350f..ec5b353bf 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugContextSourceProvider.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2013 Wind River Systems and others.
+ * Copyright (c) 2006, 2015 Wind River Systems 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
@@ -14,11 +14,13 @@ package org.eclipse.debug.internal.ui.contexts;
import java.util.HashMap;
import java.util.Map;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.contexts.DebugContextEvent;
import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.AbstractSourceProvider;
import org.eclipse.ui.ISources;
import org.eclipse.ui.services.IEvaluationService;
@@ -53,9 +55,19 @@ public class DebugContextSourceProvider extends AbstractSourceProvider implement
@Override
public void debugContextChanged(DebugContextEvent event) {
- Map<String, ISelection> values = new HashMap<String, ISelection>(1);
+ final Map<String, ISelection> values = new HashMap<String, ISelection>(1);
values.put(IDebugUIConstants.DEBUG_CONTEXT_SOURCE_NAME, event.getContext());
- fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values);
+ // make sure fireSourceChanged is called on the UI thread
+ if (Display.getCurrent() == null) {
+ DebugUIPlugin.getStandardDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values);
+ }
+ });
+ } else {
+ fireSourceChanged(ISources.ACTIVE_CURRENT_SELECTION, values);
+ }
}
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
index d0979911d..0c15eda06 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/contexts/DebugWindowContextService.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2013 IBM Corporation and others.
+ * Copyright (c) 2005, 2015 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
@@ -55,15 +55,25 @@ public class DebugWindowContextService implements IDebugContextService, IPartLis
private DebugContextSourceProvider fSourceProvider;
- public DebugWindowContextService(IWorkbenchWindow window, IEvaluationService evaluationService) {
+ public DebugWindowContextService(IWorkbenchWindow window, final IEvaluationService evaluationService) {
fWindow = window;
fWindow.getPartService().addPartListener(this);
- fSourceProvider = new DebugContextSourceProvider(this, evaluationService);
+ // need to register source provider on the UI thread (bug 438396)
+ window.getShell().getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ if (fWindow != null) {
+ fSourceProvider = new DebugContextSourceProvider(DebugWindowContextService.this, evaluationService);
+ }
+ }
+ });
}
public void dispose() {
- fSourceProvider.dispose();
+ if (fSourceProvider != null) {
+ fSourceProvider.dispose();
+ }
fWindow.getPartService().removePartListener(this);
fWindow = null;
}

Back to the top