diff options
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java | 61 |
1 files changed, 9 insertions, 52 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java index 3ff304057..adb769657 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.core/src/org/eclipse/tcf/te/tcf/core/internal/ChannelManager.java @@ -30,7 +30,6 @@ import org.eclipse.tcf.protocol.IPeer; import org.eclipse.tcf.protocol.IToken; import org.eclipse.tcf.protocol.Protocol; import org.eclipse.tcf.services.IPathMap; -import org.eclipse.tcf.services.IPathMap.PathMapRule; import org.eclipse.tcf.services.IStreams; import org.eclipse.tcf.te.runtime.callback.Callback; import org.eclipse.tcf.te.runtime.interfaces.IDisposable; @@ -96,60 +95,18 @@ public final class ChannelManager extends PlatformObject implements IChannelMana final IPathMapService service = ServiceManager.getInstance().getService(peer, IPathMapService.class); final IPathMap svc = channel.getRemoteService(IPathMap.class); if (service != null && svc != null) { - // Get the configured path maps - final AtomicReference<PathMapRule[]> configuredMap = new AtomicReference<PathMapRule[]>(); - // The runnable to execute within the TCF event dispatch thread once - // the configured path map has been retrieved from the launch configuration. - final Runnable runnable = new Runnable() { - @Override - public void run() { - if (configuredMap.get() != null && configuredMap.get().length > 0) { - // Get the old path maps first. Keep path map rules not coming from us - svc.get(new IPathMap.DoneGet() { - @Override - public void doneGet(IToken token, Exception e, PathMapRule[] map) { - // Merge the maps to a new list - List<PathMapRule> rules = new ArrayList<PathMapRule>(); - - if (map != null && map.length > 0) { - for (PathMapRule rule : map) { - if (rule.getID() == null || !(!rule.getID().startsWith(service.getClientID()) && !"Agent".equals(rule.getID()))) { //$NON-NLS-1$ - rules.add(rule); - } - } - } - - for (PathMapRule rule : configuredMap.get()) { - if (IPathMapService.PATHMAP_PROTOCOL_HOST_TO_TARGET.equals(rule.getProtocol())) continue; - rules.add(rule); - } - - if (!rules.isEmpty()) { - svc.set(rules.toArray(new PathMapRule[rules.size()]), new IPathMap.DoneSet() { - @Override - public void doneSet(IToken token, Exception e) { - done.doneOpenChannel(error, channel); - } - }); - } else { - done.doneOpenChannel(error, channel); - } - } - }); - } else { - done.doneOpenChannel(error, channel); - } - } - }; - - // Getting the path map from the launch configuration must happen - // outside the TCF dispatch thread as it may trigger the launch - // configuration change listeners. + // 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() { - configuredMap.set(service.getPathMap(peer)); - Protocol.invokeLater(runnable); + service.applyPathMap(peer, new Callback() { + @Override + protected void internalDone(Object caller, IStatus status) { + done.doneOpenChannel(error, channel); + } + }); } }); thread.start(); |