Skip to content

Commit

Permalink
#2749 Select Related Operational Process Elements
Browse files Browse the repository at this point in the history
Changed name on OperationalProcess
Added Junit

Change-Id: I43277a3808645134abf6aa1b02a49e5b74504727
Signed-off-by: Erwann Traisnel <erwann.traisnel@obeo.fr>
  • Loading branch information
etraisnel2 authored and pdulth committed Nov 21, 2023
1 parent 02eacb0 commit f8d14dd
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 1 deletion.
32 changes: 32 additions & 0 deletions core/plugins/org.polarsys.capella.core.sirius.ui/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -423,6 +423,17 @@
</reference>
</visibleWhen>
</command>
<command
commandId="org.polarsys.capella.core.sirius.ui.select.op.related.elements"
label="Related Operational Process Elements"
style="push">
<visibleWhen
checkEnabled="true">
<reference
definitionId="org.polarsys.capella.core.sirius.ui.isValidOPSelectionMenu">
</reference>
</visibleWhen>
</command>
<command
commandId="org.polarsys.capella.core.sirius.ui.select.fc.related.elements"
label="Related Functional Chain Elements"
Expand Down Expand Up @@ -499,6 +510,11 @@
id="org.polarsys.capella.core.sirius.ui.select.elements.of.same.type"
name="Select Elements of same type">
</command>
<command
defaultHandler="org.polarsys.capella.core.sirius.ui.handlers.SelectRelatedFCElementsCommandHandler"
id="org.polarsys.capella.core.sirius.ui.select.op.related.elements"
name="Select Related Operational Process Elements">
</command>
<command
defaultHandler="org.polarsys.capella.core.sirius.ui.handlers.SelectRelatedFCElementsCommandHandler"
id="org.polarsys.capella.core.sirius.ui.select.fc.related.elements"
Expand Down Expand Up @@ -539,6 +555,13 @@
properties="isValidElementsOfSameTypeMenu"
type="java.lang.Object">
</propertyTester>
<propertyTester
class="org.polarsys.capella.core.sirius.ui.testers.ValidOPSelectionMenuTargetTester"
id="org.polarsys.capella.core.sirius.ui.ValidOPSelectionMenuTargetTester"
namespace="org.polarsys.capella.core.sirius.ui"
properties="isValidOPSelectionMenu"
type="java.lang.Object">
</propertyTester>
<propertyTester
class="org.polarsys.capella.core.sirius.ui.testers.ValidFCSelectionMenuTargetTester"
id="org.polarsys.capella.core.sirius.ui.ValidFCSelectionMenuTargetTester"
Expand Down Expand Up @@ -601,6 +624,15 @@
property="org.polarsys.capella.core.sirius.ui.isValidFCSelectionMenu">
</test>
</with>
</definition>
<definition
id="org.polarsys.capella.core.sirius.ui.isValidOPSelectionMenu">
<with
variable="activeMenuSelection">
<test
property="org.polarsys.capella.core.sirius.ui.isValidOPSelectionMenu">
</test>
</with>
</definition>
<definition
id="org.polarsys.capella.core.sirius.ui.isValidPPSelectionMenu">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,15 @@

import org.eclipse.emf.ecore.EObject;
import org.polarsys.capella.core.data.fa.FunctionalChain;
import org.polarsys.capella.core.data.oa.OperationalProcess;

public class ValidFCSelectionMenuTargetTester extends AbstractValidSelectionMenuTarget {

protected String PROPERTY_ID = "isValidFCSelectionMenu";

@Override
protected boolean isValid(EObject element) {
return element instanceof FunctionalChain;
return element instanceof FunctionalChain && !(element instanceof OperationalProcess);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*******************************************************************************
* Copyright (c) 2023 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.core.sirius.ui.testers;

import org.eclipse.emf.ecore.EObject;
import org.polarsys.capella.core.data.oa.OperationalProcess;

public class ValidOPSelectionMenuTargetTester extends AbstractValidSelectionMenuTarget {

protected String PROPERTY_ID = "isValidOPSelectionMenu";

@Override
protected boolean isValid(EObject element) {
return element instanceof OperationalProcess;
}

@Override
protected String getPropertyId() {
return PROPERTY_ID;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public class SelectToolsTest extends AbstractDiagramTestCase {
public final String RPL_PHYSICAL_FUNCTION_2 = "238797f1-c012-446a-9b79-e94cf88bd180";//$NON-NLS-1$
public final String RPL_FIP1_PF2 = "78736f13-8b41-4119-b0b4-48e733598c85";//$NON-NLS-1$

public final String OAB_DIAGRAM = "_x0W387OIEemYUPV0pY7feg";//$NON-NLS-1$
public final String PAB_DIAGRAM = "_yYiSoHjqEea__MYrXGSERA";//$NON-NLS-1$
public final String SAB_DIAGRAM = "_yYhranjqEea__MYrXGSERA";//$NON-NLS-1$
public final String LAB_DIAGRAM = "_yYhrgHjqEea__MYrXGSERA";//$NON-NLS-1$
Expand Down Expand Up @@ -120,6 +121,15 @@ public class SelectToolsTest extends AbstractDiagramTestCase {
public final String PHYSICAL_LINK_CATEGORY_1_PORT1 = "_rqm90HfAEe6OhIHMRH8U5Q";//$NON-NLS-1$
public final String PHYSICAL_LINK_CATEGORY_1_PORT2 = "_rqpaEXfAEe6OhIHMRH8U5Q";//$NON-NLS-1$

public final String OP1 = "c27f6524-d09e-4962-8f71-c347796bfe6f";//$NON-NLS-1$
public final String OP1_EDGE1 = "_6VUMebOIEemYUPV0pY7feg";//$NON-NLS-1$
public final String OP1_EDGE2 = "_6Vd9b7OIEemYUPV0pY7feg";//$NON-NLS-1$
public final String OP1_NODE1 = "_6UbbobOIEemYUPV0pY7feg";//$NON-NLS-1$
public final String OP1_DECORATOR = "_r8DgcLOLEemYUPV0pY7feg";//$NON-NLS-1$
public final String OP1_NODE2 = "_6UuWg7OIEemYUPV0pY7feg";//$NON-NLS-1$
public final String OP1_NODE3 = "_6URqkLOIEemYUPV0pY7feg";//$NON-NLS-1$


public final String FC1 = "3ba5658d-1416-4928-bb63-bf26a021cc34";//$NON-NLS-1$
public final String FC1_Node_Decorator = "_8czq8HJ2Ee6MRMSmk5q7sQ";//$NON-NLS-1$
public final String FE1 = "_nNBT4IoPEeaQmcRqIfTB6w";//$NON-NLS-1$
Expand Down Expand Up @@ -148,6 +158,8 @@ public void test() throws Exception {
PHYSICAL_LINK_1_PORT2);
testSelectRelatedFCElements(sc, PAB_DIAGRAM, FC1, FC1_Node_Decorator, FCAT1_EDGE, FCAT1_PORT1, FCAT1_PORT2, FE1,
FE1_PORT1, FE1_PORT2);
testSelectRelatedFCElements(sc, OAB_DIAGRAM, OP1, OP1_NODE1, OP1_EDGE1, OP1_NODE2, OP1_EDGE2, OP1_NODE3,
OP1_DECORATOR);


testSelectRelatedRecs(sc, REC_DIAGRAM, REC_PHYSICAL_COMPONENT, REC_FIP1_PF2, REC_PHYSICAL_COMPONENT,
Expand All @@ -171,6 +183,8 @@ public void test() throws Exception {
}

protected void testCategoriesSemanticElements(SessionContext sc) {
// No categories nor category ports for OAB

// SAB
testSemanticElements(sc, SAB_DIAGRAM, FCAT_SAB, FCAT_SAB, FCAT_FE_SAB);
testSemanticElements(sc, SAB_DIAGRAM, FCAT_PORT_SAB, FCAT_SAB, FCAT_FE_SAB);
Expand Down

0 comments on commit f8d14dd

Please sign in to comment.