Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoracuccuru2013-04-18 13:53:38 -0400
committeracuccuru2013-04-18 13:53:38 -0400
commit523ec13c5e4ba4a7f9650f67ed134232f5a74f8d (patch)
tree1168a1e050479883636766104e3d7dd131dd719d /sandbox
parentfffafe2a0a72647c48e2b54ecd5239ba69b508a7 (diff)
downloadorg.eclipse.papyrus-523ec13c5e4ba4a7f9650f67ed134232f5a74f8d.tar.gz
org.eclipse.papyrus-523ec13c5e4ba4a7f9650f67ed134232f5a74f8d.tar.xz
org.eclipse.papyrus-523ec13c5e4ba4a7f9650f67ed134232f5a74f8d.zip
405389: [Moka] Papyrus shall provide a generic and extendible framework for execution and debugging of models
https://bugs.eclipse.org/bugs/show_bug.cgi?id=405389 405391: [Moka] Moka shall provide an implementation of the fUML Execution Model https://bugs.eclipse.org/bugs/show_bug.cgi?id=405391 Adjustements for management of multi-threaded executions
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF1
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$1.classbin1681 -> 1687 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$2.classbin1658 -> 1660 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.classbin7008 -> 7164 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.classbin4606 -> 4606 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.classbin10138 -> 10310 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.classbin7637 -> 7828 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.java6
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.java12
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.java16
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.java9
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java81
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.classbin1359 -> 1620 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.classbin1305 -> 1673 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget$EventDispatchJob.classbin1842 -> 1843 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget.classbin16387 -> 16935 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.classbin13775 -> 13766 bytes
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.java19
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.java28
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/debug/MokaDebugTarget.java26
-rw-r--r--sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.java4
21 files changed, 178 insertions, 24 deletions
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
index 71383e636d5..21cd53b40ea 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
@@ -31,6 +31,7 @@ Export-Package: org.eclipse.papyrus.moka.fuml;uses:="org.eclipse.ui.plugin,org.o
org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL2,
org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL3,
org.eclipse.papyrus.moka.fuml.debug,
+ org.eclipse.papyrus.moka.fuml.presentation,
org.eclipse.papyrus.moka.fuml.registry
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-Vendor: %Bundle-Vendor
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$1.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$1.class
index 3ec526145f3..0e49cdd69eb 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$1.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$1.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$2.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$2.class
index c6653f75f51..f50f2f42461 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$2.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine$2.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.class
index 086264f6364..b1cb04450b1 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.class
index fea8a916968..422c60e0ab6 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.class
index f851790c351..f2343324914 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.class b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.class
index 0a79b2e8ea7..61c2e514370 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/bin/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.java
index a4effaace84..853de76fd72 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/ActivityEdgeInstance.java
@@ -53,6 +53,9 @@ public class ActivityEdgeInstance {
// Keep the offered tokens until taken by the target.
// (Note that any one edge should only be handling either all object
// tokens or all control tokens.)
+ if (! FUMLExecutionEngine.eInstance.getControlDelegate().control(this)) { // Added for connection with the debug API
+ return ;
+ }
Offer offer = new Offer();
for(int i = 0; i < tokens.size(); i++) {
Token token = tokens.get(i);
@@ -60,9 +63,6 @@ public class ActivityEdgeInstance {
offer.offeredTokens.add(token);
}
this.offers.add(offer);
- if (! FUMLExecutionEngine.eInstance.getControlDelegate().control(this)) { // Added for connection with the debug API
- return ;
- }
this.target.receiveOffer();
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.java
index c5c3fdc8f51..bc87dfa5794 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/generated/org/eclipse/papyrus/moka/fuml/Semantics/Activities/IntermediateActivities/DecisionNodeActivation.java
@@ -17,6 +17,7 @@ import java.util.ArrayList;
import java.util.List;
import org.eclipse.papyrus.moka.fuml.debug.Debug;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.BooleanValue;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.Value;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.Execution;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;
@@ -135,7 +136,16 @@ public class DecisionNodeActivation extends ControlNodeActivation {
this.decisionInputExecution.execute();
List<ParameterValue> outputParameterValues = this.decisionInputExecution.getOutputParameterValues();
decisionInputExecution.destroy();
- decisionInputResult = outputParameterValues.get(0).values.get(0);
+ if (outputParameterValues.get(0).values.size() == 0) {
+ // FIXME Added for connection with debug API
+ // When execution stops due to client request, outputParameterValues is empty
+ // Just puts true. Execution flow is supposed to stop "by itself" then
+ decisionInputResult = new BooleanValue() ;
+ ((BooleanValue)decisionInputResult).value = true ;
+ }
+ else {
+ decisionInputResult = outputParameterValues.get(0).values.get(0);
+ }
}
return decisionInputResult;
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.java
index 66cfcc0c372..bf2ee4bfd99 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/FUMLExecutionEngine.java
@@ -24,6 +24,7 @@ import org.eclipse.core.runtime.SafeRunner;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.papyrus.infra.core.Activator;
import org.eclipse.papyrus.moka.engine.AbstractExecutionEngine;
import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors.ParameterValue;
import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.Executor;
@@ -78,6 +79,7 @@ public abstract class FUMLExecutionEngine extends AbstractExecutionEngine {
// Finally launches the execution
this.started = true ;
this.locus.executor.execute(main, null,this.arguments);
+ eInstance.getControlDelegate().waitForTermination() ;
}
}
@@ -99,9 +101,9 @@ public abstract class FUMLExecutionEngine extends AbstractExecutionEngine {
loadLibrary(o, locus, main);
}
} catch (CoreException ex) {
- System.out.println(ex.getMessage());
+ Activator.log.error(ex);
} catch (Exception ex) {
- System.out.println(ex.getMessage());
+ Activator.log.error(ex);
}
}
@@ -117,9 +119,9 @@ public abstract class FUMLExecutionEngine extends AbstractExecutionEngine {
loadServices(o, locus, main);
}
} catch (CoreException ex) {
- System.out.println(ex.getMessage());
+ Activator.log.error(ex);
} catch (Exception ex) {
- System.out.println(ex.getMessage());
+ Activator.log.error(ex);
}
}
@@ -146,9 +148,9 @@ public abstract class FUMLExecutionEngine extends AbstractExecutionEngine {
// Loads a library of OpaqueBehaviorExecutions using the safe runner pattern
protected static void loadLibrary(final Object o, final Locus locus, final Object context) {
ISafeRunnable runnable = new ISafeRunnable() {
-
+
public void handleException(Throwable e) {
- System.out.println("Exception while loading the library");
+ Activator.log.error(e);
}
public void run() throws Exception {
@@ -163,7 +165,7 @@ public abstract class FUMLExecutionEngine extends AbstractExecutionEngine {
ISafeRunnable runnable = new ISafeRunnable() {
public void handleException(Throwable e) {
- System.out.println("Exception while loading system services");
+ Activator.log.error(e);
}
public void run() throws Exception {
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.java
index 9c615bdc405..a1fd91e8903 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/ControlDelegate.java
@@ -37,7 +37,7 @@ public class ControlDelegate {
/**
* The list of threads implied by current execution
*/
- protected List<MokaThread> threads ;
+ protected List<FUMLThread> threads ;
/**
* Determines if execution is suspended
@@ -156,9 +156,9 @@ public class ControlDelegate {
*/
public MokaThread[] getThreads() {
if (this.threads == null) {
- this.threads = new ArrayList<MokaThread>() ;
+ this.threads = new ArrayList<FUMLThread>() ;
if (this.engine.getDebugTarget().getLaunch().getLaunchMode().equals(ILaunchManager.DEBUG_MODE)) {
- MokaThread thread = new MokaThread(this.engine.getDebugTarget()) ;
+ FUMLThread thread = new FUMLThread(this.engine.getDebugTarget()) ;
thread.setName("Main Thread") ;
thread.setStackFrames(new IStackFrame[]{}) ;
this.threads.add(thread) ;
@@ -264,5 +264,8 @@ public class ControlDelegate {
}
}
+ public void waitForTermination() {
+ // Nothing to do
+ }
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java
new file mode 100644
index 00000000000..b0796075a3a
--- /dev/null
+++ b/sandbox/Moka/org.eclipse.papyrus.moka.fuml/src/org/eclipse/papyrus/moka/fuml/debug/FUMLThread.java
@@ -0,0 +1,81 @@
+package org.eclipse.papyrus.moka.fuml.debug;
+
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.papyrus.infra.core.Activator;
+import org.eclipse.papyrus.moka.debug.MokaDebugTarget;
+import org.eclipse.papyrus.moka.debug.MokaThread;
+import org.eclipse.papyrus.moka.ui.presentation.IPresentation;
+import org.eclipse.swt.graphics.Image;
+
+public class FUMLThread extends MokaThread implements IPresentation {
+
+ protected boolean isTerminated = false ;
+
+ protected int reasonForSuspending = -1 ;
+
+ protected int reasonForResuming = DebugEvent.CLIENT_REQUEST ;
+
+ public FUMLThread(MokaDebugTarget debugTarget) {
+ super(debugTarget);
+ }
+
+ public String getLabel() {
+ String label = "" ;
+ try {
+ label = this.getName() + " [";
+ if (this.isTerminated()) {
+ label += "TERMINATED]" ;
+ }
+ else if (this.isStepping()) {
+ label += "STEPPING]" ;
+ }
+ else if (this.isSuspended()) {
+ label += "SUSPENDED]" ;
+ }
+ else {
+ label += "RUNNING]" ;
+ }
+ } catch (DebugException e) {
+ Activator.log.error(e);
+ label += "Default" ;
+ }
+ return label ;
+ }
+
+ public String getDetails() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public Image getImage() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean isTerminated() {
+ return this.isTerminated ;
+ }
+
+ public void setIsTerminated(boolean isTerminated) {
+ this.isTerminated = isTerminated ;
+ }
+
+ public int getReasonForSuspending() {
+ return reasonForSuspending;
+ }
+
+ public void setReasonForSuspending(int reasonForSuspending) {
+ this.reasonForSuspending = reasonForSuspending;
+ }
+
+ public int getReasonForResuming() {
+ return reasonForResuming;
+ }
+
+ public void setReasonForResuming(int reasonForResuming) {
+ this.reasonForResuming = reasonForResuming;
+ }
+
+}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.class b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.class
index 8729067561f..d1ec0aa0fe6 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.class b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.class
index 85e14aeb617..657c5b10635 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget$EventDispatchJob.class b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget$EventDispatchJob.class
index cf5238db7e8..1afd99ac8c9 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget$EventDispatchJob.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget$EventDispatchJob.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget.class b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget.class
index d6b8daae03c..bfd247d35a5 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/debug/MokaDebugTarget.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.class b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.class
index 948cc959eda..618a6964e11 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.class
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/bin/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.class
Binary files differ
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.java b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.java
index d1e27a71f1e..c2623cf39cb 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/isuspendresume/Resume_Event.java
@@ -17,6 +17,7 @@ import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.model.IDebugElement;
import org.eclipse.papyrus.moka.communication.Marshaller;
import org.eclipse.papyrus.moka.communication.event.EventMessage;
+import org.eclipse.papyrus.moka.debug.MokaThread;
/**
* An event message representing a Resume event.
@@ -32,6 +33,11 @@ public class Resume_Event extends EventMessage {
protected int resumeDetail ;
/**
+ * The threads available at the execution engine when this message was sent
+ */
+ protected MokaThread[] threads ;
+
+ /**
* Constructs a Resume_Event from the given source and details.
* Source is supposed to be same element as in the Resume_Request
* which preceded the creation of this Resume_Event.
@@ -43,11 +49,13 @@ public class Resume_Event extends EventMessage {
*
* @param source The source for this Resume_Event
* @param resumeDetail The reason/detail of this Resume_Event
+ * @param threads The threads available at the execution engine when this message was sent
*/
- public Resume_Event(IDebugElement source, int resumeDetail) {
+ public Resume_Event(IDebugElement source, int resumeDetail, MokaThread[] threads) {
this.source = source;
this.resumeDetail = resumeDetail;
this.eventKind = DebugEvent.RESUME ;
+ this.threads = threads ;
}
/* (non-Javadoc)
@@ -65,5 +73,14 @@ public class Resume_Event extends EventMessage {
this.debugEvent = new DebugEvent(source, eventKind, resumeDetail) ;
return this.debugEvent;
}
+
+ /**
+ * Returns the threads available at the execution engine when this message was sent
+ *
+ * @return The threads available at the execution engine when this message was sent
+ */
+ public MokaThread[] getThreads() {
+ return this.threads ;
+ }
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.java b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.java
index 8f52fa27668..af9ebe439bc 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/communication/event/iterminate/Terminate_Event.java
@@ -15,6 +15,7 @@ package org.eclipse.papyrus.moka.communication.event.iterminate;
import org.eclipse.debug.core.DebugEvent;
import org.eclipse.debug.core.model.IDebugElement;
+import org.eclipse.debug.core.model.IThread;
import org.eclipse.papyrus.moka.communication.Marshaller;
import org.eclipse.papyrus.moka.communication.event.EventMessage;
@@ -28,14 +29,21 @@ import org.eclipse.papyrus.moka.communication.event.EventMessage;
public class Terminate_Event extends EventMessage {
/**
+ * The threads available at the execution engine when it emitted
+ * this Terminate_Event message
+ */
+ protected IThread[] threads ;
+
+ /**
* Construct a terminate event from the given source.
* The source is usually the debug target. See Start_Event for the rationale.
*
* @param source The source for the terminate event
*/
- public Terminate_Event(IDebugElement source) {
+ public Terminate_Event(IDebugElement source, IThread[] threads) {
this.source = source;
this.eventKind = DebugEvent.TERMINATE ;
+ this.threads = threads ;
}
/* (non-Javadoc)
@@ -53,5 +61,23 @@ public class Terminate_Event extends EventMessage {
this.debugEvent = new DebugEvent(source, eventKind) ;
return this.debugEvent;
}
+
+ /**
+ * Returns the source of this terminate event
+ *
+ * @return the source of this terminate event
+ */
+ public IDebugElement getSource() {
+ return this.source ;
+ }
+ /**
+ * Returns the threads available at the execution engine when it emitted this Terminate_Event message
+ *
+ * @return The threads available at the execution engine when it emitted this Terminate_Event message
+ */
+ public IThread[] getThreads() {
+ return this.threads ;
+ }
+
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/debug/MokaDebugTarget.java b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/debug/MokaDebugTarget.java
index 29428833d5c..c3e0def935a 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/debug/MokaDebugTarget.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/debug/MokaDebugTarget.java
@@ -390,6 +390,7 @@ public class MokaDebugTarget extends MokaDebugElement implements IDebugTarget {
protected void handle_Resume_Event(String message) {
Resume_Event event = Marshaller.getInstance().resume_event_unmarshal(message) ;
this.isSuspended = false ;
+ this.threads = event.getThreads() ;
this.fireEvent(event.getDebugEvent()) ;
}
@@ -497,7 +498,11 @@ public class MokaDebugTarget extends MokaDebugElement implements IDebugTarget {
this.isTerminated = true;
this.isSuspended = false ;
DebugPlugin.getDefault().getBreakpointManager().removeBreakpointListener(this) ;
- this.fireEvent(new Terminate_Event(this).getDebugEvent()) ;
+ try {
+ this.fireEvent(new Terminate_Event(this, this.getThreads()).getDebugEvent()) ;
+ } catch (DebugException e) {
+ this.fireEvent(new Terminate_Event(this, null).getDebugEvent()) ;
+ }
}
/* (non-Javadoc)
@@ -528,8 +533,15 @@ public class MokaDebugTarget extends MokaDebugElement implements IDebugTarget {
* This method is called by the event dispatch job.
*
*/
- protected void handle_Terminate_Event() {
- this.isTerminated = true ;
+ protected void handle_Terminate_Event(String event) {
+ Terminate_Event terminateEvent = Marshaller.getInstance().terminate_event_unmarshal(event) ;
+ if (terminateEvent.getSource() instanceof IDebugTarget) {
+ this.isTerminated = true ;
+ }
+ else {
+ this.threads = (MokaThread[]) terminateEvent.getThreads() ;
+ this.fireEvent(terminateEvent.getDebugEvent());
+ }
}
/**
@@ -563,7 +575,7 @@ public class MokaDebugTarget extends MokaDebugElement implements IDebugTarget {
handle_Suspend_Event(event);
}
else if (event.startsWith(MokaConstants.event_terminate)) {
- handle_Terminate_Event() ;
+ handle_Terminate_Event(event) ;
}
}
} catch (IOException e) {
@@ -592,8 +604,10 @@ public class MokaDebugTarget extends MokaDebugElement implements IDebugTarget {
//if (DebugPlugin.getDefault().getBreakpointManager().isEnabled())
this.installDeferredBreakpoints();
try {
- resume();
- this.isStarted = true ;
+ if (! this.isStarted) {
+ resume();
+ this.isStarted = true ;
+ }
} catch (DebugException e) {
Activator.log.error(e) ;
}
diff --git a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.java b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.java
index 5044dc9f94f..98c7b05ae91 100644
--- a/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.java
+++ b/sandbox/Moka/org.eclipse.papyrus.moka/src/org/eclipse/papyrus/moka/engine/AbstractExecutionEngine.java
@@ -246,7 +246,7 @@ public abstract class AbstractExecutionEngine implements IExecutionEngine {
}
}
// Communication protocol ends by notifying the moka debug target that execution has terminated
- this.sendEvent(new Terminate_Event(this.debugTarget)) ;
+ this.sendEvent(new Terminate_Event(this.debugTarget, this.getThreads())) ;
}
}
@@ -328,7 +328,7 @@ public abstract class AbstractExecutionEngine implements IExecutionEngine {
*/
protected void resume_reply(String message) {
Resume_Request request = Marshaller.getInstance().resume_request_unmarshal(message) ;
- Resume_Event event = new Resume_Event(request.getDebugElement(), request.getResumeDetail()) ;
+ Resume_Event event = new Resume_Event(request.getDebugElement(), request.getResumeDetail(), this.getThreads()) ;
this.sendEvent(event) ;
this.resume(request) ;
}

Back to the top