Enable breakpoints usage on State, Pseudostate and Transition.

Change-Id: I633fad60ea1978d8d4d9563378cef9b5b23beec7
Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/aspects/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/VertexActivationProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/aspects/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/VertexActivationProfiler.aj
index 6159a6a..61b306f 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/aspects/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/VertexActivationProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.statemachines/aspects/org/eclipse/papyrus/moka/fuml/statemachines/Semantics/StateMachines/VertexActivationProfiler.aj
@@ -1,52 +1,58 @@
 package org.eclipse.papyrus.moka.fuml.statemachines.Semantics.StateMachines;

 

-import org.eclipse.core.runtime.IProgressMonitor;

-import org.eclipse.core.runtime.OperationCanceledException;

-import org.eclipse.papyrus.moka.engine.MokaExecutionEngineJob;

 import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IEventOccurrence;

 import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IPseudostateActivation;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IRegionActivation;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateActivation;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ITransitionActivation;

 import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IVertexActivation;

 

-public aspect VertexActivationProfiler extends SemanticVisitorProfiler{

+public aspect VertexActivationProfiler extends SemanticVisitorProfiler {

 

-	public VertexActivationProfiler(){

+	public VertexActivationProfiler() {

 		super();

 	}

-	

-	// Define a point cut for each class that implements the enter operation declared

-	// by the IVertexActivation interface

-	pointcut enter(IVertexActivation activation, ITransitionActivation enteringTransition, IEventOccurrence eventOccurrence,  IRegionActivation leastCommonAncestor):

+

+	// Intercept all pseudo state entry

+	pointcut enterPseudostate(IPseudostateActivation activation, ITransitionActivation enteringTransition,

+			IEventOccurrence eventOccurrence, IRegionActivation leastCommonAncestor):

 		target(activation) &&

 		args(enteringTransition, eventOccurrence, leastCommonAncestor) &&

 		call(* IVertexActivation.enter(ITransitionActivation, IEventOccurrence, IRegionActivation));

-	

-	//

-	after(IVertexActivation activation, ITransitionActivation enteringTransition, IEventOccurrence eventOccurrence,  IRegionActivation leastCommonAncestor):

-		enter(activation, enteringTransition, eventOccurrence, leastCommonAncestor){

-		IProgressMonitor monitor = MokaExecutionEngineJob.getInstance().getMonitor();

-		if(monitor!=null && monitor.isCanceled()){

-			throw new OperationCanceledException();

-		}

-		this.fireNodeVisited(activation);

+

+	// Intercept all state entry

+	pointcut enterState(IStateActivation activation, ITransitionActivation enteringTransition,

+			IEventOccurrence eventOccurrence, IRegionActivation leastCommonAncestor):

+		target(activation) &&

+		args(enteringTransition, eventOccurrence, leastCommonAncestor) &&

+		call(* IVertexActivation.enter(ITransitionActivation, IEventOccurrence, IRegionActivation));

+

+	// Executed after a state entry is observed

+	after(IStateActivation activation, ITransitionActivation enteringTransition, IEventOccurrence eventOccurrence,

+			IRegionActivation leastCommonAncestor): enterState(activation, enteringTransition, eventOccurrence, leastCommonAncestor){

+		this.visit(activation);

 	}

-	

-	// Define a point cut for each class that implements the exit operation declared

-	// by the IVertexActivation interface

-	pointcut exit(IVertexActivation activation, ITransitionActivation exitingTransition, IEventOccurrence eventOccurrence,  IRegionActivation leastCommonAncestor):

+

+	// Executed before a pseudo state entry is observed

+	before(IPseudostateActivation activation, ITransitionActivation enteringTransition,

+			IEventOccurrence eventOccurrence, IRegionActivation leastCommonAncestor):

+		enterPseudostate(activation, enteringTransition, eventOccurrence, leastCommonAncestor){

+		this.visit(activation);

+	}

+

+	// Intercept each call to IVertexActivation.exit(...)

+	pointcut exit(IVertexActivation activation, ITransitionActivation exitingTransition,

+			IEventOccurrence eventOccurrence, IRegionActivation leastCommonAncestor):

 		target(activation) &&

 		args(exitingTransition, eventOccurrence, leastCommonAncestor) &&

 		call(* IVertexActivation.exit(ITransitionActivation, IEventOccurrence, IRegionActivation));

-	

-	//

-	after(IVertexActivation activation, ITransitionActivation enteringTransition, IEventOccurrence eventOccurrence,  IRegionActivation leastCommonAncestor):

+

+	// Executed after vertex is exited

+	after(IVertexActivation activation, ITransitionActivation enteringTransition, IEventOccurrence eventOccurrence,

+			IRegionActivation leastCommonAncestor):

 		exit(activation, enteringTransition, eventOccurrence, leastCommonAncestor){

-		IProgressMonitor monitor = MokaExecutionEngineJob.getInstance().getMonitor();

-		if(monitor!=null && monitor.isCanceled()){

-			throw new OperationCanceledException();

-		}

-		this.fireNodeLeft(activation);

+		this.leave(activation);

 	}

-	

+

 }

diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/BasicActions/ObjectNodeActivationProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/BasicActions/ObjectNodeActivationProfiler.aj
index 8abdd8c..9e0f0a7 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/BasicActions/ObjectNodeActivationProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/BasicActions/ObjectNodeActivationProfiler.aj
@@ -30,7 +30,7 @@
 	

 	

 	before(IObjectNodeActivation activation, List<IToken> tokens) : sendOffer(activation, tokens){

-		this.fireNodeVisited(activation);

+		this.visit(activation);

 	}

 	

 }
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/CompleteActions/AcceptEventActionActivationProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/CompleteActions/AcceptEventActionActivationProfiler.aj
index 800795e..2191fca 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/CompleteActions/AcceptEventActionActivationProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Actions/CompleteActions/AcceptEventActionActivationProfiler.aj
@@ -26,6 +26,6 @@
 		call(* IAcceptEventActionActivation.accept(IEventOccurrence));

 	

 	before(IAcceptEventActionActivation activation, IEventOccurrence eventOccurrence): accept(activation, eventOccurrence){

-		this.fireNodeLeft(activation);

+		this.leave(activation);

 	}

 }
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityEdgeInstanceProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityEdgeInstanceProfiler.aj
index 3b1263b..0bee9ee 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityEdgeInstanceProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityEdgeInstanceProfiler.aj
@@ -32,7 +32,7 @@
 		call(* IActivityEdgeInstance.sendOffer(List<IToken>));

 	

 	before(IActivityEdgeInstance edgeInstance, List<IToken> tokens): sendOffer(edgeInstance, tokens){

-		this.fireNodeVisited(edgeInstance);

+		this.visit(edgeInstance);

 	}

 	

 	pointcut takeOfferedTokens(IActivityEdgeInstance edgeInstance):

@@ -41,7 +41,7 @@
 	

 	after(IActivityEdgeInstance edgeInstance) returning(List<IToken> tokens): takeOfferedTokens(edgeInstance){

 		if(!tokens.isEmpty()){

-			this.fireNodeLeft(edgeInstance);

+			this.leave(edgeInstance);

 		}

 	}

 	

@@ -52,7 +52,7 @@
 	

 	after(IActivityEdgeInstance edgeInstance, Integer maxCount) returning(List<IToken> tokens): takeOfferedTokensMax(edgeInstance, maxCount){

 		if(!edgeInstance.hasOffer()){

-			this.fireNodeLeft(edgeInstance);

+			this.leave(edgeInstance);

 		}

 	}

 }
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityNodeActivationProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityNodeActivationProfiler.aj
index 4a331a7..1c21864 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityNodeActivationProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/ActivityNodeActivationProfiler.aj
@@ -16,32 +16,25 @@
 

 import java.util.List;

 

-import org.eclipse.papyrus.moka.fuml.Semantics.impl.Activities.IntermediateActivities.ObjectNodeActivation;

-import org.eclipse.core.runtime.IProgressMonitor;

-import org.eclipse.core.runtime.OperationCanceledException;

-import org.eclipse.papyrus.moka.engine.MokaExecutionEngineJob;

 import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;

-import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;

 import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IToken;

+import org.eclipse.papyrus.moka.fuml.Semantics.impl.Activities.IntermediateActivities.ObjectNodeActivation;

+import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;

 

-public aspect ActivityNodeActivationProfiler extends SemanticVisitorProfiler{

+public aspect ActivityNodeActivationProfiler extends SemanticVisitorProfiler {

 

 	public ActivityNodeActivationProfiler() {

 		super();

 	}

-	

+

 	pointcut fire(IActivityNodeActivation activation, List<IToken> tokens):

 		!within(ObjectNodeActivation+) &&

 		target(activation) && 

 		args(tokens) && 

 		call(* IActivityNodeActivation.fire(List<IToken>));

-	

+

 	before(IActivityNodeActivation activation, List<IToken> tokens): fire(activation, tokens) {

-		IProgressMonitor monitor = MokaExecutionEngineJob.getInstance().getMonitor();

-		if(monitor!=null && monitor.isCanceled()){

-			throw new OperationCanceledException();

-		}

-		this.fireNodeVisited(activation);

+		this.visit(activation);

 	}

-	

+

 }
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/CallActionActivationProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/CallActionActivationProfiler.aj
index 1f812ec..32b8e8a 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/CallActionActivationProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Activities/IntermediateActivities/CallActionActivationProfiler.aj
@@ -33,7 +33,7 @@
 	after(ICallActionActivation activation, IExecution execution) : removeCallExecution(activation, execution){

 		CallAction callAction = (CallAction) activation.getNode();

 		if(callAction.isSynchronous()){

-			this.fireNodeLeft(activation);

+			this.leave(activation);

 		}

 	}

 }
\ No newline at end of file
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Loci/SemanticVisitorProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Loci/SemanticVisitorProfiler.aj
index 2eb5afa..0f00a82 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Loci/SemanticVisitorProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Loci/SemanticVisitorProfiler.aj
@@ -15,8 +15,11 @@
 package org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci;

 

 

-import org.eclipse.papyrus.moka.fuml.profiling.MokaObservable;

+import org.eclipse.core.runtime.IProgressMonitor;

+import org.eclipse.core.runtime.OperationCanceledException;

+import org.eclipse.papyrus.moka.engine.MokaExecutionEngineJob;

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.profiling.MokaObservable;

 import org.eclipse.papyrus.moka.service.IMokaExecutionListener;

 

 public abstract aspect SemanticVisitorProfiler extends MokaObservable{

@@ -33,13 +36,29 @@
 	

 	after(ISemanticVisitor visitor) : endIsolation(visitor) {} 

 	

-	public void fireNodeVisited(ISemanticVisitor visitor){

+	public void visit(ISemanticVisitor visitor) {

+		IProgressMonitor monitor = MokaExecutionEngineJob.getInstance().getMonitor();

+		if (monitor != null && monitor.isCanceled()) {

+			throw new OperationCanceledException();

+		}

+		this.fireNodeVisited(visitor);

+	}

+	

+	public void leave(ISemanticVisitor visitor) {

+		IProgressMonitor monitor = MokaExecutionEngineJob.getInstance().getMonitor();

+		if (monitor != null && monitor.isCanceled()) {

+			throw new OperationCanceledException();

+		}

+		this.fireNodeLeft(visitor);

+	}

+	

+	protected void fireNodeVisited(ISemanticVisitor visitor){

 		for(IMokaExecutionListener listener: this.listeners)

 			listener.nodeVisited(visitor);

 		

 	}

 	

-	public void fireNodeLeft(ISemanticVisitor visitor){

+	protected void fireNodeLeft(ISemanticVisitor visitor){

 		for(IMokaExecutionListener listener: this.listeners)

 			listener.nodeLeft(visitor);

 	}

diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/META-INF/MANIFEST.MF b/bundles/core/services/org.eclipse.papyrus.moka.debug/META-INF/MANIFEST.MF
index a00d32c..0d00217 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/META-INF/MANIFEST.MF
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/META-INF/MANIFEST.MF
@@ -7,11 +7,11 @@
 Require-Bundle: org.eclipse.ui;bundle-version="[3.109.0,4.0.0)",
  org.eclipse.papyrus.moka.utils;bundle-version="2.0.100",
  org.eclipse.papyrus.moka.service;bundle-version="2.0.100";visibility:=reexport,
- org.eclipse.papyrus.moka.fuml.interfaces;bundle-version="2.0.100",
  org.eclipse.papyrus.infra.core;bundle-version="[3.0.0,4.0.0)",
  org.eclipse.papyrus.moka.animation;bundle-version="2.0.100",
  org.eclipse.papyrus.moka.utils.ui;bundle-version="2.0.100",
- org.eclipse.debug.ui;bundle-version="[3.12.0,4.0.0)"
+ org.eclipse.debug.ui;bundle-version="[3.12.0,4.0.0)",
+ org.eclipse.papyrus.moka.fuml.statemachines.interfaces;visibility:=reexport
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Bundle-Vendor: Eclipse Modeling Project
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugService.java b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugService.java
index 938295e..bc64b88 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugService.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugService.java
@@ -19,6 +19,7 @@
 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateMachineSemanticVisitor;

 import org.eclipse.papyrus.moka.service.AbstractMokaService;

 import org.eclipse.papyrus.moka.service.IMokaExecutionListener;

 

@@ -36,15 +37,20 @@
 	public void nodeVisited(ISemanticVisitor nodeVisitor) {

 		if (!this.debugTarget.isDisconnected()) {

 			if (nodeVisitor instanceof IActivityNodeActivation

-					|| nodeVisitor instanceof IActivityEdgeInstance) {

+					|| nodeVisitor instanceof IActivityEdgeInstance

+					|| nodeVisitor instanceof IStateMachineSemanticVisitor) {

 				IObject_ object = null;

-				if (nodeVisitor instanceof IActivityNodeActivation) {

-					if (((IActivityNodeActivation) nodeVisitor).getGroup() != null) {

-						object = ((IActivityNodeActivation) nodeVisitor).getExecutionContext();

-					}

-				} else {

-					if (((IActivityEdgeInstance) nodeVisitor).getSource().getGroup() != null) {

-						object = ((IActivityEdgeInstance) nodeVisitor).getSource().getExecutionContext();

+				if(nodeVisitor instanceof IStateMachineSemanticVisitor) {

+					object = ((IStateMachineSemanticVisitor)nodeVisitor).getExecutionContext();

+				}else {

+					if (nodeVisitor instanceof IActivityNodeActivation) {

+						if (((IActivityNodeActivation) nodeVisitor).getGroup() != null) {

+							object = ((IActivityNodeActivation) nodeVisitor).getExecutionContext();

+						}

+					} else {

+						if (((IActivityEdgeInstance) nodeVisitor).getSource().getGroup() != null) {

+							object = ((IActivityEdgeInstance) nodeVisitor).getSource().getExecutionContext();

+						}

 					}

 				}

 				if (object != null) {

diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugServiceHelper.java b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugServiceHelper.java
index fa69487..3fb805c 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugServiceHelper.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/DebugServiceHelper.java
@@ -21,13 +21,12 @@
 import org.eclipse.emf.ecore.EObject;

 import org.eclipse.papyrus.moka.animation.engine.rendering.IAnimation;

 import org.eclipse.papyrus.moka.debug.breakpoint.MokaBreakpoint;

-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityEdgeInstance;

-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;

 import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

 import org.eclipse.papyrus.moka.service.IMokaService;

 import org.eclipse.papyrus.moka.service.MokaServiceRegistry;

 import org.eclipse.papyrus.moka.utils.constants.MokaConstants;

+import org.eclipse.papyrus.moka.utils.helper.semantics.SemanticHelper;

 import org.eclipse.uml2.uml.Class;

 import org.eclipse.uml2.uml.Classifier;

 

@@ -54,12 +53,7 @@
 		boolean breakpointExist = false;

 		IBreakpointManager breakpointManager = DebugPlugin.getDefault().getBreakpointManager();

 		IBreakpoint[] breakpoints = breakpointManager.getBreakpoints(MokaConstants.MOKA_DEBUG_MODEL_ID);

-		EObject visitedModelElement = null;

-		if (visitor instanceof IActivityNodeActivation) {

-			visitedModelElement = ((IActivityNodeActivation) visitor).getNode();

-		} else if (visitor instanceof IActivityEdgeInstance) {

-			visitedModelElement = ((IActivityEdgeInstance) visitor).getEdge();

-		}

+		EObject visitedModelElement = SemanticHelper.getModelElement(visitor);

 		if (visitedModelElement != null) {

 			int i = 0;

 			while (!breakpointExist && i < breakpoints.length) {

diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaDebugTarget.java b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaDebugTarget.java
index df701c2..50bee74 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaDebugTarget.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaDebugTarget.java
@@ -301,7 +301,7 @@
 
 	@Override
 	public String getName() throws DebugException {
-		return "Moka Execution [fUML Application]";
+		return "Moka Execution";
 	}
 
 	@Override
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaThread.java b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaThread.java
index cf6266a..9712a32 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaThread.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/engine/MokaThread.java
@@ -112,7 +112,7 @@
 				this.suspensionRequired = false;
 				try {
 					IAnimation animationService = DebugServiceHelper.INSTANCE.getAnimationService();
-					EObject visitedModelElement = SemanticHelper.getInstance().getModelElement(visitor);
+					EObject visitedModelElement = SemanticHelper.getModelElement(visitor);
 					if (animationService != null) {
 						animationService.renderAs(visitedModelElement, this.object, AnimationKind.SUSPENDED);
 					}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/model/data/mapping/MokaStackFrame.java b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/model/data/mapping/MokaStackFrame.java
index e7e49d9..6b514f5 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/model/data/mapping/MokaStackFrame.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.debug/src/org/eclipse/papyrus/moka/debug/model/data/mapping/MokaStackFrame.java
@@ -24,9 +24,8 @@
 import org.eclipse.papyrus.moka.debug.engine.MokaDebugTarget;

 import org.eclipse.papyrus.moka.debug.model.data.mapping.variables.ExecutionContextVariableAdapter;

 import org.eclipse.papyrus.moka.debug.model.data.mapping.variables.SuspensionPointVariableAdapter;

-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityEdgeInstance;

-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.utils.helper.semantics.SemanticHelper;

 

 public class MokaStackFrame extends MokaDebugElement implements IStackFrame {

 

@@ -158,24 +157,7 @@
 

 	@Override

 	public String getName() throws DebugException {

-		String name = "undefined";

-		ISemanticVisitor visitor = this.owner.getSuspensionPoint();

-		if (visitor != null) {

-			if (visitor instanceof IActivityEdgeInstance) {

-				if (((IActivityEdgeInstance) visitor).getEdge() != null) {

-					name = ((IActivityEdgeInstance) visitor).getEdge().getName() + " [Activity Edge]";

-				} else {

-					name += " [Activity Edge]";

-				}

-			} else if (visitor instanceof IActivityNodeActivation) {

-				if (((IActivityNodeActivation) visitor).getNode() != null) {

-					name = ((IActivityNodeActivation) visitor).getNode().getName() + " [Activity Node]";

-				} else {

-					name += " [Activity Node]";

-				}

-			}

-		}

-		return name;

+		return SemanticHelper.getName(this.owner.getSuspensionPoint());

 	}

 

 	@Override

diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.utils/META-INF/MANIFEST.MF b/bundles/core/tools/org.eclipse.papyrus.moka.utils/META-INF/MANIFEST.MF
index 16a74be..6f2c7ca 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.utils/META-INF/MANIFEST.MF
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.utils/META-INF/MANIFEST.MF
@@ -5,7 +5,8 @@
 Bundle-Version: 2.0.100.qualifier
 Bundle-Activator: org.eclipse.papyrus.moka.utils.Activator
 Bundle-Vendor: Eclipse Modeling Project
-Require-Bundle: org.eclipse.papyrus.moka.fuml.interfaces;bundle-version="2.0.100"
+Require-Bundle: org.eclipse.papyrus.moka.fuml.interfaces;bundle-version="2.0.100",
+ org.eclipse.papyrus.moka.fuml.statemachines.interfaces
 Bundle-RequiredExecutionEnvironment: JavaSE-1.8
 Bundle-ActivationPolicy: lazy
 Export-Package: org.eclipse.papyrus.moka.utils,
diff --git a/bundles/core/tools/org.eclipse.papyrus.moka.utils/src/org/eclipse/papyrus/moka/utils/helper/semantics/SemanticHelper.java b/bundles/core/tools/org.eclipse.papyrus.moka.utils/src/org/eclipse/papyrus/moka/utils/helper/semantics/SemanticHelper.java
index 80e4741..c1f593a 100644
--- a/bundles/core/tools/org.eclipse.papyrus.moka.utils/src/org/eclipse/papyrus/moka/utils/helper/semantics/SemanticHelper.java
+++ b/bundles/core/tools/org.eclipse.papyrus.moka.utils/src/org/eclipse/papyrus/moka/utils/helper/semantics/SemanticHelper.java
@@ -13,36 +13,51 @@
  *****************************************************************************/

 package org.eclipse.papyrus.moka.utils.helper.semantics;

 

-import org.eclipse.emf.ecore.EObject;

 import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityEdgeInstance;

 import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;

 import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IPseudostateActivation;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateActivation;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.IStateMachineSemanticVisitor;

+import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMachines.ITransitionActivation;

+import org.eclipse.uml2.uml.NamedElement;

 

 public class SemanticHelper {

-	

-	private static SemanticHelper INSTANCE = null;

-	

-	private SemanticHelper(){

-		

-	}

-	

-	public static SemanticHelper getInstance(){

-		if(INSTANCE == null){

-			INSTANCE = new SemanticHelper();

-		}

-		return INSTANCE;

-	}

-	

-	public EObject getModelElement(ISemanticVisitor visitor){

+

+	public static NamedElement getModelElement(ISemanticVisitor visitor) {

 		// For a given type of visitor return the visited model element.

 		// It returns null when the visited model element is null.

-		EObject visitedModelElement = null;

-		if(visitor instanceof IActivityNodeActivation){

-			visitedModelElement = ((IActivityNodeActivation)visitor).getNode();

-		}else if(visitor instanceof IActivityEdgeInstance){

-			visitedModelElement = ((IActivityEdgeInstance)visitor).getEdge();

+		NamedElement modelElement = null;

+		if (visitor instanceof IActivityNodeActivation) {

+			modelElement = ((IActivityNodeActivation) visitor).getNode();

+		} else if (visitor instanceof IActivityEdgeInstance) {

+			modelElement = ((IActivityEdgeInstance) visitor).getEdge();

+		} else if (visitor instanceof IStateMachineSemanticVisitor) {

+			modelElement = ((IStateMachineSemanticVisitor) visitor).getNode();

 		}

-		return visitedModelElement;

+		return modelElement;

 	}

-	

+

+	public static String getName(ISemanticVisitor visitor) {

+		String name = "undefined";

+		NamedElement modelElement = getModelElement(visitor);

+		if (modelElement != null) {

+			if(modelElement.getName() != null) {

+				name = modelElement.getName();

+			}

+			if (visitor instanceof IActivityNodeActivation) {

+				name += " [Activity Node]";

+			} else if (visitor instanceof IActivityEdgeInstance) {

+				name += " [Activity Edge]";

+			} else if (visitor instanceof IPseudostateActivation) {

+				name += " [Pseudostate]";

+			} else if (visitor instanceof IStateActivation) {

+				name += " [State]";

+			} else if (visitor instanceof ITransitionActivation) {

+				name += " [Transition]";

+			}

+		}

+		return name;

+	}

+

 }