Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQuentin Le Menez2018-01-09 10:09:46 +0000
committerQuentin Le Menez2018-01-09 13:18:15 +0000
commitd98116b5b376f18b6cf626ba4158a35fe9a4a64e (patch)
tree4458c9c5ada0a216b385813a56ea9a9b8c7b6509 /plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer
parent453e99bc2dcbd5fabad100f9d0d5f682013c3b19 (diff)
downloadorg.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.gz
org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.tar.xz
org.eclipse.papyrus-d98116b5b376f18b6cf626ba4158a35fe9a4a64e.zip
Bug 515367 - [releng] Uniformization of the end of lines to Unix standard
- Format the EOL of all the files matched by: grep -rIUs . | xargs -Ifile dos2unix -k 'file' Change-Id: I5c41d540a9a67b50de9b912ab35e16cc9a912961 Signed-off-by: Quentin Le Menez <quentin.lemenez@cea.fr>
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF34
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/about.html54
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom250
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/providers/DiagramPropertyTester.java216
4 files changed, 277 insertions, 277 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
index dbc0408c4c5..1ac715fbe1f 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/META-INF/MANIFEST.MF
@@ -1,17 +1,17 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
- org.eclipse.papyrus.infra.internationalization.edit;bundle-version="[1.0.0,2.0.0)"
-Bundle-Vendor: %providerName
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 1.2.0.qualifier
-Bundle-Name: %pluginName
-Bundle-Localization: plugin
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.modelexplorer.Activator
-Bundle-Description: %pluginDescription
-Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.modelexplorer;singleton:=true
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.emf;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.gmfdiag.common;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="[3.0.0,4.0.0)",
+ org.eclipse.papyrus.infra.internationalization.utils;bundle-version="[1.0.0,2.0.0)",
+ org.eclipse.papyrus.infra.internationalization.edit;bundle-version="[1.0.0,2.0.0)"
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.2.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.gmfdiag.modelexplorer.Activator
+Bundle-Description: %pluginDescription
+Bundle-SymbolicName: org.eclipse.papyrus.infra.gmfdiag.modelexplorer;singleton:=true
+Bundle-RequiredExecutionEnvironment: JavaSE-1.8
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/about.html b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/about.html
index dd02e0be168..bc57a4aa9b5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/about.html
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/about.html
@@ -1,28 +1,28 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml">
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
-<title>About</title>
-</head>
-<body lang="EN-US">
-<h2>About This Content</h2>
-
-<p>December 2, 2009</p>
-<h3>License</h3>
-
-<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
-indicated below, the Content is provided to you under the terms and conditions of the
-Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
-at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
-For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
-
-<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
-being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
-apply to your use of any object code in the Content. Check the Redistributor's license that was
-provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
-indicated below, the terms and conditions of the EPL still apply to any source code in the Content
-and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
-
-</body>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"/>
+<title>About</title>
+</head>
+<body lang="EN-US">
+<h2>About This Content</h2>
+
+<p>December 2, 2009</p>
+<h3>License</h3>
+
+<p>The Eclipse Foundation makes available all content in this plug-in (&quot;Content&quot;). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 (&quot;EPL&quot;). A copy of the EPL is available
+at <a href="http://www.eclipse.org/legal/epl-v10.html">http://www.eclipse.org/legal/epl-v10.html</a>.
+For purposes of the EPL, &quot;Program&quot; will mean the Content.</p>
+
+<p>If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party (&quot;Redistributor&quot;) and different terms and conditions may
+apply to your use of any object code in the Content. Check the Redistributor's license that was
+provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise
+indicated below, the terms and conditions of the EPL still apply to any source code in the Content
+and such source code may be obtained at <a href="http://www.eclipse.org">http://www.eclipse.org</a>.</p>
+
+</body>
</html> \ No newline at end of file
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
index e78bdbc6000..6b59d09dbe5 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom
@@ -1,125 +1,125 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<custom:Customization
- xmi:version="2.0"
- xmlns:xmi="http://www.omg.org/XMI"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom"
- xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
- xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet"
- xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery"
- xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query"
- name="PapyrusDiagram"
- documentation="Display contained diagram and their icons"
- mustBeLoadedByDefault="true"
- rank="-1000">
- <eClassifiers
- xsi:type="custom:EClassCustomization"
- name="Diagram"
- documentation="Representation of diagram in model explorer">
- <extendedMetaclass
- href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
- <facetOperations
- name="GetDiagramLabel"
- documentation="Return the label of the corresponding diagram">
- <eType
- xsi:type="ecore:EDataType"
- href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
- <eParameters
- name="eStructuralFeature">
- <eType
- xsi:type="ecore:EClass"
- href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
- </eParameters>
- <query
- xsi:type="javaQuery:JavaQuery"
- implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetDiagramLabel"/>
- <override
- xsi:type="efacet:FacetOperation"
- href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/label"/>
- </facetOperations>
- <facetOperations
- name="GetDiagramIcon"
- documentation="Return the path to the icon of the corresponding diagram">
- <eType
- xsi:type="ecore:EDataType"
- href="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
- <eParameters
- name="eStructuralFeature">
- <eType
- xsi:type="ecore:EClass"
- href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
- </eParameters>
- <query
- xsi:type="javaQuery:JavaQuery"
- implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetDiagramIcon"/>
- <override
- xsi:type="efacet:FacetOperation"
- href="../../../plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/image"/>
- </facetOperations>
- <facetOperations
- name="GetVisibleReferences"
- upperBound="-1"
- documentation="Return the list of visible references (Hide everything)">
- <eType
- xsi:type="ecore:EClass"
- href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/>
- <query
- xsi:type="javaQuery:JavaQuery"
- implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.EmptyListQuery"/>
- <override
- xsi:type="efacet:FacetOperation"
- href="../../../plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers
- xsi:type="efacet:Facet"
- name="DiagramContainer"
- documentation="this element represent a container of diagram"
- conformanceTypedElement="//DiagramContainer/isDiagramContainer">
- <extendedMetaclass
- href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
- <facetOperations
- name="isDiagramContainer"
- documentation="test if the element references diagrams">
- <eType
- xsi:type="ecore:EDataType"
- href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
- <query
- xsi:type="javaQuery:JavaQuery"
- implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.IsDiagramContainer"/>
- </facetOperations>
- </eClassifiers>
- <eClassifiers
- xsi:type="custom:FacetCustomization"
- name="DiagramContainer"
- documentation="Representation of a diagram container">
- <facetElements
- xsi:type="efacet:FacetReference"
- name="diagrams"
- upperBound="-1"
- defaultValueLiteral=""
- derived="true">
- <eType
- xsi:type="ecore:EClass"
- href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
- <query
- xsi:type="query:OperationCallQuery"
- operation="//DiagramContainer.1/DiagramsRefContent"/>
- </facetElements>
- <facetOperations
- name="DiagramsRefContent"
- upperBound="-1"
- documentation="Get the collection of all contained diagrams">
- <eType
- xsi:type="ecore:EClass"
- href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
- <query
- xsi:type="javaQuery:JavaQuery"
- implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetContainedDiagrams"/>
- </facetOperations>
- <extendedFacets
- href="../../../plugin/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom#//DiagramContainer"/>
- <customizedFacet
- href="../../../plugin/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom#//DiagramContainer"/>
- </eClassifiers>
-</custom:Customization>
+<?xml version="1.0" encoding="UTF-8"?>
+<custom:Customization
+ xmi:version="2.0"
+ xmlns:xmi="http://www.omg.org/XMI"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns:custom="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom"
+ xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore"
+ xmlns:efacet="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet"
+ xmlns:javaQuery="http://www.eclipse.org/papyrus/emf/facet/query/java/0.2.incubation/javaquery"
+ xmlns:query="http://www.eclipse.org/papyrus/emf/facet/efacet/0.2.incubation/efacet/query"
+ name="PapyrusDiagram"
+ documentation="Display contained diagram and their icons"
+ mustBeLoadedByDefault="true"
+ rank="-1000">
+ <eClassifiers
+ xsi:type="custom:EClassCustomization"
+ name="Diagram"
+ documentation="Representation of diagram in model explorer">
+ <extendedMetaclass
+ href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
+ <facetOperations
+ name="GetDiagramLabel"
+ documentation="Return the label of the corresponding diagram">
+ <eType
+ xsi:type="ecore:EDataType"
+ href="http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eParameters
+ name="eStructuralFeature">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetDiagramLabel"/>
+ <override
+ xsi:type="efacet:FacetOperation"
+ href="platform:/plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/label"/>
+ </facetOperations>
+ <facetOperations
+ name="GetDiagramIcon"
+ documentation="Return the path to the icon of the corresponding diagram">
+ <eType
+ xsi:type="ecore:EDataType"
+ href="http://www.eclipse.org/papyrus/emf/facet/custom/0.2.incubation/custom_primitive_types#//Image"/>
+ <eParameters
+ name="eStructuralFeature">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/emf/2002/Ecore#//ETypedElement"/>
+ </eParameters>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetDiagramIcon"/>
+ <override
+ xsi:type="efacet:FacetOperation"
+ href="../../../plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/image"/>
+ </facetOperations>
+ <facetOperations
+ name="GetVisibleReferences"
+ upperBound="-1"
+ documentation="Return the list of visible references (Hide everything)">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/emf/2002/Ecore#//EReference"/>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.EmptyListQuery"/>
+ <override
+ xsi:type="efacet:FacetOperation"
+ href="../../../plugin/org.eclipse.papyrus.emf.facet.custom.ui/resources/customproperties.efacet#//CustomizedEObject/visibleReferences"/>
+ </facetOperations>
+ </eClassifiers>
+ <eClassifiers
+ xsi:type="efacet:Facet"
+ name="DiagramContainer"
+ documentation="this element represent a container of diagram"
+ conformanceTypedElement="//DiagramContainer/isDiagramContainer">
+ <extendedMetaclass
+ href="http://www.eclipse.org/emf/2002/Ecore#//EObject"/>
+ <facetOperations
+ name="isDiagramContainer"
+ documentation="test if the element references diagrams">
+ <eType
+ xsi:type="ecore:EDataType"
+ href="http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.IsDiagramContainer"/>
+ </facetOperations>
+ </eClassifiers>
+ <eClassifiers
+ xsi:type="custom:FacetCustomization"
+ name="DiagramContainer"
+ documentation="Representation of a diagram container">
+ <facetElements
+ xsi:type="efacet:FacetReference"
+ name="diagrams"
+ upperBound="-1"
+ defaultValueLiteral=""
+ derived="true">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
+ <query
+ xsi:type="query:OperationCallQuery"
+ operation="//DiagramContainer.1/DiagramsRefContent"/>
+ </facetElements>
+ <facetOperations
+ name="DiagramsRefContent"
+ upperBound="-1"
+ documentation="Get the collection of all contained diagrams">
+ <eType
+ xsi:type="ecore:EClass"
+ href="http://www.eclipse.org/gmf/runtime/1.0.2/notation#//Diagram"/>
+ <query
+ xsi:type="javaQuery:JavaQuery"
+ implementationClassName="org.eclipse.papyrus.infra.gmfdiag.modelexplorer.queries.GetContainedDiagrams"/>
+ </facetOperations>
+ <extendedFacets
+ href="../../../plugin/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom#//DiagramContainer"/>
+ <customizedFacet
+ href="../../../plugin/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/resources/PapyrusDiagram.custom#//DiagramContainer"/>
+ </eClassifiers>
+</custom:Customization>
diff --git a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/providers/DiagramPropertyTester.java b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/providers/DiagramPropertyTester.java
index 455857eae78..56abfe26328 100644
--- a/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/providers/DiagramPropertyTester.java
+++ b/plugins/infra/gmfdiag/org.eclipse.papyrus.infra.gmfdiag.modelexplorer/src/org/eclipse/papyrus/infra/gmfdiag/modelexplorer/providers/DiagramPropertyTester.java
@@ -1,108 +1,108 @@
-/*****************************************************************************
- * Copyright (c) 2011 CEA LIST.
- *
- *
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
- *
- *****************************************************************************/
-package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.providers;
-
-import java.util.Iterator;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gmf.runtime.notation.Diagram;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-
-/**
- * This class provides test called by the plugin.xml in order to know if handlers should be active or not.
- *
- * Sometimes these test can be done directly in the plugin.xml in the activeWhen (with instanceof, adapt, ...),
- * but in this case, Eclipse doesn't refresh correctly the status of the command in the menu Edit or in other menu.
- *
- *
- * FIXME : i think this class is not yet used
- */
-public class DiagramPropertyTester extends PropertyTester {
-
-
- /** property to test if the selected elements is a table */
- public static final String IS_DIAGRAM = "isDiagram"; //$NON-NLS-1$
-
-
- /**
- *
- * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
- *
- * @param receiver
- * @param property
- * @param args
- * @param expectedValue
- * @return
- */
- public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
- if (IS_DIAGRAM.equals(property) && receiver instanceof IStructuredSelection) {
- boolean answer = isDiagram((IStructuredSelection) receiver);
- return new Boolean(answer).equals(expectedValue);
- }
- return false;
- }
-
-
-
- // /**
- // * Tests the selection in order to know if it contains only {@link TableInstance}
- // *
- // * @param selection
- // * @return
- // * <code>true</code> if the selection is composed by {@link TableInstance}
- // */
- // private boolean isDiagram(final IStructuredSelection selection) {
- // if(!selection.isEmpty()) {
- // Iterator<?> iter = selection.iterator();
- // while(iter.hasNext()) {
- // if(!(iter.next() instanceof Diagram)) {
- // return false;
- // }
- // }
- // return true;
- // }
- // return false;
- // }
- //
- /**
- * Tests the selection in order to know if it contains only {@link Diagram}
- *
- * @param selection
- * @return
- * <code>true</code> if the selection is composed by {@link Diagram}
- *
- * FIXME : this method should be in an upper plugin like oep.infra.gmfdiag.common
- * FIXME : why use this one and not the other method isDiagram (see upper in this class)
- */
- private boolean isDiagram(IStructuredSelection selection) {
- if (!selection.isEmpty()) {
- Iterator<?> iter = selection.iterator();
- while (iter.hasNext()) {
- /**
- * Set to use the IAdaptable mechanism
- * Used for example for facet elements
- */
- final Object next = iter.next();
- EObject diag = EMFHelper.getEObject(next);
- if (!(diag instanceof Diagram)) {
- return false;
- }
- }
- return true;
- }
- return false;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2011 CEA LIST.
+ *
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Vincent Lorenzo (CEA LIST) vincent.lorenzo@cea.fr - Initial API and implementation
+ *
+ *****************************************************************************/
+package org.eclipse.papyrus.infra.gmfdiag.modelexplorer.providers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.gmf.runtime.notation.Diagram;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+
+/**
+ * This class provides test called by the plugin.xml in order to know if handlers should be active or not.
+ *
+ * Sometimes these test can be done directly in the plugin.xml in the activeWhen (with instanceof, adapt, ...),
+ * but in this case, Eclipse doesn't refresh correctly the status of the command in the menu Edit or in other menu.
+ *
+ *
+ * FIXME : i think this class is not yet used
+ */
+public class DiagramPropertyTester extends PropertyTester {
+
+
+ /** property to test if the selected elements is a table */
+ public static final String IS_DIAGRAM = "isDiagram"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
+ *
+ * @param receiver
+ * @param property
+ * @param args
+ * @param expectedValue
+ * @return
+ */
+ public boolean test(final Object receiver, final String property, final Object[] args, final Object expectedValue) {
+ if (IS_DIAGRAM.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean answer = isDiagram((IStructuredSelection) receiver);
+ return new Boolean(answer).equals(expectedValue);
+ }
+ return false;
+ }
+
+
+
+ // /**
+ // * Tests the selection in order to know if it contains only {@link TableInstance}
+ // *
+ // * @param selection
+ // * @return
+ // * <code>true</code> if the selection is composed by {@link TableInstance}
+ // */
+ // private boolean isDiagram(final IStructuredSelection selection) {
+ // if(!selection.isEmpty()) {
+ // Iterator<?> iter = selection.iterator();
+ // while(iter.hasNext()) {
+ // if(!(iter.next() instanceof Diagram)) {
+ // return false;
+ // }
+ // }
+ // return true;
+ // }
+ // return false;
+ // }
+ //
+ /**
+ * Tests the selection in order to know if it contains only {@link Diagram}
+ *
+ * @param selection
+ * @return
+ * <code>true</code> if the selection is composed by {@link Diagram}
+ *
+ * FIXME : this method should be in an upper plugin like oep.infra.gmfdiag.common
+ * FIXME : why use this one and not the other method isDiagram (see upper in this class)
+ */
+ private boolean isDiagram(IStructuredSelection selection) {
+ if (!selection.isEmpty()) {
+ Iterator<?> iter = selection.iterator();
+ while (iter.hasNext()) {
+ /**
+ * Set to use the IAdaptable mechanism
+ * Used for example for facet elements
+ */
+ final Object next = iter.next();
+ EObject diag = EMFHelper.getEObject(next);
+ if (!(diag instanceof Diagram)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}

Back to the top