Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java')
-rw-r--r--target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java51
1 files changed, 34 insertions, 17 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
index 080cdca2c..672e2835d 100644
--- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
+++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/channelmanager/steps/ApplyPathMapsStep.java
@@ -10,12 +10,14 @@
package org.eclipse.tcf.te.tcf.core.internal.channelmanager.steps;
+import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.tcf.protocol.IChannel;
import org.eclipse.tcf.protocol.IPeer;
+import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IPathMap;
import org.eclipse.tcf.te.runtime.interfaces.callback.ICallback;
import org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer;
@@ -46,7 +48,7 @@ public class ApplyPathMapsStep extends AbstractPeerStep {
public void validateExecute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor) throws CoreException {
IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
if (channel == null || channel.getState() != IChannel.STATE_OPEN) {
- throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "missing TCF channel")); //$NON-NLS-1$
+ throw new CoreException(new Status(IStatus.ERROR, CoreBundleActivator.getUniqueIdentifier(), "Channel to target not available.")); //$NON-NLS-1$
}
}
@@ -54,25 +56,40 @@ public class ApplyPathMapsStep extends AbstractPeerStep {
* @see org.eclipse.tcf.te.runtime.stepper.interfaces.IStep#execute(org.eclipse.tcf.te.runtime.stepper.interfaces.IStepContext, org.eclipse.tcf.te.runtime.interfaces.properties.IPropertiesContainer, org.eclipse.tcf.te.runtime.stepper.interfaces.IFullQualifiedId, org.eclipse.core.runtime.IProgressMonitor, org.eclipse.tcf.te.runtime.interfaces.callback.ICallback)
*/
@Override
- public void execute(IStepContext context, IPropertiesContainer data, IFullQualifiedId fullQualifiedId, IProgressMonitor monitor, final ICallback callback) {
+ public void execute(final IStepContext context, final IPropertiesContainer data, final IFullQualifiedId fullQualifiedId, final IProgressMonitor monitor, final ICallback callback) {
+ Assert.isNotNull(context);
+ Assert.isNotNull(data);
+ Assert.isNotNull(fullQualifiedId);
+ Assert.isNotNull(monitor);
+ Assert.isNotNull(callback);
+
final IChannel channel = (IChannel)StepperAttributeUtil.getProperty(ITcfStepAttributes.ATTR_CHANNEL, fullQualifiedId, data);
final IPeer peer = getActivePeerContext(context, data, fullQualifiedId);
- final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class);
- final IPathMap svc = channel.getRemoteService(IPathMap.class);
- if (service != null && svc != null) {
- // Apply the initial path map to the opened channel.
- // This must happen outside the TCF dispatch thread as it may trigger
- // the launch configuration change listeners.
- Thread thread = new Thread(new Runnable() {
- @Override
- public void run() {
- service.applyPathMap(peer, true, callback);
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class);
+ final IPathMap svc = channel.getRemoteService(IPathMap.class);
+ if (service != null && svc != null) {
+ // Apply the initial path map to the opened channel.
+ // This must happen outside the TCF dispatch thread as it may trigger
+ // the launch configuration change listeners.
+ Thread thread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ service.applyPathMap(peer, true, callback);
+ }
+ });
+ thread.start();
+ } else {
+ callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
}
- });
- thread.start();
- } else {
- callback(data, fullQualifiedId, callback, Status.OK_STATUS, null);
- }
+ }
+ };
+
+ if (Protocol.isDispatchThread()) runnable.run();
+ else Protocol.invokeLater(runnable);
}
}

Back to the top