diff --git a/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/pom.xml b/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/pom.xml
index e4bdfe4e..b6f840b7 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/pom.xml
+++ b/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/pom.xml
@@ -1,76 +1,81 @@
-
-
-
- 4.0.0
-
-
- org.polarsys
- org.polarsys.capella.addon.transition.system2subsystem
- 1.6.0-SNAPSHOT
- ../../
-
-
- org.polarsys.capella.transition.system2subsystem.tests.ju
- eclipse-test-plugin
- 1.6.0-SNAPSHOT
-
-
-
-
- org.eclipse.tycho
- tycho-surefire-plugin
- ${tycho-version}
-
- ${capella-product-id}
- ${capella-application}
- true
- true
- org.polarsys.capella.transition.system2subsystem.tests.AllSystem2SubsystemTests
-
-
-
- eclipse-plugin
- org.eclipse.equinox.event
- 0.0.0
-
-
-
-
-
- org.eclipse.tycho
- target-platform-configuration
- ${tycho-version}
-
-
-
-
-
- eclipse-feature
- org.polarsys.capella.rcp
- 0.0.0
-
-
- eclipse-feature
- org.polarsys.capella.transition.system2subsystem.feature
- 0.0.0
-
-
-
-
-
-
-
-
+
+
+
+ 4.0.0
+
+
+ org.polarsys
+ org.polarsys.capella.addon.transition.system2subsystem
+ 1.6.0-SNAPSHOT
+ ../../
+
+
+
+
+ true
+
+
+ org.polarsys.capella.transition.system2subsystem.tests.ju
+ eclipse-test-plugin
+ 1.6.0-SNAPSHOT
+
+
+
+
+ org.eclipse.tycho
+ tycho-surefire-plugin
+ ${tycho-version}
+
+ ${capella-product-id}
+ ${capella-application}
+ true
+ true
+ org.polarsys.capella.transition.system2subsystem.tests.AllSystem2SubsystemTests
+
+
+
+ eclipse-plugin
+ org.eclipse.equinox.event
+ 0.0.0
+
+
+
+
+
+ org.eclipse.tycho
+ target-platform-configuration
+ ${tycho-version}
+
+
+
+
+
+ eclipse-feature
+ org.polarsys.capella.rcp
+ 0.0.0
+
+
+ eclipse-feature
+ org.polarsys.capella.transition.system2subsystem.feature
+ 0.0.0
+
+
+
+
+
+
+
+
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/src/org/polarsys/capella/transition/system2subsystem/tests/mixed/CopyImagesTest.java b/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/src/org/polarsys/capella/transition/system2subsystem/tests/mixed/CopyImagesTest.java
index 094a3b4f..63d27fda 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/src/org/polarsys/capella/transition/system2subsystem/tests/mixed/CopyImagesTest.java
+++ b/plugins/org.polarsys.capella.transition.system2subsystem.tests.ju/src/org/polarsys/capella/transition/system2subsystem/tests/mixed/CopyImagesTest.java
@@ -36,6 +36,9 @@ public class CopyImagesTest {
private static final String COPIED_IMAGE_PATH = "images/Capella128x128.png";
+ // Hide default constructor
+ CopyImagesTest() {}
+
/**
* Test that verifies the copy of images during a Multiphases transition
*/
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/activities/CopyImagesActivity.java b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/activities/CopyImagesActivity.java
index b26ab6d1..f6d35a07 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/activities/CopyImagesActivity.java
+++ b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/activities/CopyImagesActivity.java
@@ -43,9 +43,9 @@ public class CopyImagesActivity extends AbstractActivity {
* {@inheritDoc}
*/
@Override
- protected IStatus _run(ActivityParameters activityParams_p) {
+ protected IStatus _run(ActivityParameters activityParams) {
- IContext transformationContext = getContext(activityParams_p);
+ IContext transformationContext = getContext(activityParams);
Project sourceProject = ContextHelper.getSourceProject(transformationContext);
Project targetProject = ContextHelper.getTargetProject(transformationContext);
@@ -78,7 +78,7 @@ private void copyImagesToTargetProject(IProject sourceEclipseProject, IProject t
}
} catch (CoreException e) {
LogHelper.getInstance().log(e.getMessage(), new Status(IStatus.ERROR, org.polarsys.capella.transition.system2subsystem.Activator.PLUGIN_ID, e.getMessage(), e),
- Messages.Activity_CopyImages);
+ Messages.activityCopyImages);
}
}
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/Messages.java b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/Messages.java
index 6c06cf5b..3579bf6b 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/Messages.java
+++ b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/Messages.java
@@ -52,7 +52,7 @@ public class Messages extends NLS {
public static String Rule_InteractionState_FailMsg;
public static String Rule_StateFragment_FailMsg;
public static String Rule_InteractionFunctionState_FailMsg;
- public static String Activity_CopyImages;
+ public static String activityCopyImages;
static {
// initialize resource bundle
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/messages.properties b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/messages.properties
index 4935f995..5c0541b3 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/messages.properties
+++ b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/constants/messages.properties
@@ -45,4 +45,4 @@ Rule_InteractionState_FailMsg=An interaction state is never transitioned between
Rule_InteractionFunctionState_FailMsg=An interaction state with a function cannot be transitioned while exchange scenario to interface scenario.
Rule_StateFragment_FailMsg=A state fragment is never transitioned between two different phases.
-Activity_CopyImages=CopyImages
\ No newline at end of file
+activityCopyImages=CopyImages
\ No newline at end of file
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/FunctionalChainAttachmentHelper.java b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/FunctionalChainAttachmentHelper.java
index ef565f69..4df4e2fb 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/FunctionalChainAttachmentHelper.java
+++ b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/FunctionalChainAttachmentHelper.java
@@ -40,7 +40,6 @@
import org.polarsys.capella.core.model.helpers.BlockArchitectureExt;
import org.polarsys.capella.core.model.helpers.FunctionalChainExt;
import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Edge;
import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Element;
import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Vertex;
import org.polarsys.capella.core.transition.common.constants.ITransitionConstants;
@@ -80,17 +79,17 @@ public static FunctionalChainAttachmentHelper getInstance(IContext context_p) {
return handler;
}
- public HashMap getGraphs(IContext context_p) {
- HashMap graphs = (HashMap) context_p.get(GRAPH_MAPS);
+ public Map getGraphs(IContext context) {
+ HashMap graphs = (HashMap) context.get(GRAPH_MAPS);
if (graphs == null) {
- graphs = new HashMap();
- context_p.put(GRAPH_MAPS, graphs);
+ graphs = new HashMap<>();
+ context.put(GRAPH_MAPS, graphs);
}
return graphs;
}
- public InvolvementHierarchyGraph getGraph(FunctionalChain chain, IContext context_p) {
- HashMap graphs = getGraphs(context_p);
+ public InvolvementHierarchyGraph getGraph(FunctionalChain chain, IContext context) {
+ Map graphs = getGraphs(context);
if (!graphs.containsKey(chain)) {
graphs.put(chain, new InvolvementHierarchyGraph(chain));
}
diff --git a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/GraphHelper.java b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/GraphHelper.java
index 7e196838..0159fe5f 100644
--- a/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/GraphHelper.java
+++ b/plugins/org.polarsys.capella.transition.system2subsystem/src/org/polarsys/capella/transition/system2subsystem/handlers/attachment/GraphHelper.java
@@ -1,105 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2022 THALES GLOBAL SERVICES.
- *
- * This program and the accompanying materials are made available under the
- * terms of the Eclipse Public License 2.0 which is available at
- * http://www.eclipse.org/legal/epl-2.0
- *
- * SPDX-License-Identifier: EPL-2.0
- *
- * Contributors:
- * Thales - initial API and implementation
- *******************************************************************************/
-package org.polarsys.capella.transition.system2subsystem.handlers.attachment;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-import org.polarsys.capella.core.data.fa.FunctionalChainInvolvement;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Edge;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Element;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Vertex;
-import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.VertexKey;
-import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext;
-
-public class GraphHelper {
-
- /**
- * From a fci, returns the list of all paths towards expected elements returned by isTheOne
- *
- * @param isTheOne:
- * a method allowing to detect if the current element is the expected one.
- *
- * @param getNexts: from an element, a method retrieving the connected ones
- *
- * @return all the paths from fci towards the elements returned by isTheOne. paths are containing both source fci at first of
- * the path and the expected one at the end.
- */
- public static Collection> getPathsTowards(T fci, Function isTheOne,
- IContext context_p, Function> getNexts) {
- LinkedList path = new LinkedList<>();
- path.add(fci);
- return getPathsTowards(fci, isTheOne, context_p, path, getNexts);
- }
-
- /**
- * From a fci, returns the list of all paths towards expected elements returned by isTheOne
- *
- * @param path
- * the current path computed.
- * @implNote at first, we add the current fci in it to allow cycle detection
- */
- protected static Collection> getPathsTowards(T fci, Function isTheOne,
- IContext context_p, LinkedList path, Function> getNexts) {
- Collection> result = new ArrayList>();
-
- for (T next : getNexts.apply(fci)) {
- if (path.contains(next)) {
- path.clear();
- } else if (isTheOne.apply(next)) {
- path.add(next);
- result.add(path);
- } else {
- LinkedList newPath = new LinkedList<>();
- newPath.addAll(path);
- newPath.add(next);
- result.addAll(getPathsTowards(next, isTheOne, context_p, newPath, getNexts));
- }
- }
- return result;
- }
-
-
- public static FunctionalChainInvolvement getInvolvment(Element e) {
- if (e instanceof Edge) {
- return ((Edge) e).getLink();
- }
- return ((Vertex) e).getFunction();
- }
-
- public static Collection getPrevious(Element e) {
- if (e instanceof Edge) {
- return Arrays.asList((Element)((Edge)e).getSource());
- }
- return (Collection)((Vertex)e).getIncomingEdges();
- }
-
- public static Collection getNexts(Element e) {
- if (e instanceof Edge) {
- return Arrays.asList((Element)((Edge)e).getTarget());
- }
- return (Collection)((Vertex)e).getOutgoingEdges();
- }
-
- public static Collection getVertices(InvolvementHierarchyGraph graph, FunctionalChainInvolvement fci) {
- return (Collection) graph.getVertices().keySet().stream().filter(v -> ((VertexKey) v).getFunction() == fci)
- .map(v -> graph.getVertices().get(v)).collect(Collectors.toList());
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2022 THALES GLOBAL SERVICES.
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Thales - initial API and implementation
+ *******************************************************************************/
+package org.polarsys.capella.transition.system2subsystem.handlers.attachment;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+
+import org.polarsys.capella.core.data.fa.FunctionalChainInvolvement;
+import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph;
+import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Edge;
+import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Element;
+import org.polarsys.capella.core.model.helpers.graph.InvolvementHierarchyGraph.Vertex;
+import org.polarsys.kitalpha.transposer.rules.handler.rules.api.IContext;
+
+public class GraphHelper {
+
+ /**
+ * From a fci, returns the list of all paths towards expected elements returned by isTheOne
+ *
+ * @param isTheOne:
+ * a method allowing to detect if the current element is the expected one.
+ *
+ * @param getNexts: from an element, a method retrieving the connected ones
+ *
+ * @return all the paths from fci towards the elements returned by isTheOne. paths are containing both source fci at first of
+ * the path and the expected one at the end.
+ */
+ public static Collection> getPathsTowards(T fci, Function isTheOne,
+ IContext context_p, Function> getNexts) {
+ LinkedList path = new LinkedList<>();
+ path.add(fci);
+ return getPathsTowards(fci, isTheOne, context_p, path, getNexts);
+ }
+
+ /**
+ * From a fci, returns the list of all paths towards expected elements returned by isTheOne
+ *
+ * @param path
+ * the current path computed.
+ * @implNote at first, we add the current fci in it to allow cycle detection
+ */
+ protected static Collection> getPathsTowards(T fci, Function isTheOne,
+ IContext context_p, LinkedList path, Function> getNexts) {
+ Collection> result = new ArrayList>();
+
+ for (T next : getNexts.apply(fci)) {
+ if (path.contains(next)) {
+ path.clear();
+ } else if (isTheOne.apply(next)) {
+ path.add(next);
+ result.add(path);
+ } else {
+ LinkedList newPath = new LinkedList<>();
+ newPath.addAll(path);
+ newPath.add(next);
+ result.addAll(getPathsTowards(next, isTheOne, context_p, newPath, getNexts));
+ }
+ }
+ return result;
+ }
+
+
+ public static FunctionalChainInvolvement getInvolvment(Element e) {
+ if (e instanceof Edge) {
+ return ((Edge) e).getLink();
+ }
+ return ((Vertex) e).getFunction();
+ }
+
+ public static Collection getPrevious(Element e) {
+ if (e instanceof Edge) {
+ return Arrays.asList((Element)((Edge)e).getSource());
+ }
+ return (Collection)((Vertex)e).getIncomingEdges();
+ }
+
+ public static Collection getNexts(Element e) {
+ if (e instanceof Edge) {
+ return Arrays.asList((Element)((Edge)e).getTarget());
+ }
+ return (Collection)((Vertex)e).getOutgoingEdges();
+ }
+
+ public static Collection getVertices(InvolvementHierarchyGraph graph, FunctionalChainInvolvement fci) {
+ return graph.getVertices().keySet().stream().filter(v -> v.getFunction() == fci)
+ .map(v -> graph.getVertices().get(v)).collect(Collectors.toList());
+ }
+
+
+}