Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeremie.tatibouet2017-10-10 15:38:05 +0000
committerjeremie.tatibouet2017-10-25 14:03:43 +0000
commit14e703a28ce61fd4c226aef76480d25c7db2fc5a (patch)
tree60d1d5d185ba7d653d5b02dd367544a2433599e9
parent8da67c07e6fb4f922c34741b0e8c76ab958e9ffa (diff)
downloadorg.eclipse.papyrus-moka-14e703a28ce61fd4c226aef76480d25c7db2fc5a.tar.gz
org.eclipse.papyrus-moka-14e703a28ce61fd4c226aef76480d25c7db2fc5a.tar.xz
org.eclipse.papyrus-moka-14e703a28ce61fd4c226aef76480d25c7db2fc5a.zip
[1] Support for operation call dispatching animation over composites
[2] Capability to contribute to the animators with pre and post actions Change-Id: Id6d2b7a155259cefa56ac9afe662712bd592bed2 Signed-off-by: jeremie.tatibouet <jeremie.tatibouet@cea.fr>
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj2
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj165
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF4
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java2
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF1
-rw-r--r--bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java2
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/META-INF/MANIFEST.MF3
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml10
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/schema/animator.exsd18
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/AnimationService.java28
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java23
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/Animator.java87
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/AnimatorExtensionEvaluator.java20
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StateMachineAnimator.java12
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StructuralAnimator.java (renamed from bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java)82
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/DerivedAnimationAction.java36
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/composite/FeatureValueTypeDerivedAnimation.java45
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/AddStructuralFeatureValueActionDerivedAnimation.java44
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/InvocationActionDerivedAnimation.java46
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/AnimationEngine.java26
-rw-r--r--bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/IRenderingEngine.java4
21 files changed, 540 insertions, 120 deletions
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj
index 3c3aed69..b5a37e71 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/InvocationActions/CS_DefaultConstructStrategyProfiler.aj
@@ -16,8 +16,8 @@ package org.eclipse.papyrus.moka.composites.profiling.Semantics.CompositeStructu
import org.eclipse.papyrus.moka.composites.Semantics.impl.CompositeStructures.InvocationActions.CS_DefaultConstructStrategy;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_Reference;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IValue;
- import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;
import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Classes.Kernel.FeatureValueWrapper;
+import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;
import org.eclipse.uml2.uml.Property;
public aspect CS_DefaultConstructStrategyProfiler extends SemanticVisitorProfiler {
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj
index bb61a7f7..3421d9f8 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.composites/aspects/org/eclipse/papyrus/moka/composites/profiling/Semantics/CompositeStructures/StructuredClasses/CS_ObjectProfiler.aj
@@ -27,6 +27,7 @@ import org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications.IE
import org.eclipse.papyrus.moka.fuml.Semantics.impl.Actions.BasicActions.SendSignalActionActivation;
import org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci.SemanticVisitorProfiler;
import org.eclipse.uml2.uml.ConnectorKind;
+import org.eclipse.uml2.uml.Operation;
public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
@@ -49,8 +50,8 @@ public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
before(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
sendIn(object, eventOccurrence, interactionPoint){
// Each time a sendIn(...) is performed this implies the event occurrence is
- // propagated through the interaction point to an internal target. This target is always
- // an interaction point. At this point, the interaction point from which the
+ // propagated through the interaction point to an internal target. This target
+ // is always an interaction point. At this point, the interaction point from which the
// event occurrence flows and the outgoing links are visited. This implies that
// any service listening to the node visited events will get notified about the
// the visit of the interaction points as well as its outgoing links.
@@ -65,11 +66,12 @@ public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
before(ICS_Object object, IEventOccurrence eventOccurrence, ICS_InteractionPoint interactionPoint) :
sendOut(object, eventOccurrence, interactionPoint){
// Each time a sendOut(...) is performed this implies the event occurrences is
- // propagated through the interaction point to the environment of the object. The
- // target of the propagation always is an interaction point. At this point, the
- // interaction point from which the event occurs flows and the outgoing links are
- // visited. This implies that any service listening to the node visited events will
- // get notified about the the visit of the interaction points as well as its outgoing links.
+ // propagated through the interaction point to the environment of the object.
+ // The target of the propagation always is an interaction point. At this point, the
+ // interaction point from which the event occurs flows and the outgoing links
+ // are visited. This implies that any service listening to the node visited events
+ // will get notified about the the visit of the interaction points as well as its
+ // outgoing links.
this.visit(new CS_InteractionPointWrapper(interactionPoint));
Iterator<ICS_ConnectorLink> linkIterator = this
.getTraversedLinkWhenSentOut(object, eventOccurrence, interactionPoint).iterator();
@@ -80,7 +82,8 @@ public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
public List<ICS_ConnectorLink> getTraversedLinkWhenSentIn(ICS_Object object, IEventOccurrence eventOccurrence,
ICS_InteractionPoint interactionPoint) {
- // Find out all links (i.e., runtime manifestation of connectors) that can be traversed
+ // Find out all links (i.e., runtime manifestation of connectors) that can be
+ // traversed
// to propagate the event occurrence when sent to the internals the object.
Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
@@ -97,41 +100,151 @@ public aspect CS_ObjectProfiler extends SemanticVisitorProfiler {
public List<ICS_ConnectorLink> getTraversedLinkWhenSentOut(ICS_Object object, IEventOccurrence eventOccurrence,
ICS_InteractionPoint interactionPoint) {
- // Find out all links (i.e., runtime manifestation of connectors) that can be traversed
- // to propagate the event occurrence when sent to the object environment.
- // Note: in order to accurately notify the services about which links have been traversed,
- // it is required to rely on a RequestPropagationStrategy that when executed two times on the
- // same target list produces the exact same results.
+ // Find out all links (i.e., runtime manifestation of connectors) that can be
+ // traversed to propagate the event occurrence when sent to the object environment.
+ // Note: in order to accurately notify the services about which links have been
+ // traversed, it is required to rely on a RequestPropagationStrategy that when executed two
+ // times on the same target list produces the exact same results.
List<IReference> allPotentialTargets = new ArrayList<IReference>();
List<ICS_ConnectorLink> referencedLink = new ArrayList<ICS_ConnectorLink>();
List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
- while(linkIterator.hasNext()) {
+ while (linkIterator.hasNext()) {
+ boolean referenceLink = false;
+ ICS_Link link = linkIterator.next();
+ Iterator<IReference> referenceIterator = object
+ .selectTargetsForSending(link, interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, false).iterator();
+ while (referenceIterator.hasNext()) {
+ if (!referenceLink) {
+ referenceLink = true;
+ }
+ allPotentialTargets.add(referenceIterator.next());
+ }
+ referenceIterator = object
+ .selectTargetsForSending(link, interactionPoint, ConnectorKind.DELEGATION_LITERAL, false)
+ .iterator();
+ while (referenceIterator.hasNext()) {
+ if (!referenceLink) {
+ referenceLink = true;
+ }
+ allPotentialTargets.add(referenceIterator.next());
+ }
+ if (referenceLink) {
+ referencedLink.add((ICS_ConnectorLink) link);
+ }
+ }
+ CS_RequestPropagationStrategy strategy = (CS_RequestPropagationStrategy) object.getLocus().getFactory()
+ .getStrategy("requestPropagation");
+ List<IReference> selectedTargets = strategy.select(allPotentialTargets, new SendSignalActionActivation());
+ for (IReference target : selectedTargets) {
+ for (ICS_ConnectorLink connectorLink : referencedLink) {
+ if (connectorLink.hasValueForAFeature(target)) {
+ traversedLink.add((ICS_ConnectorLink) connectorLink);
+ }
+ }
+ }
+ return traversedLink;
+ }
+
+ // Listen to any call on CS_Object that results in dispatchIn(...)
+ pointcut dispatchIn(ICS_Object object, Operation operation, ICS_InteractionPoint interactionPoint):
+ target(object) &&
+ args(operation, interactionPoint) &&
+ call(* ICS_Object.dispatchIn(Operation, ICS_InteractionPoint));
+
+ // Listen to any call on CS_Object that results in dispatchOut(...)
+ pointcut dispatchOut(ICS_Object object, Operation operation, ICS_InteractionPoint interactionPoint):
+ target(object) &&
+ args(operation, interactionPoint) &&
+ call(* ICS_Object.dispatchOut(Operation, ICS_InteractionPoint));
+
+
+ before(ICS_Object object, Operation operation, ICS_InteractionPoint interactionPoint) :
+ // Each time a dispatchIn(...) is performed this implies the operation call is
+ // propagated through the interaction point to an internal target. This target
+ // is not always an interaction point. At this point, the interaction point from which the
+ // operation call flows and the outgoing links are visited.
+ dispatchIn(object, operation, interactionPoint){
+ this.visit(new CS_InteractionPointWrapper(interactionPoint));
+ Iterator<ICS_ConnectorLink> linkIterator = this
+ .getTraversedLinkWhenDispatchIn(object, interactionPoint, operation).iterator();
+ while (linkIterator.hasNext()) {
+ this.visit(new CS_ConnectorLinkWrapper(linkIterator.next()));
+ }
+ }
+
+ before(ICS_Object object, Operation operation, ICS_InteractionPoint interactionPoint) :
+ // Each time a dispatchIn(...) is performed this implies the operation call is
+ // propagated through the interaction point to an environment target. This target
+ // is not always an interaction point. At this point, the interaction point from which the
+ // operation call flows and the outgoing links are visited.
+ dispatchOut(object, operation, interactionPoint){
+ this.visit(new CS_InteractionPointWrapper(interactionPoint));
+ Iterator<ICS_ConnectorLink> linkIterator = this
+ .getTraversedLinkWhenDispatchOut(object, interactionPoint, operation).iterator();
+ while (linkIterator.hasNext()) {
+ this.visit(new CS_ConnectorLinkWrapper(linkIterator.next()));
+ }
+ }
+
+ public List<ICS_ConnectorLink> getTraversedLinkWhenDispatchIn(ICS_Object object,
+ ICS_InteractionPoint interactionPoint, Operation operation) {
+ // Find out all links (i.e., runtime manifestation of connectors) that can be
+ // traversed to propagate the operation call when sent to the internals the object.
+ Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
+ List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
+ while (linkIterator.hasNext()) {
+ ICS_Link link = linkIterator.next();
+ List<IReference> targets = object.selectTargetsForDispatching(link, interactionPoint,
+ ConnectorKind.DELEGATION_LITERAL, operation, true);
+ if (!targets.isEmpty()) {
+ traversedLink.add((ICS_ConnectorLink) link);
+ }
+ }
+ return traversedLink;
+ }
+
+ public List<ICS_ConnectorLink> getTraversedLinkWhenDispatchOut(ICS_Object object,
+ ICS_InteractionPoint interactionPoint, Operation operation) {
+ // Find out all links (i.e., runtime manifestation of connectors) that can be
+ // traversed to propagate the operation call when sent to the object environment.
+ // Note: in order to accurately notify the services about which links have been
+ // traversed, it is required to rely on a RequestPropagationStrategy that when
+ // executed two times on the same target list produces the exact same results.
+ List<IReference> allPotentialTargets = new ArrayList<IReference>();
+ List<ICS_ConnectorLink> referencedLink = new ArrayList<ICS_ConnectorLink>();
+ List<ICS_ConnectorLink> traversedLink = new ArrayList<ICS_ConnectorLink>();
+ Iterator<ICS_Link> linkIterator = object.getLinks(interactionPoint).iterator();
+ while (linkIterator.hasNext()) {
boolean referenceLink = false;
ICS_Link link = linkIterator.next();
- Iterator<IReference> referenceIterator = object.selectTargetsForSending(link, interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, false).iterator();
- while(referenceIterator.hasNext()) {
- if(!referenceLink) {
+ Iterator<IReference> referenceIterator = object
+ .selectTargetsForDispatching(link, interactionPoint, ConnectorKind.ASSEMBLY_LITERAL, operation, false).iterator();
+ while (referenceIterator.hasNext()) {
+ if (!referenceLink) {
referenceLink = true;
}
allPotentialTargets.add(referenceIterator.next());
}
- referenceIterator = object.selectTargetsForSending(link, interactionPoint, ConnectorKind.DELEGATION_LITERAL, false).iterator();
- while(referenceIterator.hasNext()) {
- if(!referenceLink) {
+ referenceIterator = object
+ .selectTargetsForDispatching(link, interactionPoint, ConnectorKind.DELEGATION_LITERAL, operation, false)
+ .iterator();
+ while (referenceIterator.hasNext()) {
+ if (!referenceLink) {
referenceLink = true;
}
allPotentialTargets.add(referenceIterator.next());
}
- if(referenceLink) {
- referencedLink.add((ICS_ConnectorLink)link);
+ if (referenceLink) {
+ referencedLink.add((ICS_ConnectorLink) link);
}
}
- CS_RequestPropagationStrategy strategy = (CS_RequestPropagationStrategy) object.getLocus().getFactory().getStrategy("requestPropagation");
+ CS_RequestPropagationStrategy strategy = (CS_RequestPropagationStrategy) object.getLocus().getFactory()
+ .getStrategy("requestPropagation");
List<IReference> selectedTargets = strategy.select(allPotentialTargets, new SendSignalActionActivation());
- for(IReference target : selectedTargets){
- for(ICS_ConnectorLink connectorLink : referencedLink) {
- if(connectorLink.hasValueForAFeature(target)) {
+ for (IReference target : selectedTargets) {
+ for (ICS_ConnectorLink connectorLink : referencedLink) {
+ if (connectorLink.hasValueForAFeature(target)) {
traversedLink.add((ICS_ConnectorLink) connectorLink);
}
}
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
index 4baf1fea..1b8c1a91 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/META-INF/MANIFEST.MF
@@ -12,6 +12,7 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.13.0,4.0.0)";visibil
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.moka.fuml.Profiling,
+ org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes,
org.eclipse.papyrus.moka.fuml.Semantics,
org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions,
org.eclipse.papyrus.moka.fuml.Semantics.Actions.CompleteActions,
@@ -22,5 +23,4 @@ Export-Package: org.eclipse.papyrus.moka.fuml.Profiling,
org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel,
org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.BasicBehaviors,
org.eclipse.papyrus.moka.fuml.Semantics.CommonBehaviors.Communications,
- org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1,
- org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes
+ org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java
index 0bba62b6..a90c62c9 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml.interfaces/src/org/eclipse/papyrus/moka/fuml/Profiling/Semantics/Kernel/Classes/IFeatureValueWrapper.java
@@ -12,7 +12,7 @@
*
*****************************************************************************/
-package org.eclipse.papyrus.moka.fuml.profiling.Semantics.Kernel.Classes;
+package org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IObject_;
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
index 0f7addb3..433c0c97 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/META-INF/MANIFEST.MF
@@ -25,6 +25,7 @@ Export-Package: org.eclipse.papyrus.moka.fuml;uses:="org.eclipse.ui.plugin,org.o
org.eclipse.papyrus.moka.fuml.profiling.Semantics.Actions.BasicActions,
org.eclipse.papyrus.moka.fuml.profiling.Semantics.Actions.CompleteActions,
org.eclipse.papyrus.moka.fuml.profiling.Semantics.Activities.IntermediateActivities,
+ org.eclipse.papyrus.moka.fuml.profiling.Semantics.Classes.Kernel,
org.eclipse.papyrus.moka.fuml.profiling.Semantics.CommonBehaviors.Communications,
org.eclipse.papyrus.moka.fuml.profiling.Semantics.Loci,
org.eclipse.papyrus.moka.fuml.registry,
diff --git a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java
index 93a67e07..0302f6d1 100644
--- a/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java
+++ b/bundles/core/engines/org.eclipse.papyrus.moka.fuml/aspects/org/eclipse/papyrus/moka/fuml/profiling/Semantics/Classes/Kernel/FeatureValueWrapper.java
@@ -18,7 +18,7 @@ import java.util.List;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
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.profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
+import org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
import org.eclipse.uml2.uml.StructuralFeature;
public class FeatureValueWrapper implements IFeatureValueWrapper{
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/META-INF/MANIFEST.MF b/bundles/core/services/org.eclipse.papyrus.moka.animation/META-INF/MANIFEST.MF
index ea1785cc..8e50d3b9 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/META-INF/MANIFEST.MF
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/META-INF/MANIFEST.MF
@@ -21,7 +21,8 @@ Require-Bundle: org.eclipse.ui;bundle-version="[3.109.0,4.0.0)",
org.eclipse.papyrus.moka.service;bundle-version="2.0.100";visibility:=reexport,
org.eclipse.papyrus.moka.utils;bundle-version="2.0.100",
org.eclipse.papyrus.moka.utils.ui;bundle-version="2.0.100",
- org.eclipse.papyrus.moka.fuml.statemachines.interfaces;bundle-version="1.0.100"
+ org.eclipse.papyrus.moka.fuml.statemachines.interfaces;bundle-version="1.0.100",
+ org.eclipse.papyrus.moka.fuml.interfaces
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Export-Package: org.eclipse.papyrus.moka.animation,
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml b/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
index 424e186b..ff133a96 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/plugin.xml
@@ -74,10 +74,18 @@
<animator
class="org.eclipse.papyrus.moka.animation.engine.animators.ActivityAnimator"
priority="0">
+ <derivedAnimationAction
+ class="org.eclipse.papyrus.moka.animation.engine.animators.actions.fuml.InvocationActionDerivedAnimation"></derivedAnimationAction>
+ <derivedAnimationAction
+ class="org.eclipse.papyrus.moka.animation.engine.animators.actions.fuml.AddStructuralFeatureValueActionDerivedAnimation">
+ </derivedAnimationAction>
</animator>
<animator
- class="org.eclipse.papyrus.moka.animation.engine.animators.CompositeAnimator"
+ class="org.eclipse.papyrus.moka.animation.engine.animators.StructuralAnimator"
priority="0">
+ <derivedAnimationAction
+ class="org.eclipse.papyrus.moka.animation.engine.animators.actions.composite.FeatureValueTypeDerivedAnimation">
+ </derivedAnimationAction>
</animator>
</extension>
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/schema/animator.exsd b/bundles/core/services/org.eclipse.papyrus.moka.animation/schema/animator.exsd
index e3e5b9a2..a9332e38 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/schema/animator.exsd
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/schema/animator.exsd
@@ -57,6 +57,9 @@
</documentation>
</annotation>
<complexType>
+ <sequence minOccurs="0" maxOccurs="unbounded">
+ <element ref="derivedAnimationAction"/>
+ </sequence>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
@@ -77,6 +80,21 @@
</complexType>
</element>
+ <element name="derivedAnimationAction">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
<annotation>
<appinfo>
<meta.section type="since"/>
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/AnimationService.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/AnimationService.java
index cf9a5dca..1a918150 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/AnimationService.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/AnimationService.java
@@ -103,21 +103,33 @@ public class AnimationService extends AbstractMokaService implements IAnimation,
@Override
public void valueCreated(IValue value) {
- if (value instanceof IObject_) {
- DiagramHandler diagramHandler = this.engine.getDiagramHandler();
- if (!diagramHandler.isRegistered((IObject_) value)) {
- Set<Diagram> relatedDiagrams = diagramHandler.findDiagramsInvolved((IObject_) value);
- for (Diagram diagram : relatedDiagrams) {
- diagramHandler.addRenderable((IObject_) value, diagram);
+ if (MokaConstants.MOKA_AUTOMATIC_ANIMATION) {
+ if (value instanceof IObject_) {
+ DiagramHandler diagramHandler = this.engine.getDiagramHandler();
+ if (!diagramHandler.isRegistered((IObject_) value)) {
+ Set<Diagram> relatedDiagrams = diagramHandler.findDiagramsInvolved((IObject_) value);
+ for (Diagram diagram : relatedDiagrams) {
+ diagramHandler.addRenderable((IObject_) value, diagram);
+ }
}
}
+ Animator animator = this.getAnimator(value);
+ if (animator != null) {
+ animator.valueCreated(value);
+ }
}
}
@Override
public void valueDestroyed(IValue value) {
- if (value instanceof IObject_) {
- this.engine.getDiagramHandler().deleteRenderable((IObject_) value);
+ if (MokaConstants.MOKA_AUTOMATIC_ANIMATION) {
+ if (value instanceof IObject_) {
+ this.engine.getDiagramHandler().deleteRenderable((IObject_) value);
+ }
+ Animator animator = this.getAnimator(value);
+ if (animator != null) {
+ animator.valueDestroyed(value);
+ }
}
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
index 8da194f7..2c040204 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/ActivityAnimator.java
@@ -18,13 +18,11 @@ import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities
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.constants.MokaConstants;
-import org.eclipse.uml2.uml.ActivityNode;
-import org.eclipse.uml2.uml.SendSignalAction;
public class ActivityAnimator extends Animator{
@Override
- public void nodeVisited(ISemanticVisitor nodeVisitor) {
+ public void nodeVisited_(ISemanticVisitor nodeVisitor) {
// When a node is visited by the execution engine, the following animation logic applies:
// 1] If the visitor is for an activity node then if its an accept event action or a call action then the
// representation of this node gets the ANIMATED style applied. If it is any other kind of activity
@@ -35,9 +33,9 @@ public class ActivityAnimator extends Animator{
IActivityNodeActivation activation = (IActivityNodeActivation) nodeVisitor;
if (activation.getNode() != null) {
if (activation instanceof IAcceptEventActionActivation | activation instanceof ICallActionActivation) {
- this.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.ANIMATED);
+ this.engine.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.ANIMATED);
} else {
- this.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ this.engine.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
}
}
} else{
@@ -51,7 +49,7 @@ public class ActivityAnimator extends Animator{
}
@Override
- public void nodeLeft(ISemanticVisitor nodeVisitor) {
+ public void nodeLeft_(ISemanticVisitor nodeVisitor) {
// When a node is left by the execution engine (i.e., the execution of this node is done), the following
// animation logic applies.
// 1] If the visitor is for a node that is either an accept event action or a call action then the VISITED
@@ -60,13 +58,13 @@ public class ActivityAnimator extends Animator{
if (nodeVisitor instanceof IActivityNodeActivation) {
IActivityNodeActivation activation = (IActivityNodeActivation) nodeVisitor;
if (activation.getNode() != null && (activation instanceof IAcceptEventActionActivation | activation instanceof ICallActionActivation)) {
- this.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.VISITED);
+ this.engine.renderAs(activation.getNode(), activation.getExecutionContext(), AnimationKind.VISITED);
}
} else {
if (nodeVisitor instanceof IActivityEdgeInstance) {
IActivityEdgeInstance edgeInstance = (IActivityEdgeInstance) nodeVisitor;
if (edgeInstance.getEdge() != null) {
- this.renderAs(edgeInstance.getEdge(), edgeInstance.getGroup().getActivityExecution().getContext(), AnimationKind.VISITED);
+ this.engine.renderAs(edgeInstance.getEdge(), edgeInstance.getGroup().getActivityExecution().getContext(), AnimationKind.VISITED);
}
}
}
@@ -78,14 +76,7 @@ public class ActivityAnimator extends Animator{
// by this animator to perform animation.
boolean accept = false;
if(visitor instanceof IActivityNodeActivation){
- ActivityNode activityNode = ((IActivityNodeActivation) visitor).getNode();
- if(!(activityNode instanceof SendSignalAction)) {
- accept = true;
- } else {
- if(((SendSignalAction)activityNode).getOnPort() == null) {
- accept = true;
- }
- }
+ accept = true;
}else if (visitor instanceof IActivityEdgeInstance) {
accept = true;
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/Animator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/Animator.java
index 56797afb..00c7382a 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/Animator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/Animator.java
@@ -11,21 +11,28 @@
*****************************************************************************/
package org.eclipse.papyrus.moka.animation.engine.animators;
-import org.eclipse.emf.ecore.EObject;
+import java.util.List;
+
+import org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction;
import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationEngine;
-import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
-import org.eclipse.papyrus.moka.animation.engine.rendering.IAnimation;
-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.service.IMokaExecutionListener;
-public abstract class Animator implements IMokaExecutionListener, IAnimation{
+public abstract class Animator implements IMokaExecutionListener{
+ // The animation engine associated to the animator
protected AnimationEngine engine;
+ // The priority of this animator (used to resolve conflicts
+ // in case two animator can be elected to animate the same type
+ // of element).
protected int priority;
+ // The list of actions to be executed in addition to the
+ // animation an element type
+ protected List<DerivedAnimationAction> derivedAnimationAction;
+
public AnimationEngine getAnimationEngine(){
return this.engine;
}
@@ -42,40 +49,64 @@ public abstract class Animator implements IMokaExecutionListener, IAnimation{
this.priority = priority;
}
+ public void setDerivedAnimationAction(List<DerivedAnimationAction> derivedAnimationActions) {
+ this.derivedAnimationAction = derivedAnimationActions;
+ }
+
+ public List<DerivedAnimationAction> getDerivedAnimationAction(){
+ return this.derivedAnimationAction;
+ }
+
+ // Constrain the set of element type that can be animated by
+ // this animator
public abstract boolean accept(ISemanticVisitor visitor);
@Override
- public void valueCreated(IValue value) {
- // Do nothing
+ public void nodeVisited(ISemanticVisitor nodeVisitor) {
+ // Apply PRE and POST actions attached to the animator when
+ // an acceptable node is visited.
+ for(DerivedAnimationAction derivedAction : this.derivedAnimationAction) {
+ if(derivedAction.accept(nodeVisitor)) {
+ derivedAction.preVisitAction(this.engine, nodeVisitor);
+ }
+ }
+ this.nodeVisited_(nodeVisitor);
+ for(DerivedAnimationAction derivedAction : this.derivedAnimationAction) {
+ if(derivedAction.accept(nodeVisitor)) {
+ derivedAction.postVisitAction(this.engine, nodeVisitor);
+ }
+ }
}
-
+
+ public abstract void nodeVisited_(ISemanticVisitor nodeVisitor);
+
@Override
- public void valueDestroyed(IValue value) {
- // Do nothing
+ public final void nodeLeft(ISemanticVisitor nodeVisitor) {
+ // Apply PRE and POST actions attached to the animator when
+ // an acceptable node is left.
+ for(DerivedAnimationAction derivedAction : this.derivedAnimationAction) {
+ if(derivedAction.accept(nodeVisitor)) {
+ derivedAction.preLeftAction(this.engine, nodeVisitor);
+ }
+ }
+ this.nodeLeft_(nodeVisitor);
+ for(DerivedAnimationAction derivedAction : this.derivedAnimationAction) {
+ if(derivedAction.accept(nodeVisitor)) {
+ derivedAction.postLeftAction(this.engine, nodeVisitor);
+ }
+ }
}
+ public abstract void nodeLeft_(ISemanticVisitor nodeVisitor);
+
@Override
- public void renderAs(EObject modelElement, IObject_ object, AnimationKind targetStyle) {
- // Apply the style to model element if the context is allowed to perform animation.
- this.engine.removeRenderingRules(modelElement);
- this.engine.startRendering(modelElement, object, targetStyle);
+ public void valueCreated(IValue value) {
+ // Do nothing
}
@Override
- public void renderAs(EObject modelElement, IObject_ object, AnimationKind sourceStyle, AnimationKind targetStyle, int duration) {
- // Apply the source style to model element during the specified duration. As soon as this period of time as elapsed then
- // the target style is applied to the model element.
- this.engine.removeRenderingRules(modelElement);
- this.engine.startRendering(modelElement, object, sourceStyle);
- if(duration >= 25){
- try {
- Thread.sleep(duration);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }
- }
- this.engine.stopRendering(modelElement, object, sourceStyle);
- this.engine.startRendering(modelElement, object, targetStyle);
+ public void valueDestroyed(IValue value) {
+ // Do nothing
}
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/AnimatorExtensionEvaluator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/AnimatorExtensionEvaluator.java
index 0dee5495..db64a363 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/AnimatorExtensionEvaluator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/AnimatorExtensionEvaluator.java
@@ -18,6 +18,7 @@ import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction;
import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationEngine;
public class AnimatorExtensionEvaluator {
@@ -27,7 +28,9 @@ public class AnimatorExtensionEvaluator {
private static final String PRIORITY_ATTR = "priority";
private static final String CLASS_ATTR = "class";
-
+
+ private static final String DERIVED_ACTIONS_ATTR = "derivedAnimationAction";
+
public static List<Animator> evaluateAnimators(AnimationEngine engine){
// Evaluate all contributions to the ANIMATOR extension points. The evaluation
// process includes the instantiation of the contributed animator classes as
@@ -57,9 +60,24 @@ public class AnimatorExtensionEvaluator {
}else{
animator.setPriority(0);
}
+ animator.setDerivedAnimationAction(evaluateDerivedActions(contribution.getChildren(DERIVED_ACTIONS_ATTR)));
animators.add(animator);
}
}
return animators;
}
+
+ private static List<DerivedAnimationAction> evaluateDerivedActions(final IConfigurationElement[] contributions){
+ List<DerivedAnimationAction> derivedActions = new ArrayList<DerivedAnimationAction>();
+ for(IConfigurationElement contribution : contributions) {
+ DerivedAnimationAction derivedAction = null;
+ try {
+ derivedAction = (DerivedAnimationAction) contribution.createExecutableExtension(CLASS_ATTR);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ }
+ derivedActions.add(derivedAction);
+ }
+ return derivedActions;
+ }
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StateMachineAnimator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StateMachineAnimator.java
index 3e3ca05b..a15c9b74 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StateMachineAnimator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StateMachineAnimator.java
@@ -19,40 +19,40 @@ import org.eclipse.papyrus.moka.fuml.statemachines.interfaces.Semantics.StateMac
public class StateMachineAnimator extends Animator{
@Override
- public void nodeVisited(ISemanticVisitor nodeVisitor) {
+ public void nodeVisited_(ISemanticVisitor nodeVisitor) {
// When the visitor is for a visited state machine model element the following animation logic applies.
// 1] If the visitor is for a transition then the ANIMATED style gets applied
// 2] If the visitor is for a vertex then the ANIMATED style gets applied
if(nodeVisitor instanceof ITransitionActivation){
ITransitionActivation transitionActivation = (ITransitionActivation) nodeVisitor;
if(transitionActivation.getNode() != null){
- this.renderAs(transitionActivation.getNode(), transitionActivation.getExecutionContext(), AnimationKind.ANIMATED);
+ this.engine.renderAs(transitionActivation.getNode(), transitionActivation.getExecutionContext(), AnimationKind.ANIMATED);
}
} else {
if(nodeVisitor instanceof IVertexActivation){
IVertexActivation vertexActivation = (IVertexActivation) nodeVisitor;
if(vertexActivation.getNode() != null){
- this.renderAs(vertexActivation.getNode(), vertexActivation.getExecutionContext(), AnimationKind.ANIMATED);
+ this.engine.renderAs(vertexActivation.getNode(), vertexActivation.getExecutionContext(), AnimationKind.ANIMATED);
}
}
}
}
@Override
- public void nodeLeft(ISemanticVisitor nodeVisitor) {
+ public void nodeLeft_(ISemanticVisitor nodeVisitor) {
// When the visitor is for a left state machine model element the following animation logic applies.
// 1] If the visitor is for a transition then the VISITED style gets applied
// 2] If the visitor is for a vertex then the VISITED style gets applied
if(nodeVisitor instanceof ITransitionActivation){
ITransitionActivation transitionActivation = (ITransitionActivation) nodeVisitor;
if(transitionActivation.getNode() != null){
- this.renderAs(transitionActivation.getNode(), transitionActivation.getExecutionContext(), AnimationKind.VISITED);
+ this.engine.renderAs(transitionActivation.getNode(), transitionActivation.getExecutionContext(), AnimationKind.VISITED);
}
} else {
if(nodeVisitor instanceof IVertexActivation) {
IVertexActivation vertexActivation = (IVertexActivation) nodeVisitor;
if(vertexActivation.getNode() != null){
- this.renderAs(vertexActivation.getNode(), vertexActivation.getExecutionContext(), AnimationKind.VISITED);
+ this.engine.renderAs(vertexActivation.getNode(), vertexActivation.getExecutionContext(), AnimationKind.VISITED);
}
}
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StructuralAnimator.java
index e4f1c73f..4fd5612a 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/CompositeAnimator.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/StructuralAnimator.java
@@ -13,65 +13,93 @@
package org.eclipse.papyrus.moka.animation.engine.animators;
+import java.util.Iterator;
+import java.util.List;
+
import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
import org.eclipse.papyrus.moka.composites.interfaces.Semantics.CompositeStructures.StructuredClasses.ICS_InteractionPoint;
import org.eclipse.papyrus.moka.composites.interfaces.extensions.Semantics.CompositeStructures.StructuredClasses.ICS_ConnectorLink;
-import org.eclipse.papyrus.moka.fuml.Semantics.Activities.IntermediateActivities.IActivityNodeActivation;
+import org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
+import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IExtensionalValue;
import org.eclipse.papyrus.moka.fuml.Semantics.Classes.Kernel.IFeatureValue;
+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.profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
-import org.eclipse.uml2.uml.SendSignalAction;
import org.eclipse.uml2.uml.Type;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
-public class CompositeAnimator extends Animator {
+public class StructuralAnimator extends Animator {
@Override
- public void nodeVisited(ISemanticVisitor nodeVisitor) {
+ public void nodeVisited_(ISemanticVisitor nodeVisitor) {
if (nodeVisitor instanceof ICS_InteractionPoint) {
// If the visited element is the runtime manifestation of a port then it is
// animated and then after the specified delay marked as visited.
- this.renderAs(((ICS_InteractionPoint) nodeVisitor).getDefiningPort(),
+ this.engine.renderAs(((ICS_InteractionPoint) nodeVisitor).getDefiningPort(),
((ICS_InteractionPoint) nodeVisitor).getOwner().getReferent(), AnimationKind.ANIMATED,
AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
} else if (nodeVisitor instanceof ICS_ConnectorLink) {
// If the visited element is the runtime manifestation of a connector then it
// animated and then after the specified delay marked as visited.
- this.renderAs(((ICS_ConnectorLink) nodeVisitor).getConnector(), null, AnimationKind.ANIMATED,
+ this.engine.renderAs(((ICS_ConnectorLink) nodeVisitor).getConnector(), null, AnimationKind.ANIMATED,
AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
- } else if(nodeVisitor instanceof IFeatureValueWrapper) {
- // If the visited element is a structural feature newly associated to values then
- // two different animation behavior can occur:
+ } else if (nodeVisitor instanceof IFeatureValueWrapper) {
+ // If the visited element is a structural feature newly associated to values
+ // then two different animation behavior can occur:
// 1] The structural feature has a type that is an active class then the feature
- // is marked as being animated (i.e., it is currently executed).
+ // is marked as being animated (i.e., it is currently executed).
// 2] The structural feature is not typed by an active class then the feature is
- // marked as being visited (i.e., it is not currently executing)
+ // marked as being visited (i.e., it is not currently executing)
IFeatureValueWrapper featureValue = (IFeatureValueWrapper) nodeVisitor;
Type type = featureValue.getFeature().getType();
- if(type instanceof Class && ((Class)type).isActive()) {
- this.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.ANIMATED);
+ if (type instanceof Class && ((Class) type).isActive()) {
+ this.engine.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.ANIMATED);
} else {
- this.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.VISITED);
+ this.engine.renderAs(featureValue.getFeature(), featureValue.getContext(), AnimationKind.VISITED);
}
- } else if (nodeVisitor instanceof IActivityNodeActivation
- && ((IActivityNodeActivation) nodeVisitor).getNode() instanceof SendSignalAction) {
- // If the visited element is a SendSignalAction with the property 'onPort' specified
- // then it is animated and after the certain delay marked as visited.
- SendSignalAction sendSignalAction = (SendSignalAction) ((IActivityNodeActivation) nodeVisitor).getNode();
- this.renderAs(sendSignalAction, ((IActivityNodeActivation) nodeVisitor).getExecutionContext(),
- AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
- this.renderAs(sendSignalAction.getOnPort(), ((IActivityNodeActivation) nodeVisitor).getExecutionContext(),
- AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
}
}
@Override
- public void nodeLeft(ISemanticVisitor nodeVisitor) {
+ public void nodeLeft_(ISemanticVisitor nodeVisitor) {
// Do nothing
}
@Override
+ public void valueCreated(IValue value) {
+ // Whenever an object is created, the classes typing this object are
+ // animated. If a class is active then it remains in the ANIMATED state
+ // while if it is passive it remains in the VISITED state
+ IObject_ object = (IObject_) value;
+ for (Classifier classifier : object.getTypes()) {
+ Class clazz = (Class) classifier;
+ if (clazz.isActive()) {
+ this.engine.renderAs(clazz, object, AnimationKind.ANIMATED);
+ } else {
+ this.engine.renderAs(clazz, object, AnimationKind.VISITED);
+ }
+ }
+ }
+
+ @Override
+ public void valueDestroyed(IValue value) {
+ // Whenever an object is destroyed, if there are no other objects
+ // in the locus that are classified under the same types are displayed
+ // according to their original style
+ IObject_ object = (IObject_) value;
+ Iterator<Classifier> classifierIterator = object.getTypes().iterator();
+ while (classifierIterator.hasNext()) {
+ Classifier classifier = classifierIterator.next();
+ List<IExtensionalValue> extensionalValues = object.getLocus().getExtent(classifierIterator.next());
+ if(!extensionalValues.isEmpty()) {
+ this.engine.removeRenderingRules(classifier);
+ }
+ }
+ }
+
+ @Override
public boolean accept(ISemanticVisitor visitor) {
// The composite animator enables the following nodes to be animated:
// any feature value with newly associated value, connector and send signal
@@ -82,9 +110,7 @@ public class CompositeAnimator extends Animator {
return true;
} else if (visitor instanceof IFeatureValue) {
return true;
- } else if (visitor instanceof IActivityNodeActivation
- && ((IActivityNodeActivation) visitor).getNode() instanceof SendSignalAction
- && ((SendSignalAction) ((IActivityNodeActivation) visitor).getNode()).getOnPort() != null) {
+ } else if (visitor instanceof IObject_) {
return true;
}
return false;
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/DerivedAnimationAction.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/DerivedAnimationAction.java
new file mode 100644
index 00000000..376e955e
--- /dev/null
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/DerivedAnimationAction.java
@@ -0,0 +1,36 @@
+package org.eclipse.papyrus.moka.animation.engine.animators.actions;
+
+import org.eclipse.papyrus.moka.animation.engine.rendering.IRenderingEngine;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+
+public abstract class DerivedAnimationAction {
+
+ public void preVisitAction(final IRenderingEngine engine, final ISemanticVisitor visitor) {
+ // Default implementation does nothing.
+ // Called before the animation performed upon the visit of the element referenced
+ // by the visitor
+ }
+
+ public void postVisitAction(final IRenderingEngine engine, final ISemanticVisitor visitor) {
+ // Default implementation does nothing
+ // Called after the animation performed upon the visit of the element referenced
+ // by the visitor
+ }
+
+ public void preLeftAction(final IRenderingEngine engine, final ISemanticVisitor visitor) {
+ // Default implementation does nothing
+ // Called before the animation performed upon leaving the element referenced
+ // by the visitor'
+ }
+
+ public void postLeftAction(final IRenderingEngine engine, final ISemanticVisitor visitor) {
+ // Default implementation does nothing
+ // Called after the animation performed upon leaving the element referenced
+ // by the visitor
+ }
+
+ // Define condition upon which the derived animation action is applied.
+ // This operation shall be implemented by sub-classes.
+ public abstract boolean accept(final ISemanticVisitor visitor);
+
+}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/composite/FeatureValueTypeDerivedAnimation.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/composite/FeatureValueTypeDerivedAnimation.java
new file mode 100644
index 00000000..9b0855a5
--- /dev/null
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/composite/FeatureValueTypeDerivedAnimation.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.animation.engine.animators.actions.composite;
+
+import org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction;
+import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
+import org.eclipse.papyrus.moka.animation.engine.rendering.IRenderingEngine;
+import org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes.IFeatureValueWrapper;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.uml2.uml.Type;
+import org.eclipse.uml2.uml.Class;
+
+public class FeatureValueTypeDerivedAnimation extends DerivedAnimationAction{
+
+ public void postVisitAction(final IRenderingEngine engine, ISemanticVisitor visitor) {
+ // Enable the animation of the type of the new value
+ org.eclipse.papyrus.moka.fuml.Profiling.Semantics.Kernel.Classes.IFeatureValueWrapper featureValue = (IFeatureValueWrapper) visitor;
+ Type type = featureValue.getFeature().getType();
+ if(type instanceof Class && ((Class)type).isActive()) {
+ engine.renderAs(type, featureValue.getContext(), AnimationKind.ANIMATED);
+ }else {
+ engine.renderAs(type, featureValue.getContext(), AnimationKind.VISITED);
+ }
+ }
+
+ @Override
+ public boolean accept(ISemanticVisitor visitor) {
+ // If the visitor is for a FeatureValue with new values
+ if(visitor instanceof IFeatureValueWrapper) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/AddStructuralFeatureValueActionDerivedAnimation.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/AddStructuralFeatureValueActionDerivedAnimation.java
new file mode 100644
index 00000000..819bb625
--- /dev/null
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/AddStructuralFeatureValueActionDerivedAnimation.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.animation.engine.animators.actions.fuml;
+
+import org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction;
+import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
+import org.eclipse.papyrus.moka.animation.engine.rendering.IRenderingEngine;
+import org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions.IActionActivation;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.uml2.uml.AddStructuralFeatureValueAction;
+
+public class AddStructuralFeatureValueActionDerivedAnimation extends DerivedAnimationAction {
+
+ @Override
+ public void postVisitAction(IRenderingEngine engine, ISemanticVisitor visitor) {
+ // Enable the animation of the represented feature
+ AddStructuralFeatureValueAction action = (AddStructuralFeatureValueAction) ((IActionActivation) visitor)
+ .getNode();
+ engine.renderAs(action.getStructuralFeature(), ((IActionActivation) visitor).getExecutionContext(),
+ AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ }
+
+ @Override
+ public boolean accept(ISemanticVisitor visitor) {
+ // If the visitor is for an AddStructuralfeatureValueAction
+ if (visitor instanceof IActionActivation
+ && ((IActionActivation) visitor).getNode() instanceof AddStructuralFeatureValueAction) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/InvocationActionDerivedAnimation.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/InvocationActionDerivedAnimation.java
new file mode 100644
index 00000000..9ad9c4b7
--- /dev/null
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/animators/actions/fuml/InvocationActionDerivedAnimation.java
@@ -0,0 +1,46 @@
+/*****************************************************************************
+ * Copyright (c) 2017 CEA LIST.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * CEA LIST Initial API and implementation
+ *****************************************************************************/
+
+package org.eclipse.papyrus.moka.animation.engine.animators.actions.fuml;
+
+import org.eclipse.papyrus.moka.animation.engine.animators.actions.DerivedAnimationAction;
+import org.eclipse.papyrus.moka.animation.engine.rendering.AnimationKind;
+import org.eclipse.papyrus.moka.animation.engine.rendering.IRenderingEngine;
+import org.eclipse.papyrus.moka.fuml.Semantics.Actions.BasicActions.IActionActivation;
+import org.eclipse.papyrus.moka.fuml.Semantics.Loci.LociL1.ISemanticVisitor;
+import org.eclipse.papyrus.moka.utils.constants.MokaConstants;
+import org.eclipse.uml2.uml.InvocationAction;
+
+public final class InvocationActionDerivedAnimation extends DerivedAnimationAction {
+
+ @Override
+ public void postVisitAction(final IRenderingEngine engine, final ISemanticVisitor visitor) {
+ // After the InvocationAction was visited then animate the
+ // referenced port
+ InvocationAction action = (InvocationAction) ((IActionActivation) visitor).getNode();
+ engine.renderAs(action.getOnPort(), ((IActionActivation) visitor).getExecutionContext(),
+ AnimationKind.ANIMATED, AnimationKind.VISITED, MokaConstants.MOKA_ANIMATION_DELAY);
+ }
+
+ @Override
+ public boolean accept(final ISemanticVisitor visitor) {
+ // If the source model element is an InvocationAction and its
+ // 'onPort' property is set the return true otherwise return
+ // false
+ if (visitor instanceof IActionActivation && ((IActionActivation) visitor).getNode() instanceof InvocationAction
+ && ((InvocationAction) ((IActionActivation) visitor).getNode()).getOnPort() != null) {
+ return true;
+ }
+ return false;
+ }
+
+}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/AnimationEngine.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/AnimationEngine.java
index 97f8d249..7ffac100 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/AnimationEngine.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/AnimationEngine.java
@@ -284,4 +284,30 @@ public class AnimationEngine implements IRenderingEngine {
this.modelElementMarkers.get(modelElement).clear();
}
}
+
+ @Override
+ public void renderAs(EObject modelElement, IObject_ object, AnimationKind targetStyle) {
+ // Apply the style to model element if the context is allowed to perform animation.
+ this.removeRenderingRules(modelElement);
+ this.startRendering(modelElement, object, targetStyle);
+ }
+
+ @Override
+ public void renderAs(EObject modelElement, IObject_ object, AnimationKind sourceStyle, AnimationKind targetStyle,
+ int duration) {
+ // Apply the source style to model element during the specified duration. As soon as this period of time as elapsed then
+ // the target style is applied to the model element.
+ this.removeRenderingRules(modelElement);
+ this.startRendering(modelElement, object, sourceStyle);
+ if(duration >= 25){
+ try {
+ Thread.sleep(duration);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ this.stopRendering(modelElement, object, sourceStyle);
+ this.startRendering(modelElement, object, targetStyle);
+
+ }
}
diff --git a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/IRenderingEngine.java b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/IRenderingEngine.java
index 4b2cae38..8ab620a4 100644
--- a/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/IRenderingEngine.java
+++ b/bundles/core/services/org.eclipse.papyrus.moka.animation/src/org/eclipse/papyrus/moka/animation/engine/rendering/IRenderingEngine.java
@@ -24,4 +24,8 @@ public interface IRenderingEngine {
public void stopRendering(EObject modelElement, IObject_ animator, AnimationKind kind);
+ public void renderAs(EObject modelElement, IObject_ object, AnimationKind targetStyle);
+
+ public void renderAs(EObject modelElement, IObject_ object, AnimationKind sourceStyle, AnimationKind targetStyle, int duration);
+
}

Back to the top