Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-01-08 11:17:10 -0500
committerAnsgar Radermacher2014-01-08 11:28:07 -0500
commitbd07552d45da53a4ca1a42304a9e1279b46c8930 (patch)
treefc719fd771e304aae6bf2b2d7e498a80c556b27e /extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src
parentbcf7a4b1d02468d255ad131a37ebd4730545d089 (diff)
downloadorg.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/org.eclipse.papyrus.qompass.modellibs.tracing/src')
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java25
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java12
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/StringConstants.java1
3 files changed, 23 insertions, 15 deletions
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$
-
}

Back to the top