Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2013-10-08 12:31:49 +0000
committerAnsgar Radermacher2013-10-08 12:37:31 +0000
commit41b8ae9d892fe5b05983c1c04dfa35a07b193980 (patch)
tree2c110bcd6c0b73650019e507724883ed079102ae /extraplugins
parent3e2bf7f6dab3baa0b074ce1a613f1077613b7a13 (diff)
downloadorg.eclipse.papyrus-41b8ae9d892fe5b05983c1c04dfa35a07b193980.tar.gz
org.eclipse.papyrus-41b8ae9d892fe5b05983c1c04dfa35a07b193980.tar.xz
org.eclipse.papyrus-41b8ae9d892fe5b05983c1c04dfa35a07b193980.zip
- Restructuring (StUtils => StereotypeUtil of Papyrus)
- Cleanup of copy code (less exceptions)
Diffstat (limited to 'extraplugins')
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/.project12
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/ConfigUtils.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/PortUtils.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/StUtils.java289
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/Utils.java7
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/UMLTool.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java14
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java29
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java8
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/AllocationDialog.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ChooseConfigOpt.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConfigurePortDialog.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConnectorSelectionDialog.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ContainerDialog.java10
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AddProfileAndModelLibsHandler.java33
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AllocateHandler.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/CreateDepPlanHandler.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/InstantiateDepPlanHandler.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectConnectorHandler.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectContainerHandler.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SyncHandler.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java3
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/SyncBehaviorParameters.java44
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java2
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiationListener.java4
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java12
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompTypeTrafos.java10
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ContainerTrafo.java7
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/Copy.java226
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CopyTo.java31
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java5
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/UpdateUtils.java8
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterRuleApplication.java45
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java6
-rw-r--r--extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FixTemplateSync.java4
42 files changed, 425 insertions, 473 deletions
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/.project b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/.project
index 83d9e6e6a00..65c53f6af96 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/.project
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/.project
@@ -23,6 +23,18 @@
<buildCommand>
<name>org.eclipse.acceleo.ide.ui.acceleoBuilder</name>
<arguments>
+ <dictionary>
+ <key>compilation.kind</key>
+ <value>compilation.absolute.path</value>
+ </dictionary>
+ <dictionary>
+ <key>compliance</key>
+ <value>pragmatic</value>
+ </dictionary>
+ <dictionary>
+ <key>resource.kind</key>
+ <value>xmi</value>
+ </dictionary>
</arguments>
</buildCommand>
</buildSpec>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
index ccc9a72baec..284cf1c8bbd 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/META-INF/MANIFEST.MF
@@ -30,7 +30,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.papyrus.infra.emf;bundle-version="0.10.1",
org.eclipse.papyrus.acceleo;bundle-version="0.10.1",
org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.3.0",
- org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1"
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.1",
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1"
Export-Package: org.eclipse.papyrus.qompass.designer.core,
org.eclipse.papyrus.qompass.designer.core.acceleo,
org.eclipse.papyrus.qompass.designer.core.deployment,
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
index 6fe298832a7..2a7474522f2 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/build.acceleo
@@ -18,7 +18,7 @@
<acceleoCompiler
sourceFolder="${target.folder}"
outputFolder="${target.folder}"
- dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.infra.core.sasheditor;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.emf;${target.folder}/../../org.eclipse.papyrus.infra.services.labelprovider;${target.folder}/../../org.eclipse.papyrus.uml.tools;${target.folder}/../../org.eclipse.papyrus.infra.services.validation;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.uml.modelexplorer;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
+ dependencies="${target.folder}/../../org.eclipse.papyrus.fcm.profile;${target.folder}/../../org.eclipse.papyrus.infra.core;${target.folder}/../../org.eclipse.papyrus.uml.diagram.common;${target.folder}/../../org.eclipse.papyrus.uml.tools.utils;${target.folder}/../../org.eclipse.papyrus.infra.services.decoration;${target.folder}/../../org.eclipse.papyrus.infra.services.markerlistener;${target.folder}/../../org.eclipse.papyrus.infra.services.resourceloading;${target.folder}/../../org.eclipse.papyrus.uml.tools;${target.folder}/../../org.eclipse.papyrus.infra.services.validation;${target.folder}/../../org.eclipse.papyrus.qompass.designer.vsl;${target.folder}/../../org.eclipse.papyrus.cpp.profile;${target.folder}/../../org.eclipse.papyrus.acceleo;"
binaryResource="false"
packagesToRegister="">
</acceleoCompiler>
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/ConfigUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/ConfigUtils.java
index ea2cd44e0a4..bbef9bc2a0a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/ConfigUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/ConfigUtils.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.ConfigurationProperty;
import org.eclipse.papyrus.FCM.ContainerRule;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
@@ -53,7 +54,7 @@ public class ConfigUtils {
list.add(part);
}
// otherwise add only attributes tagged as configuration properties
- else if(StUtils.isApplied(part, ConfigurationProperty.class)) {
+ else if(StereotypeUtil.isApplied(part, ConfigurationProperty.class)) {
list.add(part);
}
}
@@ -79,7 +80,7 @@ public class ConfigUtils {
continue;
}
Type type = part.getType();
- if(StUtils.isApplied(part, ConfigurationProperty.class)) {
+ if(StereotypeUtil.isApplied(part, ConfigurationProperty.class)) {
list.add(part);
}
if(type instanceof Class) {
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/PortUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/PortUtils.java
index 70d0440d3de..219732a0e7f 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/PortUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/PortUtils.java
@@ -19,6 +19,7 @@ import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.PortKind;
import org.eclipse.papyrus.FCM.TemplatePort;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.EncapsulatedClassifier;
import org.eclipse.uml2.uml.Interface;
@@ -201,7 +202,7 @@ public class PortUtils {
* @return
*/
public static boolean isTemplatePort(Port port) {
- return StUtils.isApplied(port, TemplatePort.class);
+ return StereotypeUtil.isApplied(port, TemplatePort.class);
}
/**
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/StUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/StUtils.java
index de27a49d5f6..32ce32ad91e 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/StUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/StUtils.java
@@ -20,6 +20,7 @@ import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.FCM.DerivedElement;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.Property;
@@ -35,263 +36,6 @@ import org.eclipse.uml2.uml.util.UMLUtil;
public class StUtils {
/**
- * This method verifies if a stereotype is applied on an UML element
- *
- * @param element
- * A UML element
- * @param str_name
- * a qualified stereotype name
- */
- public static boolean isApplied(Element element, String str_name) {
- return (element.getAppliedStereotype(str_name) != null);
- }
-
- /**
- * This method verifies if a stereotype is applied on an UML element
- *
- * @param element
- * A UML element
- * @param the
- * class of an element of a static profile
- */
- public static boolean isApplied(Element element, java.lang.Class<? extends EObject> clazz) {
- for(EObject stereoApplication : element.getStereotypeApplications()) {
- // check whether the stereotype is a subclass of the passed parameter clazz
- if(clazz.isAssignableFrom(stereoApplication.getClass())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * This method verifies if a stereotype is applicable on an UML element
- *
- * @param element
- * A UML element
- * @param the
- * class of an element of a static profile
- */
- public static boolean isApplicable(Element element, java.lang.Class<? extends EObject> clazz) {
- return StUtils.getStereoName(element, clazz) != null;
- }
-
- /**
- * Return the attribute of a stereotype. If the attribute type is a model reference,
- * use the function getAttributeBase instead.
- *
- * @param element
- * the element which holds the stereotype
- * @param stereo_name
- * the name of the stereotype
- * @param attrib_name
- * the name of an attribute of this stereotype
- * @return The value that is associated with the stereotype attribute
- */
- public static Object getAttribute(Element element, String stereo_name, String attrib_name) {
- Stereotype stereotype = element.getAppliedStereotype(stereo_name);
- if(stereotype == null) {
- return null;
- }
- return element.getValue(stereotype, attrib_name);
- }
-
- /**
- * Set the value of a stereotype attribute
- *
- * @param element
- * the element which holds the stereotype
- * @param stereo_name
- * the name of the stereotype
- * @param attrib_name
- * the name of an attribute of this stereotype
- * @param value
- * the value that is associated with the stereotype attribute
- */
- public static void setAttribute(Element element, String stereo_name, String attr_name, Object value) {
- Stereotype st = apply(element, stereo_name);
- if(st != null) {
- element.setValue(st, attr_name, value);
- }
- }
-
- /**
- * Return the stereotype application. Like getApplication below, except
- * that the passed stereotype is a string.
- *
- * @param element
- * @param stereo_name
- * the qualified name of a stereotype. Applications of compatible sub-types will be returned as well (if exact stereotype is not applied)
- * @return
- */
- public static EObject getApplication(Element element, String stereo_name) {
-
- Stereotype stereotype = element.getApplicableStereotype(stereo_name);
- if(stereotype != null) {
- EObject application = element.getStereotypeApplication(stereotype);
- if(application != null) {
- return application;
- }
- // not found, now try sub-stereotypes
- for(Stereotype subStereo : element.getAppliedSubstereotypes(stereotype)) {
- application = element.getStereotypeApplication(subStereo);
- if(application != null) {
- return application;
- }
- }
- }
- return null;
-
- }
-
- /**
- * Apply a stereotype. The stereotype is not applied, if already a sub-stereotype is applied.
- * If you want to apply the new stereotype also in this case, use applyExact instead.
- *
- * @param element
- * the element
- * @param stereo_name
- * the stereotype name
- * @return
- */
- public static Stereotype apply(Element element, String stereo_name) {
- Stereotype stereotype = element.getApplicableStereotype(stereo_name);
- if(stereotype != null) {
- EList<Stereotype> subStereos = element.getAppliedSubstereotypes(stereotype);
- boolean alreadyApplied = (subStereos.size() > 0);
- if(!alreadyApplied) {
- // it seems that subSterotypes do not include the stereotype itself
- if(element.getStereotypeApplication(stereotype) == null) {
- element.applyStereotype(stereotype);
- }
- }
- }
- return stereotype;
- }
-
- /**
- * unapply a stereotype when the name of the stereotype is given.
- *
- * @param element
- * the element
- * @param stereo_name
- * the stereotype name
- * @return
- */
- public static void unapply(Element element, String stereo_name) {
- Stereotype stereotype = element.getApplicableStereotype(stereo_name);
- if(stereotype != null) {
- if(element.getStereotypeApplication(stereotype) != null) {
- element.unapplyStereotype(stereotype);
- }
- }
- }
-
- /**
- * Apply a stereotype and return the stereotype application (if successful).
- * The stereotype is not applied, if already a sub-stereotype is applied.
- * If you want to apply the new stereotype also in this case, use applyExact instead.
- *
- * @param element
- * the element
- * @param stereo_name
- * the stereotype name
- * @return
- */
- public static <T extends EObject> T applyApp(Element element, java.lang.Class<T> clazz) {
- if(apply(element, clazz) != null) {
- return UMLUtil.getStereotypeApplication(element, clazz);
- }
- return null;
- }
-
- /**
- * @param element
- * @param stereo_name
- * @return
- */
- public static Stereotype applyExact(Element element, String stereo_name) {
- Stereotype stereotype = element.getApplicableStereotype(stereo_name);
- if(stereotype != null) {
- Stereotype alreadyApplied = element.getAppliedSubstereotype(stereotype, stereo_name);
- if(alreadyApplied == null) {
- element.applyStereotype(stereotype);
- }
- }
- return stereotype;
- }
-
- /**
- * Apply a stereotype.
- * Caveat: the function relies on the correspondence between the fully qualified
- * stereotype name and the package name within the static profile. The latter may
- * use a different prefix (as it is the case with the MARTE analysis & design profile).
- *
- * @param element
- * the element
- * @param class a class of a static profile
- * @return
- */
- public static Stereotype apply(Element element, java.lang.Class<? extends EObject> clazz) {
- return apply(element, getStereoName(element, clazz));
- }
-
- /**
- * Unapply a stereotype.
- * Caveat: the function relies on the correspondence between the fully qualified
- * stereotype name and the package name within the static profile. The latter may
- * use a different prefix (as it is the case with the MARTE analysis & design profile).
- *
- * @param element
- * the element
- * @param stereo_name
- * the stereotype name
- * @return
- */
- public static void unapply(Element element, java.lang.Class<? extends EObject> clazz) {
- unapply(element, getStereoName(element, clazz));
- }
-
- /**
- * Apply a stereotype.
- * Caveat: the function relies on the correspondence between the fully qualified
- * stereotype name and the package name within the static profile. The latter may
- * use a different prefix (as it is the case with the MARTE analysis & design profile).
- *
- * @param element
- * the element
- * @param stereo_name
- * the stereotype name
- * @return
- */
- public static Stereotype applyExact(Element element, java.lang.Class<? extends EObject> clazz) {
- return applyExact(element, getStereoName(element, clazz));
- }
-
- /**
- * This function should be used if stereotype attributes are in turn typed by stereotyped
- * elements and the user wants to retrieve the underlying base elements (instead of the stereotype application)
- * The function applies the getBaseElement operation to the result of the
- * getStereotypeAttribute function above.
- *
- * @param element
- * the element while holds the stereotype
- * @param stereo_name
- * the name of the stereotype
- * @param attrib_name
- * the name of an attribute of this stereotype
- * @return The value that is associated with the stereotype attribute
- */
- public static Element getAttributeBase(Element element, String stereo_name, String attrib_name) {
- Object obj = getAttribute(element, stereo_name, attrib_name);
- if(obj instanceof EObject) {
- return UMLUtil.getBaseElement((EObject)obj);
- } else {
- return null;
- }
- }
-
- /**
* Copy the stereotype application from a source to a destination element. The
* function will also copy the stereotype attributes.
*
@@ -303,14 +47,14 @@ public class StUtils {
final String derivedElement = DerivedElement.class.getName().replace(".", "::");
for(Stereotype stereotype : source.getAppliedStereotypes()) {
String stereoName = stereotype.getQualifiedName();
- if(!stereoName.equals(derivedElement)) {
+ // if(!stereoName.equals(derivedElement)) {
// Hack: do not copy derived element stereotype. Problem: when templates are instantiated,
// some operations are derived from interface operations which in turn are derived from the
// formal template parameter (e.g. FIFO). Since interface derived from ports are put into a
// top-level directory "derived elements", they may be outside the package template and do not
// get replaced.
copyAttributes(copy, stereotype.getQualifiedName(), source, destination);
- }
+ // }
}
}
@@ -430,31 +174,6 @@ public class StUtils {
}
public static boolean isConnector(Connector candidate) {
- return StUtils.isApplied(candidate, org.eclipse.papyrus.FCM.Connector.class);
+ return StereotypeUtil.isApplied(candidate, org.eclipse.papyrus.FCM.Connector.class);
}
-
- public static Stereotype getStereo(Element element, java.lang.Class<? extends EObject> clazz) {
- return element.getAppliedStereotype(getStereoName(element, clazz));
- }
-
- /**
- * Get the stereotype-name that may relate to the name of an interface within a static profile.
- * Note that the class name within a static profile might have a prefix, such as org.eclipse.papyrus. This
- * functions tries to remove prefixes iteratively, if a stereotype is not applicable.
- *
- * @param clazz
- * @return
- */
- public static String getStereoName(Element element, java.lang.Class<? extends EObject> clazz) {
- String name = clazz.getName().replace(".", "::"); //$NON-NLS-1$ //$NON-NLS-2$;
- while (element.getApplicableStereotype(name) == null) {
- int index = name.indexOf("::"); //$NON-NLS-1$
- if (index == -1) {
- return null;
- }
- name = name.substring(index + 2);
- }
- return name;
- }
-
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/Utils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/Utils.java
index 09c9ffb5dec..c5de6dc199a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/Utils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/Utils.java
@@ -33,6 +33,7 @@ import org.eclipse.papyrus.FCM.Singleton;
import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
import org.eclipse.papyrus.qompass.designer.core.preferences.QompassPreferenceConstants;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
@@ -410,11 +411,11 @@ public class Utils {
}
public static boolean isSingleton(Class component) {
- return StUtils.isApplied(component, Singleton.class);
+ return StereotypeUtil.isApplied(component, Singleton.class);
}
public static boolean isAssembly(Class component) {
- return StUtils.isApplied(component, Assembly.class);
+ return StereotypeUtil.isApplied(component, Assembly.class);
}
public static boolean treatNoneAsComposite() {
@@ -486,7 +487,7 @@ public class Utils {
}
}
else if(el instanceof Class) {
- if(StUtils.isApplied(el, ContainerRule.class)) {
+ if(StereotypeUtil.isApplied(el, ContainerRule.class)) {
ContainerRule rule = UMLUtil.getStereotypeApplication((Class)el, ContainerRule.class);
contRuleList.add(rule);
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/UMLTool.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/UMLTool.java
index 71611792eac..ba5d57fcf0a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/UMLTool.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/acceleo/UMLTool.java
@@ -24,7 +24,7 @@ import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.papyrus.C_Cpp.External;
import org.eclipse.papyrus.C_Cpp.NoCodeGen;
import org.eclipse.papyrus.C_Cpp.Typedef;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Dependency;
@@ -222,7 +222,7 @@ public class UMLTool {
* @return
*/
public static String cppQName(NamedElement ne) {
- if((StUtils.isApplied(ne, External.class)) || (StUtils.isApplied(ne, NoCodeGen.class))) {
+ if((StereotypeUtil.isApplied(ne, External.class)) || (StereotypeUtil.isApplied(ne, NoCodeGen.class))) {
return ne.getName();
} else {
String qName = ne.getName();
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
index d70c8c7f8ee..85bfff48f9c 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/AllocUtils.java
@@ -24,7 +24,7 @@ import org.eclipse.papyrus.MARTE.MARTE_DesignModel.SRM.SW_Concurrency.SwSchedula
import org.eclipse.papyrus.MARTE.MARTE_Foundations.Alloc.Allocate;
import org.eclipse.papyrus.qompass.designer.core.ConnectorUtils;
import org.eclipse.papyrus.qompass.designer.core.Log;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.uml2.uml.Abstraction;
import org.eclipse.uml2.uml.Class;
@@ -74,12 +74,12 @@ public class AllocUtils {
*/
public static Property getThreadAlloc(Property instanceAttribute) {
for (DirectedRelationship relation : instanceAttribute.getSourceDirectedRelationships()) {
- if (StUtils.isApplied(relation, Allocate.class)) {
+ if (StereotypeUtil.isApplied(relation, Allocate.class)) {
if (relation.getTargets().size() != 1) continue;
Element targetElem = relation.getTargets().get(0);
if (!(targetElem instanceof Property)) continue;
Property target = (Property) targetElem;
- if (StUtils.isApplied(target.getType(), SwSchedulableResource.class)) {
+ if (StereotypeUtil.isApplied(target.getType(), SwSchedulableResource.class)) {
return target;
}
}
@@ -141,7 +141,7 @@ public class AllocUtils {
for(DirectedRelationship relationship : instanceOrThread.getSourceDirectedRelationships(UMLPackage.eINSTANCE.getAbstraction())) {
Abstraction abstraction = (Abstraction)relationship;
- if(StUtils.isApplied(abstraction, Allocate.class)) {
+ if(StereotypeUtil.isApplied(abstraction, Allocate.class)) {
for(Element target : abstraction.getTargets()) {
if(target instanceof InstanceSpecification) {
nodeList.add((InstanceSpecification)target);
@@ -167,7 +167,7 @@ public class AllocUtils {
for(InstanceSpecification nodeOrThread : nodeOrThreads)
{
Classifier nodeOrThreadC = DepUtils.getClassifier(nodeOrThread);
- if(StUtils.isApplied(nodeOrThreadC, SwSchedulableResource.class)) {
+ if(StereotypeUtil.isApplied(nodeOrThreadC, SwSchedulableResource.class)) {
// tread case that instance is allocated to a thread
// follow allocation of Thread
nodeList.add(getNode(nodeOrThread));
@@ -198,7 +198,7 @@ public class AllocUtils {
while(relShipIt.hasNext()) {
Abstraction abstraction = (Abstraction)relShipIt.next();
- if(StUtils.isApplied(abstraction, Allocate.class)) {
+ if(StereotypeUtil.isApplied(abstraction, Allocate.class)) {
EList<NamedElement> suppliers = abstraction.getSuppliers(); // use suppliers instead of targets (derived)
for(int index = 0; index < suppliers.size(); index++) {
if(suppliers.get(index) == oldNode) {
@@ -257,7 +257,7 @@ public class AllocUtils {
Abstraction allocation = (Abstraction)
cdp.createPackagedElement("allocate " + instance.getName() +
" to " + node.getName(), UMLPackage.eINSTANCE.getAbstraction());
- if(StUtils.apply(allocation, Allocate.class) == null) {
+ if(StereotypeUtil.apply(allocation, Allocate.class) == null) {
// stereotype application failed
return false;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
index be8f2ff9bce..19c6e0c313a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/BootLoaderGen.java
@@ -33,6 +33,7 @@ import org.eclipse.papyrus.qompass.designer.core.transformations.CompImplTrafos;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
import org.eclipse.papyrus.qompass.designer.core.transformations.PrefixConstants;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Connector;
import org.eclipse.uml2.uml.ConnectorEnd;
@@ -106,7 +107,7 @@ public class BootLoaderGen {
* numberOfNodes.setDefault ("2");
* }
*/
- Include cppInclude = StUtils.applyApp(m_bootLoader, Include.class);
+ Include cppInclude = StereotypeUtil.applyApp(m_bootLoader, Include.class);
Object existingBody = cppInclude.getBody();
String existingBodyStr = ""; //$NON-NLS-1$
if(existingBody instanceof String) {
@@ -226,7 +227,7 @@ public class BootLoaderGen {
}
// if start thread => existing thread activation interceptor? Connection?
- if(StUtils.isApplied(implementation, SwSchedulableResource.class)) {
+ if(StereotypeUtil.isApplied(implementation, SwSchedulableResource.class)) {
// yes, but is the thread instance part of the deployment plan?? [mmh, probably yes...]
// call threads start routine here? (via main thread?) which in turn will activate the start routine?
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
index 0135427f016..29711e65498 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepCreation.java
@@ -16,11 +16,10 @@ import org.eclipse.papyrus.FCM.RuleApplication;
import org.eclipse.papyrus.qompass.designer.core.CORBAtypeNames;
import org.eclipse.papyrus.qompass.designer.core.ConfigUtils;
import org.eclipse.papyrus.qompass.designer.core.Log;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
-import org.eclipse.papyrus.qompass.designer.core.Stereotypes;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationRTException;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Connector;
@@ -259,27 +258,19 @@ public class DepCreation {
// hack: ad-hoc replication support. Better solution via design patterns
int upper = attribute.getUpper();
String infix = ""; //$NON-NLS-1$
- Object obj = StUtils.getAttribute(attribute,
- Stereotypes.replicationInfo, "initialNumberOfReplicas"); //$NON-NLS-1$
- if(obj instanceof Integer) {
- if(upper != 1) {
- throw new TransformationException("cannot replicate an array"); //$NON-NLS-1$
- }
- upper = ((Integer)obj).intValue();
- infix = "r"; //$NON-NLS-1$
- }
+
// TODO: check validation constraints
for(int i = 0; i < upper; i++) {
- String partName = name + "." + attribute.getName();
+ String partName = name + "." + attribute.getName(); //$NON-NLS-1$
if(upper > 1) {
- partName += "_" + infix + i;
+ partName += "_" + infix + i; //$NON-NLS-1$
}
InstanceSpecification partIS = createDepPlan(cdp, cl,
partName, createSlotsForConfigValues, visitedClassifiers);
createSlot(is, partIS, attribute);
}
- } else if(StUtils.isApplied(attribute,
+ } else if(StereotypeUtil.isApplied(attribute,
ConfigurationProperty.class)
&& createSlotsForConfigValues) {
// is a configuration property, create slot
@@ -338,7 +329,7 @@ public class DepCreation {
boolean first = true;
for(Property attribute : ConfigUtils.getConfigAttributes(rule)) {
Type type = attribute.getType();
- if((StUtils.isApplied(attribute, ConfigurationProperty.class))
+ if((StereotypeUtil.isApplied(attribute, ConfigurationProperty.class))
&& (type instanceof Class)) {
Class aggregateOrInterceptor = DepUtils.chooseImplementation(
(Class)type, new BasicEList<InstanceSpecification>(),
@@ -425,7 +416,7 @@ public class DepCreation {
createSlot(is, partIS, attribute);
}
}
- } else if(StUtils.isApplied(attribute,
+ } else if(StereotypeUtil.isApplied(attribute,
ConfigurationProperty.class)) {
// is a configuration property, create slot
// TODO: implicit assumption that configuration attributes
@@ -463,10 +454,10 @@ public class DepCreation {
if (sf == null) {
throw new RuntimeException ("The defining feature of a slot of instance " + slot.getOwningInstance().getName() + " is null");
}
- if(StUtils.isApplied(sf, AutoIndex.class)) {
+ if(StereotypeUtil.isApplied(sf, AutoIndex.class)) {
Integer value = null;
Object key;
- if(StUtils.isApplied(sf, AutoIndexPerNode.class)) {
+ if(StereotypeUtil.isApplied(sf, AutoIndexPerNode.class)) {
InstanceSpecification nodeOrThread = AllocUtils.getNode(is);
key = sf.getName() + nodeOrThread.getName();
} else {
@@ -512,7 +503,7 @@ public class DepCreation {
if(sf == null) {
throw new TransformationRTException(is.getName() + " has a slot without defining feature"); //$NON-NLS-1$
}
- if(StUtils.isApplied(sf, CopyAttributeValue.class)) {
+ if(StereotypeUtil.isApplied(sf, CopyAttributeValue.class)) {
CopyAttributeValue cav = UMLUtil.getStereotypeApplication(sf,
CopyAttributeValue.class);
Property source = cav.getSource();
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
index 0ac1e72005c..97365fdb5ea 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepPlanUtils.java
@@ -21,7 +21,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.Enumerator;
import org.eclipse.emf.ecore.ENamedElement;
import org.eclipse.papyrus.FCM.DeploymentPlan;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
@@ -70,7 +70,7 @@ public class DepPlanUtils {
EList<Package> depPlanList = new BasicEList<Package>();
if(depPlanRoot != null) {
for(Package pkg : depPlanRoot.getNestedPackages()) {
- if(StUtils.isApplied(pkg, DeploymentPlan.class)) {
+ if(StereotypeUtil.isApplied(pkg, DeploymentPlan.class)) {
depPlanList.add(pkg);
}
}
@@ -145,7 +145,7 @@ public class DepPlanUtils {
* instance the top-level instance specification of the plan
*/
public static void setMainInstance(Package cdp, InstanceSpecification mainInstance) {
- DeploymentPlan cdpApp = StUtils.applyApp(cdp, DeploymentPlan.class);
+ DeploymentPlan cdpApp = StereotypeUtil.applyApp(cdp, DeploymentPlan.class);
if(cdpApp != null) {
cdpApp.setMainInstance(mainInstance);
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
index cef60aca9c0..a42fcf6a3fb 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/DepUtils.java
@@ -16,7 +16,7 @@ import org.eclipse.papyrus.FCM.ImplementationGroup;
import org.eclipse.papyrus.FCM.ImplementationProperties;
import org.eclipse.papyrus.FCM.InteractionComponent;
import org.eclipse.papyrus.FCM.Target;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.dialogs.ElementListSelectionDialog;
@@ -142,7 +142,7 @@ public class DepUtils {
// TODO: assumption that implementations are in same package as type;
EList<Class> implList = new BasicEList<Class>();
- if(StUtils.isApplied(componentType, ImplementationGroup.class)) {
+ if(StereotypeUtil.isApplied(componentType, ImplementationGroup.class)) {
for(Property groupAttribute : componentType.getAttributes()) {
Type implClass = groupAttribute.getType();
if((implClass instanceof Class) && isImplEligible((Class)implClass, nodes)) {
@@ -229,7 +229,7 @@ public class DepUtils {
* instance the top-level instance specification of the plan
*/
public static void setMainInstance(Package cdp, InstanceSpecification mainInstance) {
- StUtils.apply(cdp, DeploymentPlan.class);
+ StereotypeUtil.apply(cdp, DeploymentPlan.class);
DeploymentPlan dp = UMLUtil.getStereotypeApplication(cdp, DeploymentPlan.class);
dp.setMainInstance(mainInstance);
}
@@ -259,7 +259,7 @@ public class DepUtils {
*/
public static boolean isConnector(InstanceSpecification instance) {
Classifier cl = getClassifier(instance);
- return StUtils.isApplied(cl, InteractionComponent.class);
+ return StereotypeUtil.isApplied(cl, InteractionComponent.class);
}
/**
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
index f9028907b76..dda939f3cf8 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/deployment/PartialCopy.java
@@ -17,7 +17,6 @@ package org.eclipse.papyrus.qompass.designer.core.deployment;
import java.util.Stack;
import org.eclipse.papyrus.qompass.designer.core.ConnectorUtils;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
import org.eclipse.uml2.uml.Class;
@@ -59,7 +58,7 @@ public class PartialCopy implements InstanceDeployer {
public Classifier deployInstance(InstanceSpecification is, Stack<Slot> slotPath) throws TransformationException {
Classifier classifier = DepUtils.getClassifier(is);
- // only make a partial copy of the system class slotPath size 0) for the moment.
+ // only make a partial copy of the system class (slotPath size 0) for the moment.
if(!(classifier instanceof Class) || slotPath.size() > 0) {
return copy.getCopy(classifier);
}
@@ -75,8 +74,6 @@ public class PartialCopy implements InstanceDeployer {
}
// since we copied some of its attributes, the copy class created a shallow copy of the class itself
Class tmCl = (Class) copy.get(smCl);
- if (tmCl != null)
- StUtils.copyStereotypes(smCl, tmCl);
return tmCl;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/AllocationDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/AllocationDialog.java
index 0047384008e..0a3b0feba50 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/AllocationDialog.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/AllocationDialog.java
@@ -20,7 +20,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.MARTE.MARTE_DesignModel.SRM.SW_Concurrency.SwSchedulableResource;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.deployment.AllocUtils;
import org.eclipse.papyrus.qompass.designer.core.deployment.BootLoaderGen;
@@ -300,10 +300,10 @@ public class AllocationDialog extends SelectionStatusDialog {
} else if(el instanceof InstanceSpecification) {
Classifier cl = DepUtils.getClassifier((InstanceSpecification)el);
if(cl != null) {
- if((cl instanceof Class) || (StUtils.isApplied(cl, SwSchedulableResource.class))) {
+ if((cl instanceof Class) || (StereotypeUtil.isApplied(cl, SwSchedulableResource.class))) {
// check that instances are not part of a deployment plan
// [TODO:] check that owner of instance is a platform definition
- if(!StUtils.isApplied(el.getOwner(), DeploymentPlan.class)) {
+ if(!StereotypeUtil.isApplied(el.getOwner(), DeploymentPlan.class)) {
nodeList.add((InstanceSpecification)el);
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ChooseConfigOpt.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ChooseConfigOpt.java
index 4bd9224ab16..4b763472049 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ChooseConfigOpt.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ChooseConfigOpt.java
@@ -21,7 +21,7 @@ import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.ConfigOption;
import org.eclipse.papyrus.FCM.ContainerRule;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.uml.profile.ui.dialogs.AlphabeticalViewerSorter;
import org.eclipse.papyrus.uml.profile.ui.dialogs.ChooseSetAssistedDialog;
import org.eclipse.papyrus.uml.profile.ui.dialogs.IChooseDialog;
@@ -84,7 +84,7 @@ public class ChooseConfigOpt extends ChooseSetAssistedDialog implements IChooseD
getAvailConfigOpts((Package)el, configOptList);
}
} else if(el instanceof Class) {
- if(StUtils.isApplied(el, ConfigOption.class)) {
+ if(StereotypeUtil.isApplied(el, ConfigOption.class)) {
configOptList.add((Class)el);
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConfigurePortDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConfigurePortDialog.java
index 4e75c9928f8..dc1d2c661dd 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConfigurePortDialog.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConfigurePortDialog.java
@@ -32,7 +32,7 @@ import org.eclipse.papyrus.FCM.PortKind;
import org.eclipse.papyrus.infra.widgets.editors.TreeSelectorDialog;
import org.eclipse.papyrus.qompass.designer.core.Description;
import org.eclipse.papyrus.qompass.designer.core.PortUtils;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.uml.tools.providers.ServiceEditFilteredContentProvider;
import org.eclipse.papyrus.uml.tools.providers.UMLLabelProvider;
@@ -205,7 +205,7 @@ public class ConfigurePortDialog extends SelectionStatusDialog {
public void widgetSelected(SelectionEvent e) {
// changePortKind
- org.eclipse.papyrus.FCM.Port fcmPort = StUtils.applyApp(m_currentPort, org.eclipse.papyrus.FCM.Port.class);
+ org.eclipse.papyrus.FCM.Port fcmPort = StereotypeUtil.applyApp(m_currentPort, org.eclipse.papyrus.FCM.Port.class);
if(fcmPort != null)
{
int index = fKindCombo.getSelectionIndex();
@@ -215,7 +215,7 @@ public class ConfigurePortDialog extends SelectionStatusDialog {
selectPort(m_currentPort);
}
else {
- StUtils.unapply(m_currentPort, org.eclipse.papyrus.FCM.Port.class);
+ StereotypeUtil.unapply(m_currentPort, org.eclipse.papyrus.FCM.Port.class);
selectPort(m_currentPort);
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConnectorSelectionDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConnectorSelectionDialog.java
index 49e815c94d6..9e84c33dafd 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConnectorSelectionDialog.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ConnectorSelectionDialog.java
@@ -25,7 +25,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.papyrus.FCM.InteractionComponent;
import org.eclipse.papyrus.qompass.designer.core.Description;
import org.eclipse.papyrus.qompass.designer.core.Log;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.templates.ConnectorBinding;
import org.eclipse.papyrus.qompass.designer.core.transformations.TransformationException;
@@ -320,7 +320,7 @@ public class ConnectorSelectionDialog extends AbstractElementListSelectionDialog
getAllConnectors((Package)el, selectedConnector, connectorList);
}
} else if(el instanceof Class) {
- if(StUtils.isApplied(el, InteractionComponent.class) && Utils.isCompType((Class)el)) {
+ if(StereotypeUtil.isApplied(el, InteractionComponent.class) && Utils.isCompType((Class)el)) {
if(selectedConnector == null) {
connectorList.add((Class)el);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ContainerDialog.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ContainerDialog.java
index 91ffdd1c84a..ae643fe146e 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ContainerDialog.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/dialogs/ContainerDialog.java
@@ -26,7 +26,7 @@ import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.papyrus.FCM.ContainerRule;
import org.eclipse.papyrus.FCM.RuleApplication;
import org.eclipse.papyrus.qompass.designer.core.Description;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -81,7 +81,7 @@ public class ContainerDialog extends SelectionStatusDialog {
public ContainerDialog(Shell parent, Class componentOrRule) {
super(parent);
// visitedPackages = new BasicEList<Package> ();
- m_rulePropertiesOnly = StUtils.isApplied(componentOrRule, ContainerRule.class);
+ m_rulePropertiesOnly = StereotypeUtil.isApplied(componentOrRule, ContainerRule.class);
if(m_rulePropertiesOnly) {
// m_currentRule = UMLUtil.getStereotypeApplication(componentOrRule, ContainerRule.class);
} else {
@@ -243,7 +243,7 @@ public class ContainerDialog extends SelectionStatusDialog {
ContainerRule addRule(String name) {
Class ruleCl = (Class)
m_component.createNestedClassifier(name, UMLPackage.eINSTANCE.getClass_());
- StUtils.apply(ruleCl, ContainerRule.class);
+ StereotypeUtil.apply(ruleCl, ContainerRule.class);
return UMLUtil.getStereotypeApplication(ruleCl, ContainerRule.class);
}
@@ -265,8 +265,8 @@ public class ContainerDialog extends SelectionStatusDialog {
* @param rule
*/
void applyRule(ContainerRule rule) {
- if(!StUtils.isApplied(m_component, RuleApplication.class)) {
- StUtils.apply(m_component, RuleApplication.class);
+ if(!StereotypeUtil.isApplied(m_component, RuleApplication.class)) {
+ StereotypeUtil.apply(m_component, RuleApplication.class);
}
RuleApplication containerConfig =
UMLUtil.getStereotypeApplication(m_component, RuleApplication.class);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AddProfileAndModelLibsHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AddProfileAndModelLibsHandler.java
index ad386d76bf1..d98c2796769 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AddProfileAndModelLibsHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AddProfileAndModelLibsHandler.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
@@ -40,13 +40,13 @@ import org.eclipse.uml2.uml.UMLFactory;
*/
public class AddProfileAndModelLibsHandler extends CmdHandler {
- static final String FCM_PROFILE_URI = "pathmap://FCM_PROFILES/FCM.profile.uml"; //$NON-NLS-1$
+ public static final String FCM_PROFILE_URI = "pathmap://FCM_PROFILES/FCM.profile.uml"; //$NON-NLS-1$
- static final String MARTE_PROFILE_URI = "pathmap://Papyrus_PROFILES/MARTE.profile.uml";//$NON-NLS-1$
+ public static final String MARTE_PROFILE_URI = "pathmap://Papyrus_PROFILES/MARTE.profile.uml";//$NON-NLS-1$
- static final String EC3M_BASIC_CALLS_URI = "pathmap://QML_CORE/core.uml"; //$NON-NLS-1$
+ public static final String EC3M_BASIC_CALLS_URI = "pathmap://QML_CORE/core.uml"; //$NON-NLS-1$
- static final String EC3M_MARTE_CALLS_URI = "pathmap://QML_MARTE/marte.uml"; //$NON-NLS-1$
+ public static final String EC3M_MARTE_CALLS_URI = "pathmap://QML_MARTE/marte.uml"; //$NON-NLS-1$
static final String MARTE_FOUNDATIONS = "MARTE_Foundations"; //$NON-NLS-1$
@@ -85,9 +85,9 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
*
* @return
*/
- public PackageImport getModelLibraryImportFromURI(URI uri, EditingDomain domain) {
+ public PackageImport getModelLibraryImportFromURI(URI uri, ResourceSet resourceSet) {
// Try to reach model
- Element root = getContent(uri, domain);
+ Element root = getContent(uri, resourceSet);
if(root instanceof Package) {
// Import model library
@@ -101,9 +101,9 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
return null;
}
- public static Element getContent(URI uri, EditingDomain domain) {
+ public static Element getContent(URI uri, ResourceSet rs) {
// Resource resource = getTransactionalEditingDomain ().getResourceSet().getResource (uri, true);
- Resource resource = domain.getResourceSet().getResource(uri, true);
+ Resource resource = rs.getResource(uri, true);
return getContent(resource);
}
@@ -155,9 +155,10 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
final Package selectedPkg = (Package)getSelectedEObject();
final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(selectedPkg);
-
+ final ResourceSet resourceSet = selectedPkg.eResource().getResourceSet();
+
CommandStack stack = domain.getCommandStack();
- PackageImport pi = getModelLibraryImportFromURI(URI.createURI(EC3M_BASIC_CALLS_URI), domain);
+ PackageImport pi = getModelLibraryImportFromURI(URI.createURI(EC3M_BASIC_CALLS_URI), resourceSet);
EList<Object> list = new BasicEList<Object>();
EList<Object> selection = new BasicEList<Object>();
if(pi != null) {
@@ -166,7 +167,7 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
selection.add(pi);
}
}
- pi = getModelLibraryImportFromURI(URI.createURI(EC3M_MARTE_CALLS_URI), domain);
+ pi = getModelLibraryImportFromURI(URI.createURI(EC3M_MARTE_CALLS_URI), resourceSet);
if(pi != null) {
list.add(pi);
if(isAlreadyImported(selectedPkg, pi)) {
@@ -216,8 +217,8 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
public static void addProfiles(Package selectedPkg, int applyCode) {
- final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(selectedPkg);
-
+ final ResourceSet resourceSet = selectedPkg.eResource().getResourceSet();
+
try {
/*
* // Apply UML Standard profile
@@ -231,7 +232,7 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
if((applyCode & APPLY_FCM) != 0) {
// Retrieve FCM profile
Profile fcmProfile =
- (Profile)getContent(URI.createURI(FCM_PROFILE_URI), domain);
+ (Profile)getContent(URI.createURI(FCM_PROFILE_URI), resourceSet);
// Apply FCM profile and its nested profiles to new model
if(fcmProfile instanceof Profile) {
@@ -250,7 +251,7 @@ public class AddProfileAndModelLibsHandler extends CmdHandler {
if((applyCode & (APPLY_ALLOC | APPLY_HLAM_GCM)) != 0) {
// Retrieve MARTE profile
Profile marteProfile =
- (Profile)getContent(URI.createURI(MARTE_PROFILE_URI), domain);
+ (Profile)getContent(URI.createURI(MARTE_PROFILE_URI), resourceSet);
// Apply MARTE::MARTE_DesignModel::HLAM
// & MARTE::MARTE_DesignModel::GCM
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AllocateHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AllocateHandler.java
index d37bda4dda0..c2627926cd0 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AllocateHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/AllocateHandler.java
@@ -18,7 +18,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.qompass.designer.core.CommandSupport;
import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
import org.eclipse.papyrus.qompass.designer.core.dialogs.AllocationDialog;
import org.eclipse.swt.widgets.Shell;
@@ -36,7 +36,7 @@ public class AllocateHandler extends CmdHandler {
updateSelectedEObject();
EObject selectedObj = getSelectedEObject();
if(selectedObj instanceof Package) {
- return (StUtils.isApplied((Package)selectedObj, DeploymentPlan.class));
+ return (StereotypeUtil.isApplied((Package)selectedObj, DeploymentPlan.class));
}
return false;
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/CreateDepPlanHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/CreateDepPlanHandler.java
index 67336d1e44a..c265931899f 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/CreateDepPlanHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/CreateDepPlanHandler.java
@@ -21,7 +21,7 @@ import org.eclipse.gmf.runtime.common.core.command.CommandResult;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.qompass.designer.core.CommandSupport;
import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils;
@@ -111,7 +111,7 @@ public class CreateDepPlanHandler extends CmdHandler {
public CommandResult run() {
Package cdp = depPlans.createNestedPackage(depPlanName);
- Stereotype st = StUtils.apply(cdp, org.eclipse.papyrus.FCM.DeploymentPlan.class);
+ Stereotype st = StereotypeUtil.apply(cdp, org.eclipse.papyrus.FCM.DeploymentPlan.class);
if(st == null) {
MessageDialog.openInformation(new Shell(), "Cannot create deployment plan",
"Application of stereotype \"FCM::DeploymentPlan\" failed. Check, if FCM profile is applied");
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/InstantiateDepPlanHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/InstantiateDepPlanHandler.java
index d0ebb113612..34c69acf5af 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/InstantiateDepPlanHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/InstantiateDepPlanHandler.java
@@ -26,7 +26,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.papyrus.FCM.Configuration;
import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.qompass.designer.core.ProjectManagement;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.dialogs.GenerationOptionsDialog;
import org.eclipse.papyrus.qompass.designer.core.transformations.InstantiateDepPlan;
import org.eclipse.swt.widgets.Shell;
@@ -47,8 +47,8 @@ public class InstantiateDepPlanHandler extends CmdHandler {
updateSelectedEObject();
EObject selectedObj = getSelectedEObject();
if(selectedObj instanceof Element) {
- if(StUtils.isApplied((Element)selectedObj, DeploymentPlan.class) ||
- StUtils.isApplied((Element)selectedObj, Configuration.class)) {
+ if(StereotypeUtil.isApplied((Element)selectedObj, DeploymentPlan.class) ||
+ StereotypeUtil.isApplied((Element)selectedObj, Configuration.class)) {
return true;
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectConnectorHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectConnectorHandler.java
index aab85e600d0..0d8d6cc21c4 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectConnectorHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectConnectorHandler.java
@@ -15,7 +15,7 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.papyrus.FCM.InteractionComponent;
import org.eclipse.papyrus.qompass.designer.core.CommandSupport;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.dialogs.ConnectorSelectionDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.Class;
@@ -74,7 +74,7 @@ public class SelectConnectorHandler extends CmdHandler {
CommandSupport.exec("Select connector", event, new Runnable() {
public void run() {
- org.eclipse.papyrus.FCM.Connector fcmSelectedConnector = StUtils.applyApp(selectedConnector, org.eclipse.papyrus.FCM.Connector.class);
+ org.eclipse.papyrus.FCM.Connector fcmSelectedConnector = StereotypeUtil.applyApp(selectedConnector, org.eclipse.papyrus.FCM.Connector.class);
InteractionComponent newConnType = UMLUtil.getStereotypeApplication((Class)result[0], InteractionComponent.class);
fcmSelectedConnector.setIc(newConnType);
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectContainerHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectContainerHandler.java
index 8f9d51cff96..055d9b5401a 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectContainerHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SelectContainerHandler.java
@@ -105,8 +105,8 @@ public class SelectContainerHandler extends CmdHandler {
* if ((result.length == 2) && (result[0] instanceof Class) && (result[1] instanceof Class)) {
* CommandSupport.exec ("Select connector", new Runnable () {
* public void run () {
- * Object newConnType = StUtils.getApplication ((Class) result[0], ConnectorType.class);
- * Object newConnImpl = StUtils.getApplication ((Class) result[1], ConnectorImpl.class);
+ * Object newConnType = StereotypeUtil.getApplication ((Class) result[0], ConnectorType.class);
+ * Object newConnImpl = StereotypeUtil.getApplication ((Class) result[1], ConnectorImpl.class);
* }
* });
* }
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SyncHandler.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SyncHandler.java
index 996cba290bc..4a61ec165d2 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SyncHandler.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/handlers/SyncHandler.java
@@ -22,7 +22,7 @@ import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.papyrus.FCM.DeploymentPlan;
import org.eclipse.papyrus.qompass.designer.core.CommandSupport;
import org.eclipse.papyrus.qompass.designer.core.RunnableWithResult;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.papyrus.qompass.designer.core.sync.CompImplSync;
import org.eclipse.papyrus.qompass.designer.core.sync.DepPlanSync;
@@ -54,7 +54,7 @@ public class SyncHandler extends CmdHandler {
}
}
if(selectedObj instanceof Package) {
- if(StUtils.isApplied((Package)selectedObj, DeploymentPlan.class)) {
+ if(StereotypeUtil.isApplied((Package)selectedObj, DeploymentPlan.class)) {
return true;
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
index 014ed211b30..29e574fcd4c 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/CompImplSync.java
@@ -384,6 +384,9 @@ public class CompImplSync {
}
}
}
+ for (Behavior method : implementation.getOwnedBehaviors()) {
+ SyncBehaviorParameters.syncParameters(method);
+ }
// remove operations that are no longer provided via an interface of a port (and
// that are derived elements, i.e. have a source attribute)
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/SyncBehaviorParameters.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/SyncBehaviorParameters.java
new file mode 100644
index 00000000000..c7867b27203
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/sync/SyncBehaviorParameters.java
@@ -0,0 +1,44 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.qompass.designer.core.sync;
+
+import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
+import org.eclipse.uml2.uml.Behavior;
+import org.eclipse.uml2.uml.BehavioralFeature;
+import org.eclipse.uml2.uml.Parameter;
+
+/**
+ * Synchronize behavior parameters
+ *
+ * A behavior is often a method for a behavioral feature. In this case, UML validation checks that the number and type
+ * of parameters of the behavior and the behavioral feature match.
+ * This class synchronizes the parameters of the behavior with that of the behavioral feature.
+ */
+public class SyncBehaviorParameters {
+ public static final void syncParameters(Behavior method) {
+
+ BehavioralFeature bf = method.getSpecification();
+ if (bf != null) {
+ method.getOwnedParameters().clear();
+ for (Parameter parameter : bf.getOwnedParameters()) {
+ Parameter newParameter = method.createOwnedParameter(parameter.getName(), parameter.getType());
+ newParameter.setDirection(parameter.getDirection());
+ Copy.copyMultElemModifiers(parameter, newParameter);
+ StUtils.copyStereotypes(parameter, newParameter);
+ }
+ }
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
index 4c0ff062dc4..c5cb74af6c1 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiation.java
@@ -37,7 +37,7 @@ import org.eclipse.uml2.uml.TemplateableElement;
import org.eclipse.uml2.uml.util.UMLUtil;
/**
- * This class encapsulated functions around template instantiation.
+ * This class encapsulates functions around template instantiation.
*
* With respect to composite structures, we need to consider two different
* cases: (1) the type of a property is a template class itself (2) the type of
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiationListener.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiationListener.java
index 36bd05bd8e7..1f8e4acdf7f 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiationListener.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/templates/TemplateInstantiationListener.java
@@ -48,6 +48,7 @@ import org.eclipse.uml2.uml.util.UMLUtil;
/**
* Template instantiation is implemented by means of an CopyListener that
* evaluates the template stereotype.
+ * This is a pre-copy listener.
*/
public class TemplateInstantiationListener implements CopyListener {
@@ -137,7 +138,8 @@ public class TemplateInstantiationListener implements CopyListener {
Behavior newBehavior =
instantiateBehavior(intfOperation, template, (OpaqueBehavior)method);
newBehavior.setSpecification(last);
- removalList.add(method);
+ // removalList.add(method);
+ copy.removeForCopy(method); // enable subsequent instantiations
}
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
index 1836942c2d4..b2ba32a60ca 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompImplTrafos.java
@@ -25,7 +25,7 @@ import org.eclipse.papyrus.FCM.PortKind;
import org.eclipse.papyrus.qompass.designer.core.ConnectorUtils;
import org.eclipse.papyrus.qompass.designer.core.PortInfo;
import org.eclipse.papyrus.qompass.designer.core.PortUtils;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.uml2.uml.AggregationKind;
import org.eclipse.uml2.uml.Association;
@@ -80,7 +80,7 @@ public class CompImplTrafos {
Class implementation = (Class)element;
// we may not apply the transformation to the boot-loader itself, in particular it would transform
// singletons into pointers.
- if(Utils.isCompImpl(implementation) && (implementation != bootloader) && !StUtils.isApplied(implementation, PortKind.class)) {
+ if(Utils.isCompImpl(implementation) && (implementation != bootloader) && !StereotypeUtil.isApplied(implementation, PortKind.class)) {
addGetPortOperation(copy, implementation);
addConnectPortOperation(copy, implementation);
markPartsPointer(implementation);
@@ -116,7 +116,7 @@ public class CompImplTrafos {
op = implementation.createOwnedOperation(opName, null, null, providedIntf);
Parameter retParam = op.getOwnedParameters().get(0);
retParam.setName(retParamName);
- StUtils.apply(retParam, Ptr.class);
+ StereotypeUtil.apply(retParam, Ptr.class);
OpaqueBehavior behavior = (OpaqueBehavior)
implementation.createOwnedBehavior(opName,
@@ -191,7 +191,7 @@ public class CompImplTrafos {
// => requires adaptations of boot-loader which is then only responsible for creating instances
// corresponding to types
if(instantiateViaBootloader(cl)) {
- StUtils.apply(attribute, Ptr.class);
+ StereotypeUtil.apply(attribute, Ptr.class);
}
}
}
@@ -233,7 +233,7 @@ public class CompImplTrafos {
}
}
Parameter refParam = op.createOwnedParameter("ref", requiredIntf); //$NON-NLS-1$
- StUtils.apply(refParam, Ptr.class);
+ StereotypeUtil.apply(refParam, Ptr.class);
OpaqueBehavior behavior = (OpaqueBehavior)
implementation.createOwnedBehavior(opName,
@@ -289,7 +289,7 @@ public class CompImplTrafos {
op = implementation.createOwnedOperation(opName, null, null, requiredIntf);
Parameter retParam = op.getOwnedParameters().get(0);
retParam.setName(retParamName);
- StUtils.apply(retParam, Ptr.class);
+ StereotypeUtil.apply(retParam, Ptr.class);
}
behavior = (OpaqueBehavior)
implementation.createOwnedBehavior(opName,
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompTypeTrafos.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompTypeTrafos.java
index 0a18177258d..f848f607395 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompTypeTrafos.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CompTypeTrafos.java
@@ -18,7 +18,7 @@ import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.C_Cpp.Ptr;
import org.eclipse.papyrus.qompass.designer.core.PortUtils;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.Utils;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Element;
@@ -89,8 +89,8 @@ public class CompTypeTrafos {
op.setIsAbstract(true);
Parameter retParam = op.createOwnedParameter("ret", providedIntf);
retParam.setDirection(ParameterDirectionKind.RETURN_LITERAL);
- StUtils.apply(retParam, Ptr.class);
- // StUtils.apply(op, CppVirtual.class);
+ StereotypeUtil.apply(retParam, Ptr.class);
+ // StereotypeUtil.apply(op, CppVirtual.class);
}
}
Interface requiredIntf = PortUtils.getRequired(port);
@@ -116,8 +116,8 @@ public class CompTypeTrafos {
}
Parameter refParam = op.createOwnedParameter("ref", requiredIntf);
refParam.setDirection(ParameterDirectionKind.IN_LITERAL);
- StUtils.apply(refParam, Ptr.class);
- // StUtils.apply(op, CppVirtual.class);
+ StereotypeUtil.apply(refParam, Ptr.class);
+ // StereotypeUtil.apply(op, CppVirtual.class);
}
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ContainerTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ContainerTrafo.java
index 6591a5313bb..cd91d62442d 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ContainerTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/ContainerTrafo.java
@@ -37,6 +37,7 @@ import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateInstantiation;
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Association;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
@@ -258,7 +259,7 @@ public class ContainerTrafo extends AbstractContainerTrafo {
// DepUtils.chooseImplementation((Class) type,
// new BasicEList<InstanceSpecification>(), false);
- if(StUtils.isApplied(extOrInterceptor, InteractionComponent.class)) {
+ if(StereotypeUtil.isApplied(extOrInterceptor, InteractionComponent.class)) {
InterceptionRule interceptionRule = UMLUtil.getStereotypeApplication(part, InterceptionRule.class);
InterceptionKind interceptionKind = InterceptionKind.INTERCEPT_ALL; // default: intercept all ports
@@ -271,7 +272,7 @@ public class ContainerTrafo extends AbstractContainerTrafo {
expandInterceptorExtension(interceptionKind, interceptFeatures, extOrInterceptor, tmComponent);
interceptorPartsMap.put(part, interceptorParts);
}
- else if(StUtils.isApplied(part, InterceptionRule.class)) {
+ else if(StereotypeUtil.isApplied(part, InterceptionRule.class)) {
throw new TransformationException("The part " + part.getName() + " in rule " + smContainerRule.getBase_Class().getName() + "" +
" has an interceptionRule, but is not typed with an interaction component");
}
@@ -440,7 +441,7 @@ public class ContainerTrafo extends AbstractContainerTrafo {
}
interceptionConnector.setName(interceptorName + port.getName() + counter);
- org.eclipse.papyrus.FCM.Connector fcmConn = StUtils.applyApp(interceptionConnector, org.eclipse.papyrus.FCM.Connector.class);
+ org.eclipse.papyrus.FCM.Connector fcmConn = StereotypeUtil.applyApp(interceptionConnector, org.eclipse.papyrus.FCM.Connector.class);
InteractionComponent fcmConnType = UMLUtil.getStereotypeApplication(smContainerConnImpl, InteractionComponent.class);
fcmConn.setIc(fcmConnType);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/Copy.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/Copy.java
index 1d191371e05..cabd3e7de20 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/Copy.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/Copy.java
@@ -33,7 +33,6 @@ import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
import org.eclipse.emf.ecore.util.InternalEList;
import org.eclipse.emf.ecore.xmi.XMLResource;
import org.eclipse.papyrus.qompass.designer.core.Log;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
import org.eclipse.papyrus.qompass.designer.core.listeners.CopyListener;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Class;
@@ -56,6 +55,7 @@ import org.eclipse.uml2.uml.Property;
import org.eclipse.uml2.uml.Slot;
import org.eclipse.uml2.uml.Stereotype;
import org.eclipse.uml2.uml.ValueSpecification;
+import org.eclipse.uml2.uml.util.UMLUtil;
/**
* A specific copier that enables to make iterative and shallow copies of model elements
@@ -80,6 +80,32 @@ import org.eclipse.uml2.uml.ValueSpecification;
*/
public class Copy extends Copier {
+ public enum CopyStatus {
+ /**
+ * The status is not known, in most cases this indicates that the object has not yet been copied.
+ */
+ UNKNOWN,
+
+ /**
+ * A full copy obtained via the copy function. Full means that the contained features have been completely
+ * copied
+ */
+ FULL,
+
+ /**
+ * A full copy in progress. Intermediate state of a target element after creation within the copy function,
+ * before all attributes & references have been copied.
+ */
+ INPROGRESS,
+
+ /**
+ * A shallow copy, i.e. a copy only containing a subset of the original element. These are typically containers
+ * for copied objects and avoids that the copies are not enclosed in an object. A shallow copy may become a full
+ * copy later on.
+ */
+ SHALLOW
+ }
+
public Copy(Package source_, Package target_, boolean copyExtResources_) {
source = source_;
target = target_;
@@ -89,7 +115,7 @@ public class Copy extends Copier {
postCopyListeners = new BasicEList<CopyListener>();
templateMapInfo = new HashMap<EObject, Map<EObject, EObject>>();
standardMap = new HashMap<EObject, EObject>();
- shallowMap = new HashMap<EObject, Boolean>();
+ statusMap = new HashMap<EObject, CopyStatus>();
boundPackages = new Stack<Namespace>();
if(copyExtReferences) {
// original source package becomes a sub-package in the target model
@@ -146,7 +172,7 @@ public class Copy extends Copier {
/**
* Map using a target EObject as key
*/
- private Map<EObject, Boolean> shallowMap;
+ private Map<EObject, CopyStatus> statusMap;
/**
* Elements within package templates must be treated differently, we have to ensure that:
@@ -202,8 +228,8 @@ public class Copy extends Copier {
return null;
}
- public void setShallow(EObject targetEObj, boolean isShallow) {
- shallowMap.put(targetEObj, isShallow);
+ public void setStatus(EObject targetEObj, CopyStatus status) {
+ statusMap.put(targetEObj, status);
}
/**
@@ -212,12 +238,19 @@ public class Copy extends Copier {
* @param sourceEObj
* @return
*/
- public boolean isShallow(EObject targetEObj) {
- Boolean shallow = shallowMap.get(targetEObj);
- if(shallow != null) {
- return shallow;
+ public CopyStatus getStatus(EObject targetEObj) {
+ /*
+ if (targetEObj instanceof Package) {
+ return true;
+ }
+ */
+ if (targetEObj != null) {
+ CopyStatus status = statusMap.get(targetEObj);
+ if(status != null) {
+ return status;
+ }
}
- return false;
+ return CopyStatus.UNKNOWN;
}
// public Namespace getPackageTemplate() {
@@ -317,6 +350,15 @@ public class Copy extends Copier {
public boolean withinTemplate(EObject element) {
if(boundPackage != null) {
EObject owner = element;
+ if ((element.eContainer() == null) &&
+ !(element instanceof Element)) { // has no eContainer and is not a UML element => likely to be a be a stereotype application.
+ // it is important not to call getBaseElement for all eobjects, since its execution can take
+ // quite a while (in particular, if not called on a stereotype application)
+ Element base = UMLUtil.getBaseElement(owner);
+ if (base != null) {
+ owner = base; // containment check is done with base element
+ }
+ }
while(owner != null) {
owner = owner.eContainer();
if(get(owner) == boundPackage) {
@@ -342,24 +384,24 @@ public class Copy extends Copier {
@SuppressWarnings("unchecked")
@Override
public EObject copy(EObject sourceEObj) {
- boolean withinTemplate = withinTemplate(sourceEObj);
+ if(sourceEObj == null) {
+ // this case may happen, if elements were systematically copied without checking for
+ // null references in the application code (e.g. if we copy a part-with-port which might
+ // be null in case of delegation or connectors without ports
+ return null;
+ }
+
EObject targetEObj = get(sourceEObj);
- boolean shallowCopy = (targetEObj != null) && isShallow(targetEObj);
+ CopyStatus status = getStatus(targetEObj);
- if((targetEObj != null) && !shallowCopy) {
- // copy already exists, return
+ if(status == CopyStatus.FULL || status == CopyStatus.INPROGRESS) {
+ // copy already exists, return targetEObj
return targetEObj;
}
- setShallow(targetEObj, false);
- if(sourceEObj == null) {
- // this case may happen, if elements were systematically copied without checking for
- // null references in the application code (e.g. if swe copy a part-with-port which might
- // be null in case of delegation or connectors without ports
- return null;
- }
+ boolean withinTemplate = withinTemplate(sourceEObj);
boolean sameResource = (sourceEObj.eResource() == source.eResource());
if(!sameResource && !copyExtReferences && !withinTemplate) {
// do not copy if within different resource, unless
@@ -387,7 +429,7 @@ public class Copy extends Copier {
Log.log(Status.ERROR, Log.TRAFO_COPY, "copy for meta-model element \"" + name + //$NON-NLS-1$
"\" requested. Return original element"); //$NON-NLS-1$
return sourceEObj;
- }
+ }
}
// additional sanity check: want to avoid copying (instead of instantiating) elements
// of a package template
@@ -397,13 +439,17 @@ public class Copy extends Copier {
}
}
- if(shallowCopy) {
- // shallowCopy is true: a copy exists already
+ if(status == CopyStatus.SHALLOW) {
+ // copy exists, but was a shallow copy, change status to INPROGRESS
+ setStatus(targetEObj, CopyStatus.INPROGRESS);
}
else {
targetEObj = createCopy(sourceEObj);
put(sourceEObj, targetEObj);
+ setStatus(targetEObj, CopyStatus.INPROGRESS);
+ // creates a shallow copy of the container. This container will update containment references (such as packagedElement)
+ // and thus update links
createShallowContainer(sourceEObj);
}
EClass eClass = sourceEObj.eClass();
@@ -425,9 +471,8 @@ public class Copy extends Copier {
// reference, which subsets the "owner" relationship.
// e.g. if an operation is referenced, we need to copy the whole interface
// Currently: only the standard owning reference is not copied recursively.
- // else if(!eReference.isContainer()) {
- else if(!eReference.getName().equals("owner")) {
- // not contained, but copy reference as well
+
+ else if (!eReference.getName().equals("owner")) { //$NON-NLS-1$
Object feature = sourceEObj.eGet(eStructuralFeature);
if(feature instanceof Element) {
copy((Element)feature);
@@ -441,11 +486,8 @@ public class Copy extends Copier {
}
copyProxyURI(sourceEObj, targetEObj);
copyID(sourceEObj, targetEObj);
-
- if(sourceEObj instanceof Element) {
- // TODO: handle stereotype copy in a generic way
- StUtils.copyStereotypes(this, (Element)sourceEObj, (Element)targetEObj);
- }
+ copyStereotypes(sourceEObj);
+ setStatus(targetEObj, CopyStatus.FULL);
for(CopyListener listener : postCopyListeners) {
EObject result = listener.copyEObject(this, targetEObj);
@@ -458,6 +500,56 @@ public class Copy extends Copier {
}
/**
+ * @param sourceEObj
+ * @return a copy, if it already exists. If it does not exist, return the
+ * source object itself, if no copy is required, otherwise return null.
+ */
+ public EObject noCopy(EObject sourceEObj) {
+ boolean withinTemplate = withinTemplate(sourceEObj);
+ boolean sameResource = (sourceEObj.eResource() == source.eResource());
+ if(!sameResource && !copyExtReferences && !withinTemplate) {
+ return sourceEObj;
+ }
+ else {
+ return get(sourceEObj);
+ }
+ }
+
+ /**
+ * Copy stereotype applications. Since stereotype applications are not part of the containment of an eObject, they are not copied by the
+ * generic function.
+ * A problem of copying stereotypes is that it may drag whole hierarchies with it, for instance if we copy the base_ attributes,
+ * we transform a shallow copy into a normal copy.
+ * => always make shallow copies of packages, never shallow copies of classes? [the split into fragments is solved, but the split of the system component???]
+ */
+ public void copyStereotypes(EObject sourceEObj, boolean duringShallow) {
+ if(sourceEObj instanceof Element) {
+
+ for (EObject stereoApplication : ((Element) sourceEObj).getStereotypeApplications()) {
+ EObject copiedStereoApplication = (duringShallow) ?
+ shallowCopy(stereoApplication) :
+ copy(stereoApplication);
+
+ if (copiedStereoApplication != null) {
+ // UMLUtil.setBaseElement(copiedStereoApplication, (Element) get(sourceEObj));
+ // add copied stereotype application to the resource (as top-level objects).
+ if (!target.eResource().getContents().contains(copiedStereoApplication)) {
+ target.eResource().getContents().add(copiedStereoApplication);
+ }
+ }
+ }
+ }
+ }
+
+ public void copyStereotypes(EObject sourceEObj) {
+ copyStereotypes(sourceEObj, false);
+ }
+
+ public void shallowCopyStereotypes(EObject sourceEObj) {
+ copyStereotypes(sourceEObj, true);
+ }
+
+ /**
* Copy the containment of an element with respect to a certain reference
*
* @see org.eclipse.emf.ecore.util.EcoreUtil.Copier#copyContainment(org.eclipse.emf.ecore.EReference, org.eclipse.emf.ecore.EObject,
@@ -520,8 +612,8 @@ public class Copy extends Copier {
target.clear();
} else {
for(EObject sourceEObj : source) {
- // if eObject has already been copied, add it
- EObject copyEObj = get(sourceEObj);
+ // if eObject has already been copied, add it to target
+ EObject copyEObj = noCopy(sourceEObj);
if((copyEObj != null) && (!target.contains(copyEObj))) {
target.add(copyEObj);
}
@@ -529,7 +621,8 @@ public class Copy extends Copier {
}
} else {
EObject childEObject = (EObject)eObject.eGet(eReference);
- copyEObject.eSet(getTarget(eReference), childEObject == null ? null : copy(childEObject));
+ // get will return null, if object should not be copied. In this case, we do not want to replace
+ copyEObject.eSet(getTarget(eReference), childEObject == null ? null : noCopy(childEObject));
}
}
}
@@ -545,31 +638,31 @@ public class Copy extends Copier {
EObject owner = sourceEObj.eContainer();
EObject copy = null;
EObject lastSource = null;
+ EList<EObject> copyStereoList = new BasicEList<EObject>();
while(owner != null) {
if(containsKey(owner)) {
// owner is in map, still need to re-copy (update) the containment
// references, since one of the children did not exist before
//
shallowCopy(owner);
+ if (lastSource != null) {
+ // StUtils.copyStereotypes(this, (Element)lastSource, (Element)copy);
+ }
return;
+ // break;
}
copy = shallowCopy(owner);
- if(copy instanceof NamedElement) {
- lastSource = owner;
- ((NamedElement)copy).setName(((NamedElement)owner).getName());
- }
+ // copyStereoList.add(sourceEObj);
owner = owner.eContainer();
}
+ // copy the stereotypes after the container has been created completely
+ for (EObject copyStereo : copyStereoList) {
+ copyStereotypes(copyStereo);
+ }
if(copy instanceof PackageableElement) {
// if we copy external resources, we might reach the "top" on the source level
// which becomes a sub-package of the new model.
target.getPackagedElements().add((PackageableElement)copy);
- // TODO: not very clean
- if(lastSource instanceof Element) {
- // TODO: cannot copy stereotypes only after creation, since eContainer does
- // not exist at this moment. Need to put that intelligently into createShallowContainer
- StUtils.copyStereotypes(this, (Element)lastSource, (Element)copy);
- }
}
}
@@ -583,26 +676,34 @@ public class Copy extends Copier {
* once a second class within the package has been copied => the packagedElements reference
* of the package will be updated).
*
+ * It is important that the implementation of this object does not make recursive calls.
+ * In particular, stereotypes are based on shallow copy as well. This means that stereotype
+ * attributes that reference other model elements will only be initialized if these elements
+ * exist already.
+ *
* @param sourceEObj
* @return
*/
public EObject shallowCopy(EObject sourceEObj) {
+ boolean first = false;
EObject targetEObj = get(sourceEObj);
if(targetEObj == null) {
targetEObj = createCopy(sourceEObj);
put(sourceEObj, targetEObj);
- setShallow(targetEObj, true);
- }
- else if(!isShallow(targetEObj)) {
- // object has already been completely copied
- // TODO: only allow shallow for packages
- // return targetEObj;
- }
- if((sourceEObj instanceof Element) && (targetEObj instanceof Element)) {
- // TODO: can copy stereotypes only after creation, since eContainer does
- // not exist at this moment. Need to put that intelligently into createShallowContainer
- StUtils.copyStereotypes(this, (Element)sourceEObj, (Element)targetEObj);
+ setStatus(targetEObj, CopyStatus.SHALLOW);
+ first = true;
+ }
+ else if(getStatus(targetEObj) == CopyStatus.FULL) {
+ // object has already been completely copied. Nothing to do, return targetEObj.
+ // Note that this implies that the update of references below is called for full copies
+ // in progress and shallow copies. The former assures that all copied elements have an
+ // eContainer during the call of pre-copy listeners (example: if a class is copied, its
+ // operations are recursively copied, the ownedOperation relationship is only updated
+ // *afterwards* by the code within the (full) copy operation).
+ return targetEObj;
}
+
+ shallowCopyStereotypes(sourceEObj);
EClass eClass = sourceEObj.eClass();
@@ -610,15 +711,14 @@ public class Copy extends Copier {
EStructuralFeature eStructuralFeature = eClass.getEStructuralFeature(i);
if(eStructuralFeature.isChangeable() && !eStructuralFeature.isDerived()) {
if(eStructuralFeature instanceof EAttribute) {
- // copyAttribute((EAttribute)eStructuralFeature, sourceEObj, targetEObj);
+ // copy all attributes during first pass after creation of target object
+ if (first) {
+ copyAttribute((EAttribute)eStructuralFeature, sourceEObj, targetEObj);
+ }
} else {
EReference eReference = (EReference)eStructuralFeature;
- // avoid that during create of shallow copy, a real copy is produced
- // (clarify why may elements are already copied)
- if(eReference.isContainment() && (!eReference.getName().equals("ownedTemplateSignature"))) {
-
- shallowCopyContainment(eReference, sourceEObj, targetEObj);
- }
+ // create a shallow copy of the containment: update only references already in the copy map
+ shallowCopyContainment(eReference, sourceEObj, targetEObj);
}
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CopyTo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CopyTo.java
new file mode 100644
index 00000000000..3961ba137c9
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/CopyTo.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.qompass.designer.core.transformations;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil.Copier;
+import org.eclipse.uml2.uml.Element;
+
+/**
+ * This class enables the copy from a source to a given target element.
+ * It assumes that a copy has already been created, but will just not copy it...
+ * Unlike the @see Copy class, the element might be copied to a different placed
+ */
+public class CopyTo {
+ /**
+ * Copy an element from the source to a target
+ *
+ * @param source The element that should be copied
+ * @param targetContainer The container into which it the source should be copied
+ * @return the copied object
+ */
+ public static <T extends Element> T copyTo(T source, Element targetContainer) {
+ Copier copier = new Copier();
+ EObject sourceContainer = source.eContainer();
+ if (sourceContainer != null)
+ copier.put(sourceContainer, targetContainer);
+
+ EObject copy = copier.copy(source);
+ copier.copyAll(source.getStereotypeApplications());
+ copier.copyReferences();
+ return (T) copy;
+ }
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
index 00e97ba0795..7197c307eff 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/InstantiateDepPlan.java
@@ -46,8 +46,10 @@ import org.eclipse.papyrus.qompass.designer.core.generate.GenerateCode;
import org.eclipse.papyrus.qompass.designer.core.generate.GenerationOptions;
import org.eclipse.papyrus.qompass.designer.core.templates.InstantiateCppIncludeWOB;
import org.eclipse.papyrus.qompass.designer.core.transformations.filters.FilterComments;
+import org.eclipse.papyrus.qompass.designer.core.transformations.filters.FilterRuleApplication;
import org.eclipse.papyrus.qompass.designer.core.transformations.filters.FilterStateMachines;
import org.eclipse.papyrus.qompass.designer.core.transformations.filters.FilterTemplate;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.uml2.uml.Classifier;
@@ -97,7 +99,7 @@ public class InstantiateDepPlan {
if(cdpOrConfig instanceof Package) {
cdp = (Package)cdpOrConfig;
MainModelTrafo.setConfiguration(null);
- } else if(StUtils.isApplied(cdpOrConfig, Configuration.class)) {
+ } else if(StereotypeUtil.isApplied(cdpOrConfig, Configuration.class)) {
configuration = UMLUtil.getStereotypeApplication(cdpOrConfig, Configuration.class);
DeploymentPlan fcmCDP = configuration.getDeploymentPlan();
if(fcmCDP == null) {
@@ -225,6 +227,7 @@ public class InstantiateDepPlan {
Copy targetCopy = new Copy(tmpModel, genModel, true);
// TODO: distribution to nodes is currently not done. How can it be realized with a copy filter ?
targetCopy.preCopyListeners.add(FilterStateMachines.getInstance());
+ targetCopy.preCopyListeners.add(FilterRuleApplication.getInstance());
targetCopy.postCopyListeners.add(InstantiateCppIncludeWOB.getInstance());
monitor.setTaskName("deploying for node " + node.getName());
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
index c82605b8d92..880e70d9b7c 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/LWContainerTrafo.java
@@ -28,6 +28,7 @@ import org.eclipse.papyrus.qompass.designer.core.acceleo.AcceleoDriverWrapper;
import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateInstantiation;
import org.eclipse.papyrus.qompass.designer.core.templates.TemplateUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
@@ -224,7 +225,7 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
// DepUtils.chooseImplementation((Class) type,
// new BasicEList<InstanceSpecification>(), false);
- if(StUtils.isApplied(part, InterceptionRule.class)) {
+ if(StereotypeUtil.isApplied(part, InterceptionRule.class)) {
// port.filter
//
}
@@ -325,7 +326,7 @@ public class LWContainerTrafo extends AbstractContainerTrafo {
}
}
}
- if(StUtils.isApplied(interceptionOperationInRule, Template.class)) {
+ if(StereotypeUtil.isApplied(interceptionOperationInRule, Template.class)) {
// pass operation in source model, since this enables acceleo code to check
// for markers on model
interceptionBody = AcceleoDriverWrapper.evaluate(interceptionBody, smOperation, null);
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
index 2e978b66df1..67b1d61af18 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/MainModelTrafo.java
@@ -44,6 +44,7 @@ import org.eclipse.papyrus.qompass.designer.core.deployment.DepCreation;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils;
import org.eclipse.papyrus.qompass.designer.core.deployment.DepUtils;
import org.eclipse.papyrus.qompass.designer.core.extensions.InstanceConfigurator;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Connector;
@@ -335,7 +336,7 @@ public class MainModelTrafo {
+ smIS.getName() + "\"");
}
StructuralFeature smPartDF = slot.getDefiningFeature();
- if(StUtils.isApplied(smPartDF.getType(), InteractionComponent.class)) {
+ if(StereotypeUtil.isApplied(smPartDF.getType(), InteractionComponent.class)) {
if(smPartDF instanceof Property) {
Property tmPart = ConnectorReification.reifyConnector(copy, tmComponent, (Property)smPartDF, tmIS, null);
// update value specification (to the one just created)
@@ -447,7 +448,7 @@ public class MainModelTrafo {
* for(Property part : smComponent.getOwnedAttributes()) {
* Type type = part.getType();
* if(type != null) {
- * if(StUtils.isApplied(type, InteractionComponent.class)) {
+ * if(StereotypeUtil.isApplied(type, InteractionComponent.class)) {
* ConnectorReification.reifyConnector(copy, tmComponent, part, tmIS, null);
* }
* }
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/UpdateUtils.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/UpdateUtils.java
index a87108be22f..259bb029206 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/UpdateUtils.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/UpdateUtils.java
@@ -19,7 +19,7 @@ import java.util.Iterator;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
import org.eclipse.papyrus.FCM.DerivedElement;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Package;
@@ -51,7 +51,7 @@ public class UpdateUtils {
Iterator<? extends Element> elements = list.iterator();
while(elements.hasNext()) {
Element element = elements.next();
- if(StUtils.isApplied(element, DerivedElement.class)) {
+ if(StereotypeUtil.isApplied(element, DerivedElement.class)) {
DerivedElement de = UMLUtil.getStereotypeApplication(element, DerivedElement.class);
if((de != null) && (de.getSource() == source)) {
return element;
@@ -62,12 +62,12 @@ public class UpdateUtils {
}
public static void setSource(Element derivedElement, Element source) {
- DerivedElement de = StUtils.applyApp(derivedElement, DerivedElement.class);
+ DerivedElement de = StereotypeUtil.applyApp(derivedElement, DerivedElement.class);
de.setSource(source);
}
public static Element getSource(Element element) {
- if(StUtils.isApplied(element, DerivedElement.class)) {
+ if(StereotypeUtil.isApplied(element, DerivedElement.class)) {
DerivedElement de = UMLUtil.getStereotypeApplication(element, DerivedElement.class);
if(de != null) {
return de.getSource();
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterRuleApplication.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterRuleApplication.java
new file mode 100644
index 00000000000..e84f6392cd4
--- /dev/null
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterRuleApplication.java
@@ -0,0 +1,45 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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:
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.qompass.designer.core.transformations.filters;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.FCM.RuleApplication;
+import org.eclipse.papyrus.qompass.designer.core.listeners.CopyListener;
+import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
+
+/**
+ * Filter the rule application stereotype. The rule application stereotype is not
+ * required in the target model (per node). It is harmful, since the container rule
+ * can contain interceptors which typically reference elements from package templates.
+ * These elements should not should be copied into the target model.
+ */
+public class FilterRuleApplication implements CopyListener {
+
+ public static FilterRuleApplication getInstance() {
+ if(instance == null) {
+ instance = new FilterRuleApplication();
+ }
+ return instance;
+ }
+
+ public EObject copyEObject(Copy copy, EObject sourceEObj) {
+ if(sourceEObj instanceof RuleApplication) {
+ return null;
+ }
+ return sourceEObj;
+ }
+
+ private static FilterRuleApplication instance = null;
+}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
index dd4556c7241..f1784d9e26b 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FilterTemplate.java
@@ -17,7 +17,7 @@ package org.eclipse.papyrus.qompass.designer.core.transformations.filters;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.papyrus.FCM.Connector;
import org.eclipse.papyrus.FCM.InteractionComponent;
-import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.papyrus.uml.tools.utils.StereotypeUtil;
import org.eclipse.papyrus.qompass.designer.core.listeners.CopyListener;
import org.eclipse.papyrus.qompass.designer.core.transformations.Copy;
import org.eclipse.uml2.uml.Class;
@@ -56,10 +56,10 @@ public class FilterTemplate implements CopyListener {
public EObject copyEObject(Copy copy, EObject sourceEObj) {
if(active && (sourceEObj instanceof Element)) {
Element sourceElem = (Element)sourceEObj;
- if((sourceEObj instanceof Connector) && StUtils.isApplied(sourceElem, Connector.class)) {
+ if((sourceEObj instanceof Connector) && StereotypeUtil.isApplied(sourceElem, Connector.class)) {
return null;
}
- if((sourceEObj instanceof Class) && StUtils.isApplied(sourceElem, InteractionComponent.class)) {
+ if((sourceEObj instanceof Class) && StereotypeUtil.isApplied(sourceElem, InteractionComponent.class)) {
return null;
}
}
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FixTemplateSync.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FixTemplateSync.java
index 4008b23062c..d1b0fbbb8bd 100644
--- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FixTemplateSync.java
+++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.designer.core/src/org/eclipse/papyrus/qompass/designer/core/transformations/filters/FixTemplateSync.java
@@ -26,10 +26,6 @@ import org.eclipse.uml2.uml.Class;
* Synchronize derived realizations (after copying). If re-synchronization is not done, the
* relationship would point to wrong interface, if it is derived and depending on a formal parameter.
* (e.g. derived push interface with formal parameter T would be at wrong location).
- *
- *
- * @author ansgar
- *
*/
public class FixTemplateSync implements CopyListener {

Back to the top