diff options
author | aradermache | 2013-06-20 07:48:23 +0000 |
---|---|---|
committer | aradermache | 2013-06-20 07:48:23 +0000 |
commit | c3c8e04b04a1bcd62c4c72bac28ff7bff07445e3 (patch) | |
tree | 53611c1e626a5d36fb22d546f162beafcce3ffeb /extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src | |
parent | a3973d785ca84a6b7ff81cf47f663e30a7b98d0c (diff) | |
download | org.eclipse.papyrus-c3c8e04b04a1bcd62c4c72bac28ff7bff07445e3.tar.gz org.eclipse.papyrus-c3c8e04b04a1bcd62c4c72bac28ff7bff07445e3.tar.xz org.eclipse.papyrus-c3c8e04b04a1bcd62c4c72bac28ff7bff07445e3.zip |
- Do not re-calculate derived interfaces any more as a side effect of retrieving the interface
- Better comments
- Flatten interaction components
Diffstat (limited to 'extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src')
16 files changed, 286 insertions, 99 deletions
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/CallEventConfigurator.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/CallEventConfigurator.java index 37962f0cf26..8b29d06e227 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/CallEventConfigurator.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/CallEventConfigurator.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core; import org.eclipse.papyrus.qompass.designer.core.acceleo.UMLTool; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/HelloWorldModelWizard.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/HelloWorldModelWizard.java index a5cc725f5b4..6328d7eee46 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/HelloWorldModelWizard.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/HelloWorldModelWizard.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core; public class HelloWorldModelWizard extends ModelCopyWizard { diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ModelCopyWizard.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ModelCopyWizard.java index ff2e7874aea..022a9eb592d 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ModelCopyWizard.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ModelCopyWizard.java @@ -1,14 +1,17 @@ -/** - * Copyright CEA-LIST 2009 - * available under EPL 1.0 licence - * - * This file is part of the Qompass tool chain (www.ec3m.net) - * +/***************************************************************************** + * 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 * - * $Id$ - * Initial developer - Ansgar Radermacher - */ + * Contributors: + * Ansgar Radermacher ansgar.radermacher@cea.fr + * + *****************************************************************************/ + package org.eclipse.papyrus.qompass.modellibs.core; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ProducerConsumerModelWizard.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ProducerConsumerModelWizard.java index 7d3a4f8364e..eceb42d8859 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ProducerConsumerModelWizard.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/ProducerConsumerModelWizard.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core; public class ProducerConsumerModelWizard extends ModelCopyWizard { diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/StateMachineUtil.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/StateMachineUtil.java index 2985bb255ec..4d2ec77d755 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/StateMachineUtil.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/StateMachineUtil.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.acceleo; import org.eclipse.papyrus.qompass.designer.core.Utils; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/TransitionService.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/TransitionService.java index b24d8661bed..25fb4255d55 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/TransitionService.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/acceleo/TransitionService.java @@ -1,13 +1,17 @@ -/*******************************************************************************
- * Copyright (c) 2006 CEA List.
+/*****************************************************************************
+ * 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:
- * CEA List - initial API and implementation
- *******************************************************************************/
+ * Ansgar Radermacher ansgar.radermacher@cea.fr
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.qompass.modellibs.core.acceleo;
import org.eclipse.emf.common.util.EList;
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/embeddingrules/AccordCall.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/embeddingrules/AccordCall.java index cd23ce697a4..33aa92577d3 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/embeddingrules/AccordCall.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/embeddingrules/AccordCall.java @@ -1,18 +1,32 @@ +/*****************************************************************************
+ * 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.modellibs.core.embeddingrules;
import java.util.ArrayList;
import java.util.List;
-import org.eclipse.uml2.uml.ConnectableElement;
-import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.papyrus.FCM.Connector;
import org.eclipse.papyrus.FCM.util.ConnectorTypeUtil;
import org.eclipse.papyrus.FCM.util.FCMUtil;
import org.eclipse.papyrus.qompass.designer.core.StUtils;
+import org.eclipse.uml2.uml.ConnectableElement;
+import org.eclipse.uml2.uml.NamedElement;
/**
* Embedding rule
- * @author ansgar
+ * TODO: currently unused
*
*/
// @unused
diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort.java index d73c4ea2b41..82f689457c2 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.papyrus.FCM.util.IMappingRule; @@ -37,21 +51,17 @@ import org.eclipse.uml2.uml.Type; */ public class ExtendedPort implements IMappingRule { - public int needsTransaction() { - return IMappingRule.BOTH; - } - - public Interface getProvided(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config) + public Interface getProvided(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config, boolean update) { - return getDerived(p, false, config); + return getDerived(p, false, config, update); } - public Interface getRequired(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config) + public Interface getRequired(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config, boolean update) { - return getDerived(p, true, config); + return getDerived(p, true, config, update); } - public Interface getDerived(org.eclipse.papyrus.FCM.Port extPort, boolean isRequired, InstanceSpecification config) + public Interface getDerived(org.eclipse.papyrus.FCM.Port extPort, boolean isRequired, InstanceSpecification config, boolean update) { Type type = extPort.getBase_Port().getType(); if(!(type instanceof Classifier)) { @@ -60,7 +70,10 @@ public class ExtendedPort implements IMappingRule { Class extendedPort = extPort.getKind().getBase_Class(); String prefix = extendedPort.getName() + "_" + (isRequired ? "R_" : "P_"); - Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(extPort, prefix, type); + Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(extPort, prefix, type, update); + if (!update) { + return derivedInterface; + } if(derivedInterface == null) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort2.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort2.java index c9c58eab5a6..e6470e55382 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort2.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ExtendedPort2.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.papyrus.FCM.util.IMappingRule; @@ -27,26 +41,20 @@ import org.eclipse.uml2.uml.Type; * * What is the difference to ExtendedPort? * - * @author ansgar - * */ public class ExtendedPort2 implements IMappingRule { - public int needsTransaction() { - return IMappingRule.BOTH; - } - - public Interface getProvided(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config) + public Interface getProvided(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config, boolean update) { - return getDerived(p, p.getBase_Port().isConjugated(), config); + return getDerived(p, p.getBase_Port().isConjugated(), config, update); } - public Interface getRequired(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config) + public Interface getRequired(org.eclipse.papyrus.FCM.Port p, InstanceSpecification config, boolean update) { - return getDerived(p, !p.getBase_Port().isConjugated(), config); + return getDerived(p, !p.getBase_Port().isConjugated(), config, update); } - public Interface getDerived(org.eclipse.papyrus.FCM.Port extPort, boolean isConjugated, InstanceSpecification config) + public Interface getDerived(org.eclipse.papyrus.FCM.Port extPort, boolean isConjugated, InstanceSpecification config, boolean update) { Type type = extPort.getBase_Port().getType(); if(!(type instanceof Class)) @@ -55,6 +63,9 @@ public class ExtendedPort2 implements IMappingRule { Class extendedPort = (Class)type; String prefix = isConjugated ? "C2_" : "N2_"; Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(extPort, prefix, type); + if (!update) { + return derivedInterface; + } if(derivedInterface == null) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ProvideInterface.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ProvideInterface.java index be8fdf04e31..e6f47228fe3 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ProvideInterface.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/ProvideInterface.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.papyrus.FCM.Port; @@ -8,11 +22,7 @@ import org.eclipse.uml2.uml.Type; public class ProvideInterface implements IMappingRule { - public int needsTransaction () { - return IMappingRule.NONE; - } - - public Interface getProvided (Port p, InstanceSpecification config) + public Interface getProvided (Port p, InstanceSpecification config, boolean update) { Type type = p.getBase_Port ().getType (); if (type instanceof Interface) { @@ -21,7 +31,7 @@ public class ProvideInterface implements IMappingRule return null; } - public Interface getRequired (Port p, InstanceSpecification config) + public Interface getRequired (Port p, InstanceSpecification config, boolean update) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PullConsumer.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PullConsumer.java index fda6578791e..5eaa70757be 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PullConsumer.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PullConsumer.java @@ -1,6 +1,25 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.FCM.Port; +import org.eclipse.papyrus.FCM.util.IMappingRule; +import org.eclipse.papyrus.FCM.util.MapUtil; +import org.eclipse.papyrus.qompass.designer.core.Log; +import org.eclipse.papyrus.qompass.designer.core.Utils; import org.eclipse.uml2.uml.DataType; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.InstanceSpecification; @@ -12,11 +31,6 @@ import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Signal; import org.eclipse.uml2.uml.Type; -import org.eclipse.papyrus.FCM.Port; -import org.eclipse.papyrus.FCM.util.IMappingRule; -import org.eclipse.papyrus.FCM.util.MapUtil; -import org.eclipse.papyrus.qompass.designer.core.Log; -import org.eclipse.papyrus.qompass.designer.core.Utils; /** * Will generate a suitable callable interface pulling consumer. The port is typed with a primitive type @@ -26,14 +40,10 @@ import org.eclipse.papyrus.qompass.designer.core.Utils; */ public class PullConsumer implements IMappingRule { - public Interface getProvided(Port p, InstanceSpecification config) { + public Interface getProvided(Port p, InstanceSpecification config, boolean update) { return null; } - public int needsTransaction() { - return IMappingRule.REQUIRED; - } - public static PullConsumer getInstance() { if(instance == null) { instance = new PullConsumer(); @@ -41,7 +51,7 @@ public class PullConsumer implements IMappingRule { return instance; } - public Interface getRequired(Port p, InstanceSpecification config) { + public Interface getRequired(Port p, InstanceSpecification config, boolean update) { org.eclipse.uml2.uml.Port umlPort = p.getBase_Port(); Element owner = umlPort.getOwner(); String ownerStr = ""; @@ -55,6 +65,9 @@ public class PullConsumer implements IMappingRule { if((type instanceof PrimitiveType) || (type instanceof DataType) || (type instanceof Signal)) { Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(p, "PullConsumer_", type); + if (!update) { + return derivedInterface; + } if(derivedInterface == null) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushConsumer.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushConsumer.java index 2fbea5f70ee..afa74b7c1db 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushConsumer.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushConsumer.java @@ -1,6 +1,24 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.FCM.Port; +import org.eclipse.papyrus.FCM.util.IMappingRule; +import org.eclipse.papyrus.FCM.util.MapUtil; +import org.eclipse.papyrus.qompass.designer.core.Log; import org.eclipse.uml2.uml.DataType; import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.Interface; @@ -9,10 +27,6 @@ import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Signal; import org.eclipse.uml2.uml.Type; -import org.eclipse.papyrus.FCM.Port; -import org.eclipse.papyrus.FCM.util.IMappingRule; -import org.eclipse.papyrus.FCM.util.MapUtil; -import org.eclipse.papyrus.qompass.designer.core.Log; /** * Will generate a suitable called interface push consumer. The port is typed with a primitive type @@ -24,11 +38,7 @@ import org.eclipse.papyrus.qompass.designer.core.Log; */ public class PushConsumer implements IMappingRule { - public int needsTransaction() { - return IMappingRule.PROVIDED; - } - - public Interface getProvided(Port p, InstanceSpecification config) { + public Interface getProvided(Port p, InstanceSpecification config, boolean update) { Log.log(Log.INFO_MSG, Log.CALC_PORTKIND, p.getKind().getBase_Class().getName() + " => GetProvided on " + p.getBase_Port().getName()); Type type = p.getBase_Port().getType(); @@ -36,6 +46,10 @@ public class PushConsumer implements IMappingRule { if((type instanceof PrimitiveType) || (type instanceof DataType) || (type instanceof Signal)) { Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(p, "Push_", type); + if (!update) { + return derivedInterface; + } + if(derivedInterface == null) { // may happen, if within template (do not want creation of derived interfaces in template) return null; @@ -59,7 +73,7 @@ public class PushConsumer implements IMappingRule { } } - public Interface getRequired(Port p, InstanceSpecification config) { + public Interface getRequired(Port p, InstanceSpecification config, boolean update) { return null; } } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProdPullCons.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProdPullCons.java index 69405ce7b87..126d896e5b9 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProdPullCons.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProdPullCons.java @@ -1,5 +1,23 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; +import org.eclipse.papyrus.FCM.Port; +import org.eclipse.papyrus.FCM.util.IMappingRule; +import org.eclipse.papyrus.FCM.util.MapUtil; +import org.eclipse.papyrus.qompass.designer.core.Log; import org.eclipse.uml2.uml.DataType; import org.eclipse.uml2.uml.Element; import org.eclipse.uml2.uml.InstanceSpecification; @@ -8,10 +26,6 @@ import org.eclipse.uml2.uml.NamedElement; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Signal; import org.eclipse.uml2.uml.Type; -import org.eclipse.papyrus.FCM.Port; -import org.eclipse.papyrus.FCM.util.IMappingRule; -import org.eclipse.papyrus.FCM.util.MapUtil; -import org.eclipse.papyrus.qompass.designer.core.Log; /** * Will generate a suitable callable interface pulling consumer. The port is typed with a primitive type @@ -21,15 +35,11 @@ import org.eclipse.papyrus.qompass.designer.core.Log; */ public class PushProdPullCons implements IMappingRule { - public Interface getProvided(Port p, InstanceSpecification config) { + public Interface getProvided(Port p, InstanceSpecification config, boolean update) { return null; } - public int needsTransaction() { - return IMappingRule.REQUIRED; - } - - public Interface getRequired(Port p, InstanceSpecification config) { + public Interface getRequired(Port p, InstanceSpecification config, boolean update) { org.eclipse.uml2.uml.Port umlPort = p.getBase_Port(); Element owner = umlPort.getOwner(); String ownerStr = ""; @@ -43,11 +53,14 @@ public class PushProdPullCons implements IMappingRule { if((type instanceof PrimitiveType) || (type instanceof DataType) || (type instanceof Signal)) { Interface derivedInterface = MapUtil.getOrCreateDerivedInterface(p, "_", type); + if (!update) { + return derivedInterface; + } // obtain derived interface for other port kind (Caveat: some rules get the prefix from the // name of the port kind attached to port "p" which would produce wrong results. - Interface derivedInterfacePushProd = PushProducer.getInstance().getRequired(p, config); - Interface derivedInterfacePullCons = PullConsumer.getInstance().getRequired(p, config); + Interface derivedInterfacePushProd = PushProducer.getInstance().getRequired(p, config, update); + Interface derivedInterfacePullCons = PullConsumer.getInstance().getRequired(p, config, update); if(derivedInterface == null) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProducer.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProducer.java index de2af09dced..87b88cbda1f 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProducer.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/PushProducer.java @@ -1,6 +1,24 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.emf.common.util.EList; +import org.eclipse.papyrus.FCM.Port; +import org.eclipse.papyrus.FCM.util.IMappingRule; +import org.eclipse.papyrus.FCM.util.MapUtil; +import org.eclipse.papyrus.qompass.designer.core.Log; import org.eclipse.uml2.uml.DataType; import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.Interface; @@ -9,10 +27,6 @@ import org.eclipse.uml2.uml.Parameter; import org.eclipse.uml2.uml.PrimitiveType; import org.eclipse.uml2.uml.Signal; import org.eclipse.uml2.uml.Type; -import org.eclipse.papyrus.FCM.Port; -import org.eclipse.papyrus.FCM.util.IMappingRule; -import org.eclipse.papyrus.FCM.util.MapUtil; -import org.eclipse.papyrus.qompass.designer.core.Log; /** * Will generate a suitable callable interface push provider. The port is typed with a primitive type @@ -24,14 +38,10 @@ import org.eclipse.papyrus.qompass.designer.core.Log; */ public class PushProducer implements IMappingRule { - public Interface getProvided(Port p, InstanceSpecification config) { + public Interface getProvided(Port p, InstanceSpecification config, boolean update) { return null; } - public int needsTransaction() { - return IMappingRule.REQUIRED; - } - public static PushProducer getInstance() { if(instance == null) { instance = new PushProducer(); @@ -39,13 +49,16 @@ public class PushProducer implements IMappingRule { return instance; } - public Interface getRequired(Port p, InstanceSpecification config) { + public Interface getRequired(Port p, InstanceSpecification config, boolean update) { Log.log(Log.INFO_MSG, Log.CALC_PORTKIND, p.getKind().getBase_Class().getName() + " => GetRequired on " + p.getBase_Port().getName()); Type type = p.getBase_Port().getType(); if((type instanceof PrimitiveType) || (type instanceof DataType) || (type instanceof Signal)) { Interface derivedInterface = MapUtil.getOrCreateDerivedInterfaceFP(p, "Push_", type); + if (!update) { + return derivedInterface; + } if(derivedInterface == null) { // may happen, if within template (do not want creation of derived interfaces in template) return null; diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseConjIntf.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseConjIntf.java index 44e0abba251..e51a4775e38 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseConjIntf.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseConjIntf.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import java.util.Iterator; @@ -26,20 +40,19 @@ import org.eclipse.uml2.uml.Type; */ public class UseConjIntf implements IMappingRule { - public int needsTransaction () { - return IMappingRule.REQUIRED; - } - - public Interface getProvided (Port p, InstanceSpecification config) { + public Interface getProvided (Port p, InstanceSpecification config, boolean update) { return null; } - public Interface getRequired (Port p, InstanceSpecification config) { + public Interface getRequired (Port p, InstanceSpecification config, boolean update) { Type type = p.getBase_Port ().getType (); if (!(type instanceof Interface)) return null; Interface typingInterface = (Interface) type; Interface derivedInterface = MapUtil.getOrCreateDerivedInterface (p, "_", type); + if (!update) { + return derivedInterface; + } if (derivedInterface == null) { return null; } diff --git a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseInterface.java b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseInterface.java index 3f06ed4c567..39c65a29d73 100644 --- a/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseInterface.java +++ b/extraplugins/qompass-designer/org.eclipse.papyrus.qompass.modellibs.core/src/org/eclipse/papyrus/qompass/modellibs/core/mappingrules/UseInterface.java @@ -1,3 +1,17 @@ +/***************************************************************************** + * 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.modellibs.core.mappingrules; import org.eclipse.papyrus.FCM.Port; @@ -9,16 +23,12 @@ import org.eclipse.uml2.uml.Type; public class UseInterface implements IMappingRule { - public int needsTransaction () { - return IMappingRule.NONE; - } - - public Interface getProvided(Port p, InstanceSpecification config) + public Interface getProvided(Port p, InstanceSpecification config, boolean update) { - return null ; + return null; } - public Interface getRequired(Port p, InstanceSpecification config) + public Interface getRequired(Port p, InstanceSpecification config, boolean update) { Type type = p.getBase_Port ().getType (); if (type instanceof Interface) { |