Bug 552800 - [Moka] When remove debug assistant in customization the
exception is still send
Change-Id: I70fa3d4b9b15cdb53d26f684f44e6cd18d35e9d1
Signed-off-by: Pauline DEVILLE <pauline.deville@cea.fr>
diff --git a/plugins/org.eclipse.papyrus.moka.engine.uml.debug/src/org/eclipse/papyrus/moka/engine/uml/debug/service/UMLDebugService.java b/plugins/org.eclipse.papyrus.moka.engine.uml.debug/src/org/eclipse/papyrus/moka/engine/uml/debug/service/UMLDebugService.java
index 163fbb2..e730b66 100644
--- a/plugins/org.eclipse.papyrus.moka.engine.uml.debug/src/org/eclipse/papyrus/moka/engine/uml/debug/service/UMLDebugService.java
+++ b/plugins/org.eclipse.papyrus.moka.engine.uml.debug/src/org/eclipse/papyrus/moka/engine/uml/debug/service/UMLDebugService.java
@@ -134,8 +134,8 @@
}
@Override
- public boolean shouldContinueInDebugAssistant(Suspension suspension) {
- return debugAssistants.contains(suspension.getDebugAssistant().getAssistantID());
+ public boolean shouldContinueInDebugAssistant(String assistantID) {
+ return debugAssistants.contains(assistantID);
}
}
diff --git a/plugins/org.eclipse.papyrus.moka.engine.uml.scheduling/src/org/eclipse/papyrus/moka/engine/uml/scheduling/UMLEventDispatchLoopExecution.java b/plugins/org.eclipse.papyrus.moka.engine.uml.scheduling/src/org/eclipse/papyrus/moka/engine/uml/scheduling/UMLEventDispatchLoopExecution.java
index a8836e4..20c66ac 100644
--- a/plugins/org.eclipse.papyrus.moka.engine.uml.scheduling/src/org/eclipse/papyrus/moka/engine/uml/scheduling/UMLEventDispatchLoopExecution.java
+++ b/plugins/org.eclipse.papyrus.moka.engine.uml.scheduling/src/org/eclipse/papyrus/moka/engine/uml/scheduling/UMLEventDispatchLoopExecution.java
@@ -129,7 +129,7 @@
DebugAssistantException debugAssistantException) {
Suspension suspension = new Suspension(debugAssistantException.getDebugAssistant(),
SuspensionReasons.ERROR_DETECTION);
- if (executionEngineService.shouldContinueInDebugAssistant(suspension)) {
+ if (executionEngineService.shouldContinueInDebugAssistant(debugAssistantException.getDebugAssistant().getAssistantID())) {
Element node = debugAssistantException.getVisitorNode();
ISemanticVisitor visitor = debugAssistantException.getVisitor();
if (node != null) {
diff --git a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/AbstractActivityNodeDebugAssistantProfiler.java b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/AbstractActivityNodeDebugAssistantProfiler.java
index 9b0b067..0889c23 100644
--- a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/AbstractActivityNodeDebugAssistantProfiler.java
+++ b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/AbstractActivityNodeDebugAssistantProfiler.java
@@ -13,12 +13,16 @@
*****************************************************************************/
package org.eclipse.papyrus.moka.fuml.profiling.debug;
+import org.eclipse.papyrus.moka.debug.service.IDebugService;
import org.eclipse.papyrus.moka.fuml.activities.IActivityNodeActivation;
import org.eclipse.papyrus.moka.fuml.loci.ISemanticVisitor;
+import org.eclipse.papyrus.moka.fuml.profiling.MokaObservable;
import org.eclipse.papyrus.moka.kernel.assistant.IDebugAssistant;
+import org.eclipse.papyrus.moka.kernel.engine.IExecutionEngine;
+import org.eclipse.papyrus.moka.kernel.service.IExecutionEngineService;
import org.eclipse.uml2.uml.Element;
-public abstract class AbstractActivityNodeDebugAssistantProfiler implements IDebugAssistant {
+public abstract class AbstractActivityNodeDebugAssistantProfiler extends MokaObservable implements IDebugAssistant {
@Override
public Element getVisitorNode(ISemanticVisitor visitor) {
@@ -27,5 +31,21 @@
}
return null;
}
+
+ /**
+ * Ask to the debug service if the current assistant is valid in this context
+ *
+ * WARNING: this method should be called by each subclass before throwing exceptions
+ *
+ * @return true if the current assistant is valid in this context, false otherwise
+ */
+ protected boolean checkAssistantValidity() {
+ for (IExecutionEngineService<IExecutionEngine> service : getListeners()) {
+ if (service instanceof IDebugService) {
+ return ((IDebugService<?, ?>) service).shouldContinueInDebugAssistant(getAssistantID());
+ }
+ }
+ return false;
+ }
}
diff --git a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullStructuredValueProfiler.aj b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullStructuredValueProfiler.aj
index 7be3e65..8609eb7 100644
--- a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullStructuredValueProfiler.aj
+++ b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullStructuredValueProfiler.aj
@@ -22,7 +22,7 @@
public aspect NullStructuredValueProfiler extends AbstractActivityNodeDebugAssistantProfiler {
public static final String ASSISTANT_ID = "org.eclipse.papyrus.moka.fuml.profiling.debug.NullStructuredValueProfiler";
-
+
public NullStructuredValueProfiler() {
super();
}
@@ -33,14 +33,16 @@
call(IFeatureValue IStructuredValue.getFeatureValue(StructuralFeature));
after(IStructuredValue structuredValue, StructuralFeature feature) returning(IFeatureValue featureValue): getFeatureValue(structuredValue, feature){
- if (featureValue == null) {
- if (thisJoinPoint.getThis() instanceof IActivityNodeActivation) {
- IActivityNodeActivation visitor = (IActivityNodeActivation) thisJoinPoint.getThis();
- throw new DebugAssistantException(this, visitor);
+ if (checkAssistantValidity()) {
+ if (featureValue == null) {
+ if (thisJoinPoint.getThis() instanceof IActivityNodeActivation) {
+ IActivityNodeActivation visitor = (IActivityNodeActivation) thisJoinPoint.getThis();
+ throw new DebugAssistantException(this, visitor);
+ }
}
}
}
-
+
@Override
public String getAssistantID() {
return ASSISTANT_ID;
diff --git a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullTokenPropagationProfiler.aj b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullTokenPropagationProfiler.aj
index d2c01fb..646008c 100644
--- a/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullTokenPropagationProfiler.aj
+++ b/plugins/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/debug/NullTokenPropagationProfiler.aj
@@ -24,7 +24,7 @@
public aspect NullTokenPropagationProfiler extends AbstractActivityNodeDebugAssistantProfiler {
public static final String ASSISTANT_ID = "org.eclipse.papyrus.moka.fuml.profiling.debug.NullTokenPropagationProfiler";
-
+
public NullTokenPropagationProfiler() {
super();
}
@@ -32,10 +32,12 @@
pointcut getUnofferedTokens(OutputPinActivation objectNode):
target(objectNode) &&
call(List<IToken> IObjectNodeActivation.getUnofferedTokens());
-
+
after(OutputPinActivation objectNode) returning(List<IToken> tokens): getUnofferedTokens(objectNode){
- if(tokens.isEmpty() && ((OutputPin)objectNode.getNode()).getLower()> 0){
- throw new DebugAssistantException(this, objectNode);
+ if (checkAssistantValidity()) {
+ if (tokens.isEmpty() && ((OutputPin) objectNode.getNode()).getLower() > 0) {
+ throw new DebugAssistantException(this, objectNode);
+ }
}
}
@@ -43,5 +45,5 @@
public String getAssistantID() {
return ASSISTANT_ID;
}
-
+
}
diff --git a/plugins/org.eclipse.papyrus.moka.kernel.debug/src/org/eclipse/papyrus/moka/debug/service/IDebugService.java b/plugins/org.eclipse.papyrus.moka.kernel.debug/src/org/eclipse/papyrus/moka/debug/service/IDebugService.java
index 3c263d6..625aceb 100644
--- a/plugins/org.eclipse.papyrus.moka.kernel.debug/src/org/eclipse/papyrus/moka/debug/service/IDebugService.java
+++ b/plugins/org.eclipse.papyrus.moka.kernel.debug/src/org/eclipse/papyrus/moka/debug/service/IDebugService.java
@@ -17,7 +17,6 @@
package org.eclipse.papyrus.moka.debug.service;
import org.eclipse.papyrus.moka.debug.engine.IDebuggableExecutionEngineThread;
-import org.eclipse.papyrus.moka.kernel.assistant.Suspension;
public interface IDebugService<ThreadType, ContextType>{
@@ -103,9 +102,9 @@
/**
* Get if this given assistant is manage by this debug service
*
- * @param suspension
+ * @param assistantID
* @return true if this given assistant is manage by this debug service
*/
- boolean shouldContinueInDebugAssistant(Suspension suspension);
+ boolean shouldContinueInDebugAssistant(String assistantID);
}
diff --git a/plugins/org.eclipse.papyrus.moka.pscs/aspects/org/eclipse/papyrus/moka/pscs/profiling/debug/NullStructuredValueProfiler.aj b/plugins/org.eclipse.papyrus.moka.pscs/aspects/org/eclipse/papyrus/moka/pscs/profiling/debug/NullStructuredValueProfiler.aj
index f753926..a5ce545 100644
--- a/plugins/org.eclipse.papyrus.moka.pscs/aspects/org/eclipse/papyrus/moka/pscs/profiling/debug/NullStructuredValueProfiler.aj
+++ b/plugins/org.eclipse.papyrus.moka.pscs/aspects/org/eclipse/papyrus/moka/pscs/profiling/debug/NullStructuredValueProfiler.aj
@@ -34,10 +34,12 @@
call(IFeatureValue IStructuredValue.getFeatureValue(StructuralFeature));
after(IStructuredValue structuredValue, StructuralFeature feature) returning(IFeatureValue featureValue): getFeatureValue(structuredValue, feature){
- if (featureValue == null) {
- if (thisJoinPoint.getThis() instanceof IActivityNodeActivation) {
- IActivityNodeActivation visitor = (IActivityNodeActivation) thisJoinPoint.getThis();
- throw new DebugAssistantException(this, visitor);
+ if (checkAssistantValidity()) {
+ if (featureValue == null) {
+ if (thisJoinPoint.getThis() instanceof IActivityNodeActivation) {
+ IActivityNodeActivation visitor = (IActivityNodeActivation) thisJoinPoint.getThis();
+ throw new DebugAssistantException(this, visitor);
+ }
}
}
}