Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEugene Tarassov2015-01-16 14:40:33 -0500
committerEugene Tarassov2015-01-16 14:40:33 -0500
commitaf650dfc7641fe02ca7439beb2d28f094b420cdb (patch)
tree1a904ebeca577f4742b5ab5b3141d1129679221f
parent74d27abcff67ff6679a36baadb05d849d534ce02 (diff)
downloadorg.eclipse.tcf-af650dfc7641fe02ca7439beb2d28f094b420cdb.tar.gz
org.eclipse.tcf-af650dfc7641fe02ca7439beb2d28f094b420cdb.tar.xz
org.eclipse.tcf-af650dfc7641fe02ca7439beb2d28f094b420cdb.zip
TCF Debugger: added TCFLaunch.terminate() implementation to support "Terminate and Relaunch" command
-rw-r--r--plugins/org.eclipse.tcf.debug/src/org/eclipse/tcf/internal/debug/model/TCFLaunch.java63
1 files changed, 62 insertions, 1 deletions
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 7baf86307..0e593a45d 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
@@ -1350,7 +1350,16 @@ public class TCFLaunch extends Launch {
@Override
public boolean canTerminate() {
- return false;
+ try {
+ return new TCFTask<Boolean>(8000) {
+ public void run() {
+ done(!disconnected && process != null && process.canTerminate());
+ }
+ }.get();
+ }
+ catch (Exception x) {
+ return false;
+ }
}
@Override
@@ -1360,6 +1369,58 @@ public class TCFLaunch extends Launch {
@Override
public void terminate() throws DebugException {
+ try {
+ new TCFTask<Boolean>(8000) {
+ boolean detached;
+ boolean terminated;
+ public void run() {
+ if (disconnected || process == null || !process.canTerminate()) {
+ done(false);
+ return;
+ }
+ if (!detached && process.isAttached()) {
+ process.detach(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error != null) {
+ error(error);
+ }
+ else {
+ detached = true;
+ run();
+ }
+ }
+ });
+ return;
+ }
+ if (!terminated) {
+ process.terminate(new IProcesses.DoneCommand() {
+ @Override
+ public void doneCommand(IToken token, Exception error) {
+ if (error != null) {
+ error(error);
+ }
+ else {
+ terminated = true;
+ run();
+ }
+ }
+ });
+ return;
+ }
+ if (channel == null || shutdown) {
+ done(true);
+ }
+ else {
+ disconnect_wait_list.add(this);
+ closeChannel();
+ }
+ }
+ }.get();
+ }
+ catch (Exception x) {
+ throw new DebugException(new TCFError(x));
+ }
}
public boolean isExited() {

Back to the top