Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/.classpath7
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/.project34
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/META-INF/MANIFEST.MF23
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/build.properties5
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/plugin.xml28
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetCustomization.uiCustom33
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetQuery.querySet23
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_Facet.facetSet12
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_FacetCustomization.uiCustom31
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/Activator.java32
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractEditorContainerQuery.java33
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractGetEditorIconQuery.java57
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetContainedTables.java63
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableIcon.java17
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableName.java14
-rw-r--r--incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/IsTableEFacetContainer.java31
16 files changed, 443 insertions, 0 deletions
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/.classpath b/incoming/org.eclipse.papyrus.infra.table.efacet/.classpath
new file mode 100644
index 00000000000..45f024e850e
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/.project b/incoming/org.eclipse.papyrus.infra.table.efacet/.project
new file mode 100644
index 00000000000..e52b1325f2f
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/.project
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.table.efacet</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.emf.facet.common.sdk.core.projectBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.emf.facet.common.sdk.core.ProjectNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ </natures>
+</projectDescription>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/META-INF/MANIFEST.MF b/incoming/org.eclipse.papyrus.infra.table.efacet/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..2a6c12d9157
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/META-INF/MANIFEST.MF
@@ -0,0 +1,23 @@
+Manifest-Version: 1.0
+Bundle-Name: org.eclipse.papyrus.infra.table.efacet
+Bundle-ClassPath: .,bin
+Bundle-Activator: org.eclipse.papyrus.infra.table.efacet.Activator
+Bundle-ManifestVersion: 2
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.efacet;singleton:
+ =true
+Bundle-ActivationPolicy: lazy
+Require-Bundle: org.eclipse.core.runtime,
+ org.eclipse.emf.facet.util.core,
+ org.eclipse.uml2.uml,
+ org.eclipse.emf.ecore,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.emf.facet.infra.facet.core,
+ org.eclipse.uml2.types,
+ org.eclipse.papyrus.infra.table.efacet.metamodel,
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.papyrus.infra.core,
+ com.google.guava,
+ org.eclipse.papyrus.views.modelexplorer
+Bundle-Version: 0.0.1.qualifier
+
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/build.properties b/incoming/org.eclipse.papyrus.infra.table.efacet/build.properties
new file mode 100644
index 00000000000..e9863e281ea
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/build.properties
@@ -0,0 +1,5 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/plugin.xml b/incoming/org.eclipse.papyrus.infra.table.efacet/plugin.xml
new file mode 100644
index 00000000000..06f644825bc
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/plugin.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.emf.facet.infra.query.registration">
+ <modelqueryset
+ file="resources/TableEFacetQuery.querySet">
+ </modelqueryset>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.facet.registration">
+ <facetset
+ file="resources/TableEFacet_Facet.facetSet">
+ </facetset>
+ </extension>
+ <extension
+ point="org.eclipse.emf.facet.infra.browser.custom.core.registration">
+ <browserCustomization
+ file="resources/TableEFacetCustomization.uiCustom"
+ loadByDefault="true">
+ </browserCustomization>
+ <browserCustomization
+ file="resources/TableEFacet_FacetCustomization.uiCustom"
+ loadByDefault="true">
+ </browserCustomization>
+ </extension>
+
+</plugin>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetCustomization.uiCustom b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetCustomization.uiCustom
new file mode 100644
index 00000000000..8aff7b461f9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetCustomization.uiCustom
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable">
+ <types metaclassName="papyrustable.PapyrusTable">
+ <customizedFeatures customizedFeature="label">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#GetPapyrusTableName"/>
+ </defaultValue>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="icon">
+ <defaultValue xsi:type="uicustom:DerivedFeatureValue">
+ <valueCalculator xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#GetPapyrusTableIcon"/>
+ </defaultValue>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="hideMetaclassName">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ <references referenceName="table">
+ <customizedFeatures>
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ </customizedFeatures>
+ </references>
+ <references referenceName="feature">
+ <customizedFeatures>
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ </customizedFeatures>
+ </references>
+ <references referenceName="queries">
+ <customizedFeatures>
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ </customizedFeatures>
+ </references>
+ </types>
+</uicustom:MetamodelView>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetQuery.querySet b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetQuery.querySet
new file mode 100644
index 00000000000..5c30d185f42
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacetQuery.querySet
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ASCII"?>
+<query:ModelQuerySet 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:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="TableEFacetQuery">
+ <associatedMetamodels href="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/emf/2002/Ecore#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+ <associatedMetamodels href="http://www.eclipse.org/uml2/4.0.0/Types#/"/>
+ <queries xsi:type="query:JavaModelQuery" name="IsTableContainer" description="Returns true if the element contains a Table" implementationClassName="org.eclipse.papyrus.infra.table.efacet.queries.IsTableContainer">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/emf/2002/Ecore#//EBooleanObject"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="GetContainedTables" description="Get the collection of all contained tables" upperBound="-1" implementationClassName="org.eclipse.papyrus.infra.table.efacet.queries.GetContainedTables">
+ <returnType xsi:type="ecore:EClass" href="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable#//PapyrusTable"/>
+ <scope href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="GetTableIcon" description="Return the path to the icon of the corresponding table" implementationClassName="org.eclipse.papyrus.infra.table.efacet.queries.GetTableIcon">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ <scope href="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable#//PapyrusTable"/>
+ </queries>
+ <queries xsi:type="query:JavaModelQuery" name="GetTableName" description="Return the name for the table" implementationClassName="org.eclipse.papyrus.infra.table.efacet.queries.GetTableName">
+ <returnType xsi:type="ecore:EDataType" href="http://www.eclipse.org/uml2/4.0.0/Types#//String"/>
+ <scope href="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable#//PapyrusTable"/>
+ </queries>
+</query:ModelQuerySet>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_Facet.facetSet b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_Facet.facetSet
new file mode 100644
index 00000000000..b60d9221a3d
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_Facet.facetSet
@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="ASCII"?>
+<facet:FacetSet 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:facet="http://www.eclipse.org/EmfFacet/infra/facet/0.8.incubation" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" name="TableEFacet_Facet" nsURI="http://org.eclipse.org/papyrus/modelExplorer/TableEFacet_Facet" nsPrefix="TableEFacet_Facet">
+ <eClassifiers xsi:type="facet:Facet" name="TableEFacetContainer" abstract="true">
+ <eSuperTypes href="http://www.eclipse.org/uml2/4.0.0/UML#//Element"/>
+ <eStructuralFeatures xsi:type="facet:FacetReference" name="tables" upperBound="-1" volatile="true" unsettable="true">
+ <eType xsi:type="ecore:EClass" href="http://www.eclipse.org/Papyrus/PapyrusTable/0.9.0/papyrustable#//PapyrusTable"/>
+ <valueQuery xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#GetContainedTables"/>
+ </eStructuralFeatures>
+ <conditionQuery xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#IsTableContainer"/>
+ </eClassifiers>
+ <extendedPackage href="http://www.eclipse.org/uml2/4.0.0/UML#/"/>
+</facet:FacetSet>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_FacetCustomization.uiCustom b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_FacetCustomization.uiCustom
new file mode 100644
index 00000000000..9547b428a38
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/resources/TableEFacet_FacetCustomization.uiCustom
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="ASCII"?>
+<uicustom:MetamodelView xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:query="http://www.eclipse.org/EmfFacet/infra/query/0.8.incubation" xmlns:uicustom="http://www.eclipse.org/EmfFacet/infra/browser/custom/0.8" metamodelURI="http://org.eclipse.org/papyrus/modelExplorer/PapyrusTableFacet">
+ <types metaclassName="PapyrusTableFacet.FacetTableContainer">
+ <references referenceName="tables">
+ <customizedFeatures>
+ <valueCases>
+ <value xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ <condition xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#IsTableContainer"/>
+ </valueCases>
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="collapseLink">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ </references>
+ </types>
+ <types metaclassName="PapyrusTableFacet.FacetPapyrusTableContainer">
+ <references referenceName="tables">
+ <customizedFeatures>
+ <valueCases>
+ <value xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ <condition xsi:type="query:JavaModelQuery" href="emffacet:/query/PapyrusTableQuery#IsPapyrusTableContainer"/>
+ </valueCases>
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="false"/>
+ </customizedFeatures>
+ <customizedFeatures customizedFeature="collapseLink">
+ <defaultValue xsi:type="uicustom:StaticFeatureValue" value="true"/>
+ </customizedFeatures>
+ </references>
+ </types>
+</uicustom:MetamodelView>
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/Activator.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/Activator.java
new file mode 100644
index 00000000000..fcf033e33b7
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/Activator.java
@@ -0,0 +1,32 @@
+package org.eclipse.papyrus.infra.table.efacet;
+
+import org.eclipse.core.runtime.Plugin;
+import org.osgi.framework.BundleContext;
+
+/** The activator class controls the plug-in life cycle */
+public class Activator extends Plugin {
+
+ // The shared instance
+ private static Activator plugin;
+
+ @Override
+ public void start(final BundleContext context) throws Exception {
+ super.start(context);
+ Activator.plugin = this;
+ }
+
+ @Override
+ public void stop(final BundleContext context) throws Exception {
+ Activator.plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return Activator.plugin;
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractEditorContainerQuery.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractEditorContainerQuery.java
new file mode 100644
index 00000000000..fd9ec5ca0ea
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractEditorContainerQuery.java
@@ -0,0 +1,33 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
+
+/**
+ *
+ * An abstract class to get the pageMngr
+ *
+ */
+//TODO duplicated code from modelexplorer.views
+//TODO should be refactored and store into an upper plugin like oep.infra.core.xxx
+public abstract class AbstractEditorContainerQuery {//we don't need to implements IJavaModelQuery here
+
+ /**
+ *
+ * @return
+ * @throws ServiceException
+ */
+ protected IPageMngr getPageMngr() throws ServiceException {
+ // pageMngr can't be static, because there is a new IPageMngr each time we open a Papyrus Editor
+ final IMultiDiagramEditor papyrusEditor = EditorUtils.getMultiDiagramEditor();
+ if(papyrusEditor != null) {
+ final ServicesRegistry serviceRegistry = papyrusEditor.getServicesRegistry();
+ return ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
+ }
+ throw new ServiceException("Can't retrieve the IPageMngr"); //$NON-NLS-1$
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractGetEditorIconQuery.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractGetEditorIconQuery.java
new file mode 100644
index 00000000000..bed379fefce
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/AbstractGetEditorIconQuery.java
@@ -0,0 +1,57 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistry;
+import org.eclipse.papyrus.infra.core.editorsfactory.IPageIconsRegistryExtended;
+import org.eclipse.papyrus.infra.core.editorsfactory.PageIconsRegistry;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.core.utils.EditorUtils;
+
+/**
+ *
+ * An abstract class to get the iconRegistery
+ *
+ */
+//TODO duplicated code from modelexplorer.views
+//TODO should be refactored and store into an upper plugin like oep.infra.core.xxx
+public abstract class AbstractGetEditorIconQuery {//we don't need to implements IJavaModelQuery here
+
+ /**
+ * the icon registry
+ */
+ private static IPageIconsRegistry editorRegistry;
+
+ /**
+ * Get the EditorRegistry used to create editor instances. This default
+ * implementation return the singleton eINSTANCE. This method can be
+ * subclassed to return another registry.
+ *
+ * @return the singleton eINSTANCE of editor registry
+ */
+ protected IPageIconsRegistryExtended getEditorRegistry() {
+ if(editorRegistry == null) {
+ editorRegistry = createEditorRegistry();
+ }
+ if(!(editorRegistry instanceof IPageIconsRegistryExtended)) {
+ throw new RuntimeException("The editor registry do not implement IPageIconsRegistryExtended");////$NON-NLS-1$
+ }
+ return (IPageIconsRegistryExtended)editorRegistry;
+ }
+
+ /**
+ * Return the EditorRegistry for nested editor descriptors. Subclass should
+ * implements this method in order to return the registry associated to the
+ * extension point namespace.
+ *
+ * @return the EditorRegistry for nested editor descriptors
+ * FIXME : use a deprecated method
+ */
+ protected IPageIconsRegistry createEditorRegistry() {
+ try {
+ return EditorUtils.getServiceRegistry().getService(IPageIconsRegistry.class);
+ } catch (final ServiceException e) {
+ // Not found, return an empty one which return null for each
+ // request.
+ return new PageIconsRegistry();
+ }
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetContainedTables.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetContainedTables.java
new file mode 100644
index 00000000000..da01cb9d7be
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetContainedTables.java
@@ -0,0 +1,63 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.TablePackage;
+import org.eclipse.papyrus.infra.core.utils.PapyrusEcoreUtils;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrustablePackage;
+import org.eclipse.uml2.uml.Element;
+
+import com.google.common.base.Function;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Sets;
+
+/** Get the collection of all contained tables */
+//FIXME this query is declared using Element in the querySet -> change into EObject when the EMF-Facet bug will be corrected 365744
+
+public class GetContainedTables extends AbstractEditorContainerQuery implements IJavaModelQuery<Element, Collection<PapyrusTable>> {
+
+ public Collection<PapyrusTable> evaluate(final Element context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ final Predicate<EStructuralFeature.Setting> p = new Predicate<EStructuralFeature.Setting>() {
+
+ public boolean apply(final EStructuralFeature.Setting setting) {
+ return setting.getEObject() instanceof Table && setting.getEStructuralFeature() == TablePackage.Literals.TABLE__CONTEXT;
+ }
+ };
+ final Function<EStructuralFeature.Setting, PapyrusTable> f = new Function<EStructuralFeature.Setting, PapyrusTable>() {
+
+ public PapyrusTable apply(final EStructuralFeature.Setting setting) {
+ final Collection<Setting> references = PapyrusEcoreUtils.getUsages(setting.getEObject());
+ final Predicate<Setting> p2 = new Predicate<EStructuralFeature.Setting>() {
+
+ public boolean apply(final Setting setting) {
+ return setting.getEObject() instanceof PapyrusTable && PapyrustablePackage.Literals.PAPYRUS_TABLE__TABLE == setting.getEStructuralFeature();
+ }
+ };
+ final Iterator<Setting> iterator = Iterables.filter(references, p2).iterator();
+ if(iterator.hasNext()) {
+ return (PapyrusTable)iterator.next().getEObject();
+ }
+ return null;
+ }
+
+ };
+
+ Iterable<PapyrusTable> transform = Iterables.transform(Iterables.filter(PapyrusEcoreUtils.getUsages(context), p), f);
+ transform = Iterables.filter(transform, new Predicate<PapyrusTable>() {
+
+ public boolean apply(final PapyrusTable table) {
+ return table != null;
+ }
+ });
+ return Sets.newHashSet(transform);
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableIcon.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableIcon.java
new file mode 100644
index 00000000000..6ce506e4251
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableIcon.java
@@ -0,0 +1,17 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+
+/** Return the path to the icon of the corresponding table */
+public class GetTableIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery<PapyrusTable, String> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String evaluate(final PapyrusTable context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return "/" + getEditorRegistry().getEditorURLIcon(context); //$NON-NLS-1$
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableName.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableName.java
new file mode 100644
index 00000000000..9ec427233b9
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/GetTableName.java
@@ -0,0 +1,14 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
+
+/** Return the name for the table */
+public class GetTableName implements IJavaModelQuery<PapyrusTable, String> {
+
+ public String evaluate(final PapyrusTable context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return context.getName();
+ }
+}
diff --git a/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/IsTableEFacetContainer.java b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/IsTableEFacetContainer.java
new file mode 100644
index 00000000000..5bf8fc27769
--- /dev/null
+++ b/incoming/org.eclipse.papyrus.infra.table.efacet/src/org/eclipse/papyrus/infra/table/efacet/queries/IsTableEFacetContainer.java
@@ -0,0 +1,31 @@
+package org.eclipse.papyrus.infra.table.efacet.queries;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature.Setting;
+import org.eclipse.emf.facet.infra.query.core.exception.ModelQueryExecutionException;
+import org.eclipse.emf.facet.infra.query.core.java.IJavaModelQuery;
+import org.eclipse.emf.facet.infra.query.core.java.ParameterValueList;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.TablePackage;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+
+import com.google.common.base.Predicate;
+
+/** Returns true if the element contains a Table */
+//FIXME this query is declared using Element in the querySet -> change into EObject when the EMF-Facet bug will be corrected 365744
+//FIXME : remove the dependencies on the ModelExplorer
+public class IsTableEFacetContainer extends AbstractEditorContainerQuery implements IJavaModelQuery<EObject, Boolean> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Boolean evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ final Predicate<Setting> p = new Predicate<Setting>() {
+
+ public boolean apply(final Setting arg0) {
+ return arg0.getEObject() instanceof Table && arg0.getEStructuralFeature() == TablePackage.Literals.TABLE__CONTEXT;
+ }
+ };
+ return NavigatorUtils.find(context, p);
+ }
+}

Back to the top