Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorUwe Stieber2012-07-19 07:06:03 -0400
committerUwe Stieber2012-07-19 07:06:03 -0400
commitd5180015caac5bc65b5fa5948c3c5bd1508053e3 (patch)
treeb8b37af97607b14398bdc4bc32d5bf7ab4b77260 /plugins/org.eclipse.tcf.debug
parent2b2b3c12129f50e946fd5d2893c4d4793b3c86e3 (diff)
downloadorg.eclipse.tcf-d5180015caac5bc65b5fa5948c3c5bd1508053e3.tar.gz
org.eclipse.tcf-d5180015caac5bc65b5fa5948c3c5bd1508053e3.tar.xz
org.eclipse.tcf-d5180015caac5bc65b5fa5948c3c5bd1508053e3.zip
Target Explorer + TCF Debugger: Activate TCFLaunch with an already opened channel. This change is replacing the previous IValueAddService OSGi service implementation.
Diffstat (limited to 'plugins/org.eclipse.tcf.debug')
-rw-r--r--plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java19
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java60
3 files changed, 59 insertions, 22 deletions
diff --git a/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF b/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
index 90009fc93..361bf8275 100644
--- a/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.tcf.debug/META-INF/MANIFEST.MF
@@ -11,8 +11,6 @@ Require-Bundle: org.eclipse.core.filesystem;bundle-version="1.3.200",
org.eclipse.core.resources;bundle-version="3.8.0",
org.eclipse.debug.core;bundle-version="3.7.100"
Import-Package: org.eclipse.tcf.core;version="1.1.0",
- org.eclipse.tcf.osgi;version="1.1.0",
- org.eclipse.tcf.osgi.services;version="1.1.0",
org.eclipse.tcf.protocol;version="1.1.0",
org.eclipse.tcf.services;version="1.1.0",
org.eclipse.tcf.util;version="1.1.0"
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
index 0db308379..7c1b47ef0 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/launch/TCFLaunchDelegate.java
@@ -32,9 +32,6 @@ import org.eclipse.tcf.internal.debug.Activator;
import org.eclipse.tcf.internal.debug.model.ITCFConstants;
import org.eclipse.tcf.internal.debug.model.TCFLaunch;
import org.eclipse.tcf.internal.debug.model.TCFMemoryRegion;
-import org.eclipse.tcf.osgi.OSGIServices;
-import org.eclipse.tcf.osgi.services.IValueAddService;
-import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.JSON;
import org.eclipse.tcf.protocol.Protocol;
import org.eclipse.tcf.services.IMemoryMap;
@@ -326,25 +323,9 @@ public class TCFLaunchDelegate extends LaunchConfigurationDelegate {
if (monitor != null) monitor.beginTask("Launching TCF debugger session", task_cnt); //$NON-NLS-1$
final String id = configuration.getAttribute(ATTR_USE_LOCAL_AGENT, true) ? local_id : configuration.getAttribute(ATTR_PEER_ID, "");
- final IValueAddService value_add_service = OSGIServices.getValueAddService();
Protocol.invokeLater(new Runnable() {
public void run() {
- // If the id is not a redirection path of itself, and a value-add service is registered,
- // ask the value-add service for the redirection path
- if (value_add_service != null && id.indexOf('/') < 0) {
- IPeer peer = Protocol.getLocator().getPeers().get(id);
- if (peer != null) {
- value_add_service.getRedirectionPath(peer, new IValueAddService.DoneGetRedirectionPath() {
- public void doneGetRedirectionPath(Throwable error, String redirection_path) {
- if (error != null || redirection_path == null) redirection_path = id;
- ((TCFLaunch)launch).launchTCF(mode, redirection_path);
- if (monitor != null) monitor.done();
- }
- });
- return;
- }
- }
((TCFLaunch)launch).launchTCF(mode, id);
if (monitor != null) monitor.done();
}
diff --git a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
index f3b8f590d..6e231ffb0 100644
--- a/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
+++ b/plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java
@@ -39,12 +39,12 @@ import org.eclipse.tcf.protocol.IPeer;
import org.eclipse.tcf.protocol.IService;
import org.eclipse.tcf.protocol.IToken;
import org.eclipse.tcf.protocol.Protocol;
+import org.eclipse.tcf.services.IContextQuery;
import org.eclipse.tcf.services.IFileSystem;
import org.eclipse.tcf.services.IFileSystem.FileSystemException;
import org.eclipse.tcf.services.IFileSystem.IFileHandle;
import org.eclipse.tcf.services.IMemory;
import org.eclipse.tcf.services.IMemory.MemoryContext;
-import org.eclipse.tcf.services.IContextQuery;
import org.eclipse.tcf.services.IMemoryMap;
import org.eclipse.tcf.services.IPathMap;
import org.eclipse.tcf.services.IProcesses;
@@ -999,6 +999,7 @@ public class TCFLaunch extends Launch {
listeners_array = null;
}
+ @Override
public void launchConfigurationChanged(final ILaunchConfiguration cfg) {
super.launchConfigurationChanged(cfg);
if (!cfg.equals(getLaunchConfiguration())) return;
@@ -1144,14 +1145,17 @@ public class TCFLaunch extends Launch {
return channel.getRemoteService(cls);
}
+ @Override
public boolean canDisconnect() {
return !disconnected;
}
+ @Override
public boolean isDisconnected() {
return disconnected;
}
+ @Override
public void disconnect() throws DebugException {
try {
new TCFTask<Boolean>() {
@@ -1170,14 +1174,17 @@ public class TCFLaunch extends Launch {
}
}
+ @Override
public boolean canTerminate() {
return false;
}
+ @Override
public boolean isTerminated() {
return disconnected;
}
+ @Override
public void terminate() throws DebugException {
}
@@ -1284,6 +1291,57 @@ public class TCFLaunch extends Launch {
}
}
+ /**
+ * Activate TCF launch: Re-use the passed in communication channel and perform all necessary launch steps.
+ *
+ * @param mode - on of launch mode constants defined in ILaunchManager.
+ * @param peer_name - TCF peer name.
+ * @param channel - TCF communication channel.
+ */
+ public void launchTCF(String mode, String peer_name, IChannel channel) {
+ assert Protocol.isDispatchThread();
+ this.mode = mode;
+ this.redirection_path.clear();
+ try {
+ if (channel == null || channel.getRemotePeer() == null) throw new IOException("Invalid channel");
+ this.peer_name = peer_name;
+ this.channel = channel;
+
+ IChannel.IChannelListener listener = new IChannel.IChannelListener() {
+
+ public void onChannelOpened() {
+ try {
+ TCFLaunch.this.peer_name = getPeer().getName();
+ onConnected();
+ }
+ catch (Throwable x) {
+ TCFLaunch.this.channel.terminate(x);
+ }
+ }
+
+ public void congestionLevel(int level) {
+ }
+
+ public void onChannelClosed(Throwable error) {
+ TCFLaunch.this.channel.removeChannelListener(this);
+ onDisconnected(error);
+ }
+
+ };
+ channel.addChannelListener(listener);
+
+ connecting = true;
+ if (channel.getState() == IChannel.STATE_OPEN) {
+ listener.onChannelOpened();
+ } else if (channel.getState() != IChannel.STATE_OPENING) {
+ throw new IOException("Channel is in invalid state");
+ }
+ }
+ catch (Throwable e) {
+ onDisconnected(e);
+ }
+ }
+
/****************************************************************************************************************/
private long getActionTimeStamp(String id) {

Back to the top