Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2013-08-31 03:55:11 -0400
committerUwe Stieber2013-08-31 03:55:46 -0400
commit91db3174c21b7435c234dc8baf35f62cbd8caa82 (patch)
treea9c33c04e9cf927f76a939cd27869f158ab379b8 /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core
parent92a40db5b76a5622c12bd3bfc6f3ec5b61390fc3 (diff)
downloadorg.eclipse.tcf-91db3174c21b7435c234dc8baf35f62cbd8caa82.tar.gz
org.eclipse.tcf-91db3174c21b7435c234dc8baf35f62cbd8caa82.tar.xz
org.eclipse.tcf-91db3174c21b7435c234dc8baf35f62cbd8caa82.zip
Target Explorer: Fix applying the path map on open channel may hang up the UI as TCFLaunch#launchConfigurationChanged is triggered in the TCF event dispatch thread
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java21
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java2
2 files changed, 19 insertions, 4 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
index 44fdd98b3..e8c6849ba 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/adapters/AdapterFactory.java
@@ -11,6 +11,7 @@ package org.eclipse.tcf.te.tcf.launch.core.internal.adapters;
import java.util.HashMap;
import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
import org.eclipse.core.runtime.IAdapterFactory;
import org.eclipse.debug.core.DebugPlugin;
@@ -83,7 +84,7 @@ public class AdapterFactory implements IAdapterFactory {
* @see org.eclipse.core.runtime.IAdapterFactory#getAdapter(java.lang.Object, java.lang.Class)
*/
@Override
- public Object getAdapter(Object adaptableObject, Class adapterType) {
+ public Object getAdapter(final Object adaptableObject, final Class adapterType) {
if (adaptableObject instanceof ILaunch) {
if (IStepContext.class.equals(adapterType)) {
// Lookup the adapter
@@ -111,9 +112,21 @@ public class AdapterFactory implements IAdapterFactory {
}
}
else if (adaptableObject instanceof IPeer) {
- ILocatorModelLookupService service = Model.getModel().getService(ILocatorModelLookupService.class);
- IPeerModel peerModel = service != null ? service.lkupPeerModelById(((IPeer)adaptableObject).getID()) : null;
- if (peerModel != null) return getAdapter(peerModel, adapterType);
+ final ILocatorModelLookupService service = Model.getModel().getService(ILocatorModelLookupService.class);
+ final AtomicReference<IPeerModel> peerModel = new AtomicReference<IPeerModel>();
+
+ if (service != null) {
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ peerModel.set(service.lkupPeerModelById(((IPeer)adaptableObject).getID()));
+ }
+ };
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeAndWait(runnable);
+ }
+
+ if (peerModel.get() != null) return getAdapter(peerModel.get(), adapterType);
}
return null;
}
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
index 8a2fcc88a..1d19733a2 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.core/src/org/eclipse/tcf/te/tcf/launch/core/internal/services/PathMapService.java
@@ -15,6 +15,7 @@ import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.Platform;
import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IPathMap;
import org.eclipse.tcf.services.IPathMap.PathMapRule;
import org.eclipse.tcf.te.runtime.services.AbstractService;
@@ -30,6 +31,7 @@ public class PathMapService extends AbstractService implements IPathMapService {
*/
@Override
public PathMapRule[] getPathMap(Object context) {
+ Assert.isTrue(!Protocol.isDispatchThread(), "Illegal Thread Access"); //$NON-NLS-1$
Assert.isNotNull(context);
PathMapRule[] rules = null;

Back to the top