Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2019-08-30 14:49:46 +0000
committerPatrick Tessier2019-09-18 07:54:48 +0000
commit2ec299164d14b33e605d71058237016125e0ee72 (patch)
tree23cfac79363c2851169cb13da40d6e68a5b64558 /tests
parent8fd2a0edd4ab3a6b26bf4c87cecf0ef6cf9e9e7e (diff)
downloadorg.eclipse.papyrus-2ec299164d14b33e605d71058237016125e0ee72.tar.gz
org.eclipse.papyrus-2ec299164d14b33e605d71058237016125e0ee72.tar.xz
org.eclipse.papyrus-2ec299164d14b33e605d71058237016125e0ee72.zip
Bug 550568: [AF] The diagrams and tables icons of disabled viewpoint
should be grayed - Add grayed icon into the architecture framework - Create the grayed icons for diagrams and tables - Manage the view prototype display in: - Model Explorer - Welcome page - Table of views - Properties views Change-Id: I3301e9d17cb12c5ca59f2175b5cb0b86e6733917 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'tests')
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF5
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.di2
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.notation86
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.uml10
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java2
-rw-r--r--tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/GrayedIconTest.java112
6 files changed, 216 insertions, 1 deletions
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF
index 181655a4fe7..8d73b0c753f 100644
--- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/META-INF/MANIFEST.MF
@@ -15,6 +15,9 @@ Require-Bundle: org.junit;bundle-version="4.12.0",
org.eclipse.papyrus.infra.ui.architecture;bundle-version="[2.1.0,3.0.0)",
org.eclipse.papyrus.infra.emf;bundle-version="[3.1.0,4.0.0)",
org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.1.0,4.0.0)",
- org.eclipse.papyrus.views.modelexplorer.tests;bundle-version="[1.2.0,2.0.0)"
+ org.eclipse.papyrus.views.modelexplorer.tests;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.infra.viewpoints.policy;bundle-version="[3.1.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.103.0,4.0.0)",
+ org.eclipse.papyrus.infra.architecture.representation;bundle-version="[2.1.0,3.0.0)"
Export-Package: org.eclipse.papyrus.infra.ui.architecture.tests
Bundle-Activator: org.eclipse.papyrus.infra.ui.architecture.tests.Activator
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.di b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.di
new file mode 100644
index 00000000000..8c549eecdc6
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.di
@@ -0,0 +1,2 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<architecture:ArchitectureDescription xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:architecture="http://www.eclipse.org/papyrus/infra/core/architecture" contextId="org.eclipse.papyrus.infra.services.edit.TypeContext"/>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.notation b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.notation
new file mode 100644
index 00000000000..e3ed6adf9e8
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.notation
@@ -0,0 +1,86 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:nattable="http://www.eclipse.org/papyrus/nattable/model" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/gmfdiag/style" xsi:schemaLocation="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis http://www.eclipse.org/papyrus/nattable/model#//nattableaxis http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider http://www.eclipse.org/papyrus/nattable/model#//nattableaxisprovider">
+ <nattable:Table xmi:id="_6KNXUM5dEemmCI5rrjVnbw" name="Class Tree Table" currentRowAxisProvider="_6KNXU85dEemmCI5rrjVnbw" currentColumnAxisProvider="_6KNXUc5dEemmCI5rrjVnbw" tableKindId="org.eclipse.papyrus.uml.table.classTree">
+ <eAnnotations xmi:id="_6KUFAM5dEemmCI5rrjVnbw" source="http://www.eclipse.org/papyrus/infra/nattable/version">
+ <details xmi:id="_6KUFAc5dEemmCI5rrjVnbw" key="version" value="1.3.0"/>
+ </eAnnotations>
+ <context href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ <owner href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ <tableConfiguration href="platform:/resource/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#PapyrusClassTreeTable_XMI_ID"/>
+ <columnAxisProvidersHistory xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" xmi:id="_6KNXUc5dEemmCI5rrjVnbw" description="This axis provider provides available columns according to the rows of the table (features of the object displayed on the other axis)" name="UML Feature axis provider">
+ <axis xsi:type="nattableaxis:EStructuralFeatureAxis" xmi:id="_6KNXUs5dEemmCI5rrjVnbw">
+ <manager href="platform:/resource/org.eclipse.papyrus.uml.nattable.clazz.config/configs/class_synchronized_tree.nattableconfiguration#_UJa7yDzQEei_1txcmoHe_A"/>
+ <element xsi:type="ecore:EAttribute" href="http://www.eclipse.org/uml2/5.0.0/UML#//NamedElement/name"/>
+ </axis>
+ </columnAxisProvidersHistory>
+ <rowAxisProvidersHistory xsi:type="nattableaxisprovider:MasterObjectAxisProvider" xmi:id="_6KNXU85dEemmCI5rrjVnbw" description="This axis provider manages the rows, according to the wanted hierarchy" name="HierarchicalRowaAxisManager" disconnectSlave="true"/>
+ </nattable:Table>
+ <notation:Diagram xmi:id="_6NTHkM5dEemmCI5rrjVnbw" type="PapyrusUMLStateMachineDiagram" name="State Machine Diagram" measurementUnit="Pixel">
+ <children xsi:type="notation:Shape" xmi:id="_6NTHkc5dEemmCI5rrjVnbw" type="StateMachine_Shape">
+ <children xsi:type="notation:DecorationNode" xmi:id="_6NTHks5dEemmCI5rrjVnbw" type="StateMachine_NameLabel">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NTHk85dEemmCI5rrjVnbw" width="700" height="20"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NTHlM5dEemmCI5rrjVnbw" type="StateMachine_RegionCompartment">
+ <children xsi:type="notation:Shape" xmi:id="_6NTHlc5dEemmCI5rrjVnbw" type="Region_Shape">
+ <eAnnotations xmi:id="_6NTHls5dEemmCI5rrjVnbw" source="RegionAnnotationKey">
+ <details xmi:id="_6NTHl85dEemmCI5rrjVnbw" key="RegionZoneKey" value=""/>
+ </eAnnotations>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NTHmM5dEemmCI5rrjVnbw" type="Region_SubvertexCompartment">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NTHmc5dEemmCI5rrjVnbw"/>
+ </children>
+ <element href="GrayedIcon.uml#_6NMZ4M5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NTHms5dEemmCI5rrjVnbw" width="700" height="280"/>
+ </children>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NTHm85dEemmCI5rrjVnbw" y="20" width="700" height="280"/>
+ </children>
+ <element href="GrayedIcon.uml#_6LOrAM5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NTHnM5dEemmCI5rrjVnbw" x="30" y="30" width="700" height="300"/>
+ </children>
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_6NTHnc5dEemmCI5rrjVnbw" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_6NTHns5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_6NTHn85dEemmCI5rrjVnbw" diagramKindId="org.eclipse.papyrus.uml.diagram.stateMachine">
+ <owner href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ </styles>
+ <element href="GrayedIcon.uml#_6LOrAM5dEemmCI5rrjVnbw"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_6NdfoM5dEemmCI5rrjVnbw" type="PapyrusUMLClassDiagram" name="Class Diagram" measurementUnit="Pixel">
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_6Ndfoc5dEemmCI5rrjVnbw" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_6Ndfos5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_6Ndfo85dEemmCI5rrjVnbw" diagramKindId="org.eclipse.papyrus.uml.diagram.class">
+ <owner href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ </styles>
+ <element href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ </notation:Diagram>
+ <notation:Diagram xmi:id="_6NulYM5dEemmCI5rrjVnbw" type="PapyrusUMLActivityDiagram" name="Activity Diagram" measurementUnit="Pixel">
+ <children xsi:type="notation:Shape" xmi:id="_6NulYc5dEemmCI5rrjVnbw" type="Activity_Shape">
+ <children xsi:type="notation:DecorationNode" xmi:id="_6NulYs5dEemmCI5rrjVnbw" type="Activity_NameLabel"/>
+ <children xsi:type="notation:DecorationNode" xmi:id="_6NulY85dEemmCI5rrjVnbw" type="Activity_KeywordLabel"/>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NulZM5dEemmCI5rrjVnbw" type="Activity_ParameterCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_6NulZc5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_6NulZs5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6NulZ85dEemmCI5rrjVnbw"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NulaM5dEemmCI5rrjVnbw" type="Activity_PreconditionCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_6Nulac5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_6Nulas5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6Nula85dEemmCI5rrjVnbw"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NulbM5dEemmCI5rrjVnbw" type="Activity_PostconditionCompartment">
+ <styles xsi:type="notation:SortingStyle" xmi:id="_6Nulbc5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="notation:FilteringStyle" xmi:id="_6Nulbs5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6Nulb85dEemmCI5rrjVnbw"/>
+ </children>
+ <children xsi:type="notation:BasicCompartment" xmi:id="_6NulcM5dEemmCI5rrjVnbw" type="Activity_ActivityNodeCompartment">
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6Nulcc5dEemmCI5rrjVnbw"/>
+ </children>
+ <element href="GrayedIcon.uml#_6Nk0YM5dEemmCI5rrjVnbw"/>
+ <layoutConstraint xsi:type="notation:Bounds" xmi:id="_6Nulcs5dEemmCI5rrjVnbw"/>
+ </children>
+ <styles xsi:type="notation:StringValueStyle" xmi:id="_6Nulc85dEemmCI5rrjVnbw" name="diagram_compatibility_version" stringValue="1.4.0"/>
+ <styles xsi:type="notation:DiagramStyle" xmi:id="_6NuldM5dEemmCI5rrjVnbw"/>
+ <styles xsi:type="style:PapyrusDiagramStyle" xmi:id="_6Nuldc5dEemmCI5rrjVnbw" diagramKindId="org.eclipse.papyrus.uml.diagram.activity">
+ <owner href="GrayedIcon.uml#_6IECQM5dEemmCI5rrjVnbw"/>
+ </styles>
+ <element href="GrayedIcon.uml#_6Nk0YM5dEemmCI5rrjVnbw"/>
+ </notation:Diagram>
+</xmi:XMI>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.uml b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.uml
new file mode 100644
index 00000000000..786c2cc0ec2
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/resources/GrayedIcon.uml
@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<uml:Model xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_6IECQM5dEemmCI5rrjVnbw" name="GrayedIcon">
+ <packageImport xmi:type="uml:PackageImport" xmi:id="_6QZe4M5dEemmCI5rrjVnbw">
+ <importedPackage xmi:type="uml:Model" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#_0"/>
+ </packageImport>
+ <packagedElement xmi:type="uml:StateMachine" xmi:id="_6LOrAM5dEemmCI5rrjVnbw" name="StateMachine1">
+ <region xmi:type="uml:Region" xmi:id="_6NMZ4M5dEemmCI5rrjVnbw" name="Region1"/>
+ </packagedElement>
+ <packagedElement xmi:type="uml:Activity" xmi:id="_6Nk0YM5dEemmCI5rrjVnbw" name="Activity2"/>
+</uml:Model>
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java
index 4562c8ce382..069677383e5 100644
--- a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/AllTests.java
@@ -14,6 +14,7 @@
*****************************************************************************/
package org.eclipse.papyrus.infra.ui.architecture.tests;
+import org.eclipse.papyrus.infra.ui.architecture.tests.editors.GrayedIconTest;
import org.eclipse.papyrus.infra.ui.architecture.tests.editors.ModelExplorerViewpointFilterTest;
import org.eclipse.papyrus.infra.ui.architecture.tests.editors.SwitchViewpointsTest;
import org.eclipse.papyrus.junit.framework.classification.ClassificationSuite;
@@ -28,6 +29,7 @@ import org.junit.runners.Suite.SuiteClasses;
@SuiteClasses({
SwitchViewpointsTest.class,
ModelExplorerViewpointFilterTest.class,
+ GrayedIconTest.class,
})
@Headless
public class AllTests {
diff --git a/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/GrayedIconTest.java b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/GrayedIconTest.java
new file mode 100644
index 00000000000..0c9f5d422b5
--- /dev/null
+++ b/tests/junit/plugins/infra/org.eclipse.papyrus.infra.ui.architecture.tests/src/org/eclipse/papyrus/infra/ui/architecture/tests/editors/GrayedIconTest.java
@@ -0,0 +1,112 @@
+/*****************************************************************************
+ * Copyright (c) 2019 CEA LIST and others.
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Nicolas FAUVERGUE (CEA LIST) nicolas.fauvergue@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.ui.architecture.tests.editors;
+
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.papyrus.infra.architecture.ArchitectureDescriptionUtils;
+import org.eclipse.papyrus.infra.core.sasheditor.editor.IMultiPageEditorPart;
+import org.eclipse.papyrus.infra.core.sashwindows.di.service.IPageManager;
+import org.eclipse.papyrus.infra.ui.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.viewpoints.policy.PolicyChecker;
+import org.eclipse.papyrus.infra.viewpoints.policy.ViewPrototype;
+import org.eclipse.papyrus.junit.framework.classification.tests.AbstractPapyrusTest;
+import org.eclipse.papyrus.junit.utils.rules.PapyrusEditorFixture;
+import org.eclipse.papyrus.junit.utils.rules.PluginResource;
+import org.junit.Assert;
+import org.junit.Rule;
+import org.junit.Test;
+
+/**
+ * This class allows to check the icons depending to the enabled viewpoints.
+ */
+@SuppressWarnings("nls")
+@PluginResource("/resources/GrayedIcon.di")
+public class GrayedIconTest extends AbstractPapyrusTest {
+
+ /**
+ * The editor fixture to manage the opening model.
+ */
+ @Rule
+ public final PapyrusEditorFixture editorFixture = new PapyrusEditorFixture();
+
+ /**
+ * This allows to check the icon depending to the enabled viewpoints.
+ */
+ @Test
+ public void checkIcons() {
+
+ // Get the active editor
+ final IMultiDiagramEditor activeEditor = editorFixture.getEditor();
+
+ // Get the page manager
+ final IPageManager pageManager = ((IMultiPageEditorPart) activeEditor).getAdapter(IPageManager.class);
+ Assert.assertNotNull("The page manager cannot be null", null != pageManager);
+
+ // Get the activity diagram
+ final Diagram activityDiagram = getActivityDiagram(pageManager);
+ Assert.assertNotNull("The activity diagram is not found", activityDiagram);
+
+ // Check the current icon (it won't be the grayed one)
+ Assert.assertEquals("The icon is not the correct one", "platform:/plugin/org.eclipse.papyrus.uml.diagram.activity/icons/obj16/Diagram_Activity.gif", getIcon(activityDiagram));
+
+ // Change the architecture viewpoint
+ final ArchitectureDescriptionUtils helper = new ArchitectureDescriptionUtils(editorFixture.getModelSet());
+ // Only keep the analysis viewpoint
+ final Set<String> viewpointIds = helper.getArchitectureViewpointIds().stream().filter(id -> id.equals("org.eclipse.papyrus.uml.analysis")).collect(Collectors.toSet());
+
+ // execute the command to change viewpoint and close editors
+ editorFixture.getEditingDomain().getCommandStack().execute(helper.switchArchitectureViewpointIds(viewpointIds.toArray(new String[0])));
+
+ // Check the current icon (it should be the grayed one)
+ Assert.assertEquals("The icon is not the correct one", "platform:/plugin/org.eclipse.papyrus.uml.diagram.activity/icons/obj16/Diagram_Activity_grayed.gif", getIcon(activityDiagram));
+ }
+
+ /**
+ * Get the activity diagram from the page manager.
+ *
+ * @param pageManager
+ * The page manager.
+ * @return The activity diagram.
+ */
+ private Diagram getActivityDiagram(final IPageManager pageManager) {
+ for (final Object pageIdentifier : pageManager.allPages()) {
+ if (pageIdentifier instanceof Diagram && "PapyrusUMLActivityDiagram".equals(((Diagram) pageIdentifier).getDiagram().getType())) {
+ return (Diagram) pageIdentifier;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get the icon for the activity diagram for example.
+ *
+ * @param activityDiagram
+ * The activity diagram.
+ * @return The grayed icon if not in viewpoint, otherwise the initial icon.
+ */
+ private String getIcon(final Diagram activityDiagram) {
+ final PolicyChecker checker = PolicyChecker.getFor(activityDiagram);
+ final ViewPrototype viewPrototype = ViewPrototype.get(activityDiagram);
+ if (checker.isInViewpoint(viewPrototype.getRepresentationKind())) {
+ return viewPrototype.getIconURI();
+ } else {
+ return viewPrototype.getGrayedIconURI();
+ }
+ }
+}

Back to the top