diff options
author | Ansgar Radermacher | 2014-01-08 16:17:10 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2014-01-08 16:28:07 +0000 |
commit | bd07552d45da53a4ca1a42304a9e1279b46c8930 (patch) | |
tree | fc719fd771e304aae6bf2b2d7e498a80c556b27e /extraplugins/qompass-designer/tracing | |
parent | bcf7a4b1d02468d255ad131a37ebd4730545d089 (diff) | |
download | org.eclipse.papyrus-bd07552d45da53a4ca1a42304a9e1279b46c8930.tar.gz org.eclipse.papyrus-bd07552d45da53a4ca1a42304a9e1279b46c8930.tar.xz org.eclipse.papyrus-bd07552d45da53a4ca1a42304a9e1279b46c8930.zip |
Bug 424927 - [QDesigner] Instance configurators should be applicable to all components
Diffstat (limited to 'extraplugins/qompass-designer/tracing')
4 files changed, 30 insertions, 19 deletions
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/models/library/tracing.uml b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/models/library/tracing.uml index 46a85218782..2a7232c407c 100644 --- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/models/library/tracing.uml +++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/models/library/tracing.uml @@ -45,7 +45,7 @@ <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="_mfTKMBavEeGq1uSGvh4rcQ" value="1"/> <defaultValue xmi:type="uml:LiteralBoolean" xmi:id="_u-498Ba1EeGq1uSGvh4rcQ"/> </ownedAttribute> - <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_aF1w6DKeEd-WprEKTCaiMA" name="<%name%>" specification="_aF1w7zKeEd-WprEKTCaiMA"> + <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_aF1w6DKeEd-WprEKTCaiMA" name="[name/]" specification="_aF1w7zKeEd-WprEKTCaiMA"> <language>C/C++</language> <body>[import org::eclipse::papyrus::qompass::designer::core::acceleo::UMLTool/] [import org::eclipse::papyrus::qompass::designer::core::acceleo::utils_cpp/] @@ -247,7 +247,7 @@ OTF_Writer_writeDefFunction (writer, streamNr, <%enumSvcPrefix%>::id_<%own <ownedAttribute xmi:type="uml:Property" xmi:id="_EWKx4KD0EeCFDJJCA2W5wg" name="m_first"> <type xmi:type="uml:PrimitiveType" href="pathmap://QML_CORE/corba.uml#_Bv7l0B-VEd6nGq8wpI2tjg"/> </ownedAttribute> - <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_4LoXcKAeEeCF0uoVQbVQRg" name="<%name%>" specification="_k4TsoKAeEeCF0uoVQbVQRg"> + <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_4LoXcKAeEeCF0uoVQbVQRg" name="[name/]" specification="_k4TsoKAeEeCF0uoVQbVQRg"> <language>C/C++</language> <body>// <instance>_<port>_<operation> // easier: <component>_<port>_<operation> @@ -307,7 +307,7 @@ if (doTrace) { <language>C/C++</language> <body>m_first = true;</body> </ownedBehavior> - <ownedOperation xmi:type="uml:Operation" xmi:id="_k4TsoKAeEeCF0uoVQbVQRg" name="<%name%>" method="_4LoXcKAeEeCF0uoVQbVQRg"/> + <ownedOperation xmi:type="uml:Operation" xmi:id="_k4TsoKAeEeCF0uoVQbVQRg" name="[name/]" method="_4LoXcKAeEeCF0uoVQbVQRg"/> <ownedOperation xmi:type="uml:Operation" xmi:id="_rlkwoKD0EeCFDJJCA2W5wg" name="OTFTrace_vc" method="_CyKWkKD2EeCFDJJCA2W5wg"/> </packagedElement> <packagedElement xmi:type="uml:Dependency" xmi:id="_Mgn2cKKXEeCdIOXlyrCmKQ" name="OTFTrace_vc => BString" client="_aoSDwKAdEeCF0uoVQbVQRg"> @@ -653,6 +653,7 @@ return processID;</body> </uml:Model> <l2:ModelLibrary xmi:id="_ICaAoDKeEd-WprEKTCaiMA" base_Package="_H-ZqYDKeEd-WprEKTCaiMA"/> <FCM:Template xmi:id="_bKc-kDNZEd-0bO2vHbUkEA" base_Element="_aF1w7zKeEd-WprEKTCaiMA" kind="LoopOperations"> + <helper xmi:type="FCM:BindingHelper" href="pathmap://QML_CORE/core.uml#_nLe_sHJDEeOMF7YEvnQt5g"/> <formalParam xmi:type="uml:Interface" href="pathmap://QML_CORE/core.uml#_ZzlzMPfBEd2TbIfwytOyPA"/> <templateParam xmi:type="uml:Interface" href="pathmap://QML_CORE/core.uml#_ZzlzMPfBEd2TbIfwytOyPA"/> </FCM:Template> @@ -727,7 +728,9 @@ return processID;</body> <FCM:ContainerRule xmi:id="_6FqQoKAdEeCF0uoVQbVQRg" base_Class="_wHuA0KAdEeCF0uoVQbVQRg" extensionKind="InterceptAllPorts" interceptor="_JvP0oKAeEeCF0uoVQbVQRg" propagate="true"> <forConfig xmi:type="FCM:ConfigOption" href="pathmap://QML_CORE/core.uml#_u6LqoH7eEd-FNNgSS03RxQ"/> </FCM:ContainerRule> - <FCM:Template xmi:id="_pplDQKAeEeCF0uoVQbVQRg" base_Element="_k4TsoKAeEeCF0uoVQbVQRg" kind="LoopOperations"/> + <FCM:Template xmi:id="_pplDQKAeEeCF0uoVQbVQRg" base_Element="_k4TsoKAeEeCF0uoVQbVQRg" kind="LoopOperations"> + <helper xmi:type="FCM:BindingHelper" href="pathmap://QML_CORE/core.uml#_nLe_sHJDEeOMF7YEvnQt5g"/> + </FCM:Template> <FCM:InstanceConfigurator xmi:id="_nTMOYKbnEeC0_qP7CUZIiQ" base_Class="_kIcwsKbnEeC0_qP7CUZIiQ"/> <FCM:UseInstanceConfigurator xmi:id="_plb90KbnEeC0_qP7CUZIiQ" base_Class="_aF1w4DKeEd-WprEKTCaiMA" configurator="_nUB1YC8HEeKwPrQVP28AQw"/> <FCM:UseInstanceConfigurator xmi:id="_MmzO0KboEeC0_qP7CUZIiQ" base_Class="_aoSDwKAdEeCF0uoVQbVQRg" configurator="_nUB1YC8HEeKwPrQVP28AQw"/> diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java index 48cf53a4695..3ebfe5a3d26 100644 --- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java +++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java @@ -4,10 +4,11 @@ import org.eclipse.papyrus.qompass.designer.core.PortUtils; import org.eclipse.papyrus.qompass.designer.core.Utils; import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils; import org.eclipse.papyrus.qompass.designer.core.extensions.IInstanceConfigurator; -import org.eclipse.papyrus.qompass.designer.core.transformations.ContainerContext; +import org.eclipse.papyrus.qompass.designer.core.transformations.ContainerTrafo; import org.eclipse.uml2.uml.InstanceSpecification; import org.eclipse.uml2.uml.Interface; import org.eclipse.uml2.uml.Operation; +import org.eclipse.uml2.uml.Port; import org.eclipse.uml2.uml.Property; @@ -22,32 +23,36 @@ public class IConfiguratorOTF implements IInstanceConfigurator { * * @see org.eclipse.papyrus.qompass.designer.gentools.core.extensions.IInstanceConfigurator */ - public void configureInstance(InstanceSpecification instance, Property componentPart, ContainerContext context) { + public void configureInstance(InstanceSpecification instance, Property componentPart, InstanceSpecification parentInstance) { // The tracing code needs informations about the component instance and port. DepPlanUtils.configureProperty(instance, PROP_INSTANCE_NAME, StringConstants.QUOTE + instance.getName() + StringConstants.QUOTE); // port in context => interception of port => provide information about port and interface - if(context.port != null) { + ContainerTrafo containerTrafo = ContainerTrafo.getContainerTrafo(parentInstance); + if (containerTrafo == null) { + return; + } + Port port = containerTrafo.getInterceptedPort(componentPart); + if(port != null) { // obtain required or provided interface (TODO: will fail, if both are provided!) - Interface intf = PortUtils.getProvided(context.port); + Interface intf = PortUtils.getProvided(port); if(intf == null) { - intf = PortUtils.getRequired(context.port); + intf = PortUtils.getRequired(port); } - DepPlanUtils.configureProperty(instance, PROP_PORT_NAME, StringConstants.QUOTE + context.port.getName() + StringConstants.QUOTE); + DepPlanUtils.configureProperty(instance, PROP_PORT_NAME, StringConstants.QUOTE + port.getName() + StringConstants.QUOTE); if(intf != null) { // this is specific for OTF: // each container contains an attribute (id_<name>) for each operation. This is configured here, // since we add instance information to the trace (is that useful??, seems like a hack) + // TODO: originally, we used executorIS *in source model* for(Operation op : intf.getOperations()) { - String id = Utils.getTop(context.executorIS).getName() + "::Tracing::Trace::ID_" + //$NON-NLS-1$ - context.executorIS.getName().replace(".", "_") + "_" + op.getName(); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + String id = Utils.getTop(instance).getName() + "::Tracing::Trace::ID_" + //$NON-NLS-1$ + instance.getName().replace(".", "_") + "_" + op.getName(); //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ DepPlanUtils.configureProperty(instance, "id_" + op.getName(), id); //$NON-NLS-1$ } } } - - } } diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java index 43de8b800c1..c921ce96a3c 100644 --- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java +++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java @@ -2,9 +2,9 @@ package org.eclipse.papyrus.qompass.modellibs.tracing; import org.eclipse.papyrus.qompass.designer.core.deployment.DepPlanUtils; import org.eclipse.papyrus.qompass.designer.core.extensions.IInstanceConfigurator; -import org.eclipse.papyrus.qompass.designer.core.transformations.ContainerContext; import org.eclipse.papyrus.qompass.designer.core.transformations.ContainerTrafo; import org.eclipse.uml2.uml.InstanceSpecification; +import org.eclipse.uml2.uml.Port; import org.eclipse.uml2.uml.Property; public class IConfiguratorTrace implements IInstanceConfigurator { @@ -18,7 +18,7 @@ public class IConfiguratorTrace implements IInstanceConfigurator { * * @see org.eclipse.papyrus.qompass.designer.gentools.core.extensions.IInstanceConfigurator */ - public void configureInstance(InstanceSpecification instance, Property componentPart, ContainerContext context) { + public void configureInstance(InstanceSpecification instance, Property componentPart, InstanceSpecification parentInstance) { // The tracing code needs informations about the component instance and port. String instanceName = instance.getName(); @@ -33,8 +33,12 @@ public class IConfiguratorTrace implements IInstanceConfigurator { DepPlanUtils.configureProperty(instance, PROP_INSTANCE_NAME, StringConstants.QUOTE + instanceName + StringConstants.QUOTE); // port in context => interception of port => provide information about port and interface - if(context.port != null) { - DepPlanUtils.configureProperty(instance, PROP_PORT_NAME, StringConstants.QUOTE + context.port.getName() + StringConstants.QUOTE); + ContainerTrafo containerTrafo = ContainerTrafo.getContainerTrafo(parentInstance); + if (containerTrafo != null) { + Port port = containerTrafo.getInterceptedPort(componentPart); + if(port != null) { + DepPlanUtils.configureProperty(instance, PROP_PORT_NAME, StringConstants.QUOTE + port.getName() + StringConstants.QUOTE); + } } } } diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/StringConstants.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/StringConstants.java index 171fece98a4..d3ced2536a6 100644 --- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/StringConstants.java +++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/StringConstants.java @@ -2,5 +2,4 @@ package org.eclipse.papyrus.qompass.modellibs.tracing; public class StringConstants { public static final String QUOTE = "\""; //$NON-NLS-1$ - } |