Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCamille Letavernier2014-08-21 07:37:18 -0400
committerCamille Letavernier2014-08-21 07:37:18 -0400
commitea48a20561464c3cbb7895d430583669a9f82fcc (patch)
tree0fdf9eebacbbb301b13bafce3ca4a6952ff6e91c /extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src
parentf91b71175fd97557cf378cdcad845a44a6274b16 (diff)
downloadorg.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.tar.gz
org.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.tar.xz
org.eclipse.papyrus-ea48a20561464c3cbb7895d430583669a9f82fcc.zip
[Code style] Apply clean-up and formatter on Extra plug-ins
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/Activator.java4
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/ClientServerTraceTestModelWizard.java4
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorOTF.java17
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/IConfiguratorTrace.java9
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java77
-rw-r--r--extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/acceleo/TraceUtils.java10
6 files changed, 65 insertions, 56 deletions
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/Activator.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/Activator.java
index a9e29bfc7a2..28df7278813 100644
--- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/Activator.java
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/Activator.java
@@ -25,6 +25,7 @@ public class Activator extends AbstractUIPlugin {
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
*/
+ @Override
public void start(BundleContext context) throws Exception {
super.start(context);
plugin = this;
@@ -35,6 +36,7 @@ public class Activator extends AbstractUIPlugin {
*
* @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
*/
+ @Override
public void stop(BundleContext context) throws Exception {
plugin = null;
super.stop(context);
@@ -42,7 +44,7 @@ public class Activator extends AbstractUIPlugin {
/**
* Returns the shared instance
- *
+ *
* @return the shared instance
*/
public static Activator getDefault() {
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/ClientServerTraceTestModelWizard.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/ClientServerTraceTestModelWizard.java
index 92faae26a08..ad9530592fc 100644
--- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/ClientServerTraceTestModelWizard.java
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/ClientServerTraceTestModelWizard.java
@@ -7,8 +7,8 @@ import org.eclipse.papyrus.uml.diagram.wizards.ModelCopyWizard;
*/
public class ClientServerTraceTestModelWizard extends ModelCopyWizard {
-
- public ClientServerTraceTestModelWizard () {
+
+ public ClientServerTraceTestModelWizard() {
super("ClientServerTraceTest"); //$NON-NLS-1$
}
}
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 3ebfe5a3d26..b340f8b3a60 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
@@ -17,39 +17,40 @@ public class IConfiguratorOTF implements IInstanceConfigurator {
static final String PROP_PORT_NAME = "portName"; //$NON-NLS-1$
static final String PROP_INSTANCE_NAME = "instanceName"; //$NON-NLS-1$
-
+
/**
* Configure the passed trace instance
- *
+ *
* @see org.eclipse.papyrus.qompass.designer.gentools.core.extensions.IInstanceConfigurator
*/
+ @Override
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
ContainerTrafo containerTrafo = ContainerTrafo.getContainerTrafo(parentInstance);
if (containerTrafo == null) {
return;
}
Port port = containerTrafo.getInterceptedPort(componentPart);
- if(port != null) {
+ if (port != null) {
// obtain required or provided interface (TODO: will fail, if both are provided!)
Interface intf = PortUtils.getProvided(port);
- if(intf == null) {
+ if (intf == null) {
intf = PortUtils.getRequired(port);
}
DepPlanUtils.configureProperty(instance, PROP_PORT_NAME, StringConstants.QUOTE + port.getName() + StringConstants.QUOTE);
- if(intf != null) {
+ 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()) {
+ for (Operation op : intf.getOperations()) {
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$
+ 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 c921ce96a3c..d734ab42717 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
@@ -15,17 +15,18 @@ public class IConfiguratorTrace implements IInstanceConfigurator {
/**
* Configure the passed trace instance
- *
+ *
* @see org.eclipse.papyrus.qompass.designer.gentools.core.extensions.IInstanceConfigurator
*/
+ @Override
public void configureInstance(InstanceSpecification instance, Property componentPart, InstanceSpecification parentInstance) {
// The tracing code needs informations about the component instance and port.
String instanceName = instance.getName();
int index = instanceName.lastIndexOf("."); //$NON-NLS-1$
- if(index != -1) {
+ if (index != -1) {
String lastSegment = instanceName.substring(index + 1);
- if(lastSegment.startsWith(ContainerTrafo.interceptorName)) {
+ if (lastSegment.startsWith(ContainerTrafo.interceptorName)) {
instanceName = instanceName.substring(0, index);
}
}
@@ -36,7 +37,7 @@ public class IConfiguratorTrace implements IInstanceConfigurator {
ContainerTrafo containerTrafo = ContainerTrafo.getContainerTrafo(parentInstance);
if (containerTrafo != null) {
Port port = containerTrafo.getInterceptedPort(componentPart);
- if(port != null) {
+ 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/QompassTraceMechanism.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java
index e3e0ca8da86..a45d0343fae 100644
--- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/QompassTraceMechanism.java
@@ -5,6 +5,7 @@ import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.BasicEList;
import org.eclipse.emf.common.util.EList;
@@ -38,28 +39,30 @@ public class QompassTraceMechanism implements ITraceMechanism {
public static final URI tracingURI = URI.createURI(EC3M_TRACING_URI);
+ @Override
public EList<String> getTraceMechanismIDs(EObject eObj) {
EList<String> ids = new BasicEList<String>();
// obtain list of all available container rules via Utils. Restrict to those doing tracing.
EList<ContainerRule> containerRules = getContainerRules(eObj);
- for(ContainerRule containerRule : containerRules) {
- if(isForTracing(containerRule)) {
+ for (ContainerRule containerRule : containerRules) {
+ if (isForTracing(containerRule)) {
Class clazz = containerRule.getBase_Class();
ids.add(clazz.getName());
}
}
- if(ids.size() == 0) {
+ if (ids.size() == 0) {
ids.add("dummy qompass rule");
}
return ids;
}
+ @Override
public String getTraceMechanismDescription(EObject eObj, String id) {
EList<ContainerRule> containerRules = getContainerRules(eObj);
- for(ContainerRule containerRule : containerRules) {
- if(isForTracing(containerRule)) {
+ for (ContainerRule containerRule : containerRules) {
+ if (isForTracing(containerRule)) {
Class clazz = containerRule.getBase_Class();
- if(clazz.getName().equals(id)) {
+ if (clazz.getName().equals(id)) {
return Description.getDescription(clazz);
}
}
@@ -70,26 +73,27 @@ public class QompassTraceMechanism implements ITraceMechanism {
/**
* Apply the trace mechanism, i.e. set or unset the appropriate ContainerRule for tracing.
* Currently handles trace on class.
- *
+ *
* Basic idea: always apply same container rule. But container rule expansion is different in function of set tracepoints.
* Need to unapply, if there is no longer a trace needing it.
*/
+ @Override
public boolean applyTraceMechanism(EObject eObj, String id, int traceOption) {
Class clazzContext = getClassContext(eObj);
- if(clazzContext == null) {
+ if (clazzContext == null) {
return false;
}
EList<ContainerRule> containerRules = getContainerRules(eObj);
- for(ContainerRule containerRule : containerRules) {
- if(isForTracing(containerRule)) {
+ for (ContainerRule containerRule : containerRules) {
+ if (isForTracing(containerRule)) {
Class clazz = containerRule.getBase_Class();
- if(clazz.getName().equals(id)) {
- if(traceOption == TAOperation.OnlyCall.ordinal()) {
+ if (clazz.getName().equals(id)) {
+ if (traceOption == TAOperation.OnlyCall.ordinal()) {
// yes => what do we then (i.e. how is mapping done??)
}
RuleApplication ruleApplication = StereotypeUtil.applyApp(clazzContext, RuleApplication.class);
- if((ruleApplication != null) && !ruleApplication.getContainerRule().contains(containerRule)) {
+ if ((ruleApplication != null) && !ruleApplication.getContainerRule().contains(containerRule)) {
ruleApplication.getContainerRule().add(containerRule);
return true;
}
@@ -102,9 +106,9 @@ public class QompassTraceMechanism implements ITraceMechanism {
// QompassTraceMechanism
public boolean isForTracing(ContainerRule rule) {
- for(ConfigOption co : rule.getForConfig()) {
+ for (ConfigOption co : rule.getForConfig()) {
// TODO: not very clean to used fixed string
- if(co.getBase_Class().getName().equals("Trace")) { //$NON-NLS-1$
+ if (co.getBase_Class().getName().equals("Trace")) { //$NON-NLS-1$
return true;
}
}
@@ -117,65 +121,66 @@ public class QompassTraceMechanism implements ITraceMechanism {
* (1) A class, in this case it could be returned directly
* (2) An operation. In this case, the owning class is returned (caveat: operation might belong to an interface)
* (3) A property of the class (including ports).
- *
+ *
* @param eObj
- * see description above
+ * see description above
* @return the class to a container rule may be applied
*/
public Class getClassContext(EObject eObj) {
- if(eObj instanceof Class) {
- return (Class)eObj;
- } else if(eObj instanceof Operation) {
- return ((Operation)eObj).getClass_();
- } else if(eObj instanceof Property) {
- return ((Property)eObj).getClass_();
+ if (eObj instanceof Class) {
+ return (Class) eObj;
+ } else if (eObj instanceof Operation) {
+ return ((Operation) eObj).getClass_();
+ } else if (eObj instanceof Property) {
+ return ((Property) eObj).getClass_();
} else {
return null;
}
}
public EList<ContainerRule> getContainerRules(EObject eObj) {
- if(eObj == null) {
+ if (eObj == null) {
// load rules of registered Tracing model library
try {
ModelSet ms = ServiceUtilsForActionHandlers.getInstance().getModelSet();
Resource rs = ms.getResource(tracingURI, true);
EList<EObject> contents = rs.getContents();
- if((contents.size() > 0) && (contents.get(0) instanceof Package)) {
- return Utils.getAllRules((Package)contents.get(0));
+ if ((contents.size() > 0) && (contents.get(0) instanceof Package)) {
+ return Utils.getAllRules((Package) contents.get(0));
}
} catch (ServiceException e) {
- Log.log(Status.ERROR, Log.TRAFO_CONTAINER, e.getMessage());
+ Log.log(IStatus.ERROR, Log.TRAFO_CONTAINER, e.getMessage());
}
return new BasicEList<ContainerRule>();
} else {
- Package top = Utils.getTop((Element)eObj);
+ Package top = Utils.getTop((Element) eObj);
return Utils.getAllRules(top);
}
}
+ @Override
public boolean configureTraceMechanisms() {
String config = ""; //$NON-NLS-1$
// TODO: config is never evaluated
try {
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if(root != null) {
+ if (root != null) {
Object tracePoints[] = root.findMarkers(TracepointConstants.tpOrbpMarker, true, IResource.DEPTH_INFINITE);
- for(Object tracePointObj : tracePoints) {
- if(tracePointObj instanceof IMarker) {
- IMarker tracePoint = (IMarker)tracePointObj;
+ for (Object tracePointObj : tracePoints) {
+ if (tracePointObj instanceof IMarker) {
+ IMarker tracePoint = (IMarker) tracePointObj;
EObject eobj = MarkerUtils.getEObjectOfMarker(tracePoint);
- if(MarkerUtils.isActive(tracePoint)) {
- if(eobj instanceof NamedElement) {
- config += ((NamedElement)eobj).getQualifiedName();
+ if (MarkerUtils.isActive(tracePoint)) {
+ if (eobj instanceof NamedElement) {
+ config += ((NamedElement) eobj).getQualifiedName();
}
}
}
}
}
} catch (CoreException e) {
- Log.log(Status.ERROR, Log.TRAFO_CONTAINER, e.getMessage());
+ Log.log(IStatus.ERROR, Log.TRAFO_CONTAINER, e.getMessage());
}
return true;
}
diff --git a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/acceleo/TraceUtils.java b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/acceleo/TraceUtils.java
index e8b0e395785..7e20fb3019f 100644
--- a/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/acceleo/TraceUtils.java
+++ b/extraplugins/qompass-designer/tracing/org.eclipse.papyrus.qompass.modellibs.tracing/src/org/eclipse/papyrus/qompass/modellibs/tracing/acceleo/TraceUtils.java
@@ -17,7 +17,7 @@ public class TraceUtils {
public static IMarker[] getMarkersForEObject(EObject eObject, String markerType) {
Resource resource = eObject.eResource();
IFile file = WorkspaceSynchronizer.getFile(resource);
- if(file != null) {
+ if (file != null) {
try {
return file.findMarkers(markerType, true, IResource.DEPTH_INFINITE);
} catch (CoreException e) {
@@ -28,16 +28,16 @@ public class TraceUtils {
public static boolean hasTrace(Element eObject) {
IMarker markers[] = getMarkersForEObject(eObject, TracepointConstants.tpOrbpMarker);
- for(IMarker marker : markers) {
+ for (IMarker marker : markers) {
// explicitly pass resourceSet of eObject we want to compare. Otherwise, the marker utils would
// load resources into its own resource set (leading to non-comparable eObjects)
EObject eObjOfMarker = MarkerUtils.getEObjectOfMarker(eObject.eResource().getResourceSet(), marker);
- if(eObjOfMarker == eObject) {
+ if (eObjOfMarker == eObject) {
return true;
}
}
- // TODO: testing workaround (always return true for port based transformations)
- if(TransformationContext.getPort() != null) {
+ // TODO: testing workaround (always return true for port based transformations)
+ if (TransformationContext.getPort() != null) {
return true;
}
return false;

Back to the top