Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-04-26 15:17:25 +0000
committervlorenzo2013-04-26 15:17:25 +0000
commit85b8a933113c4a62fd7543a58cb49f9c6a27d2f6 (patch)
tree8f25e1023cc1ef018c75517d478ccaa93ae1c2a5 /sandbox
parentab28dc22ac8601774405b6ab3257fa7e75a13b0d (diff)
downloadorg.eclipse.papyrus-85b8a933113c4a62fd7543a58cb49f9c6a27d2f6.tar.gz
org.eclipse.papyrus-85b8a933113c4a62fd7543a58cb49f9c6a27d2f6.tar.xz
org.eclipse.papyrus-85b8a933113c4a62fd7543a58cb49f9c6a27d2f6.zip
Share the project oep.infra.nattable.views.config
Diffstat (limited to 'sandbox')
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.classpath7
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.project28
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF34
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/OSGI-INF/l10n/bundle.properties3
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/about.html28
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/build.properties10
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.gifbin0 -> 138 bytes
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.pngbin0 -> 194 bytes
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/plugin.xml56
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration19
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/Activator.java55
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/celleditor/ModelViewsCellEditorConfiguration.java75
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java135
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorFeatureAxisManager.java43
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java270
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/Messages.java19
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/messages.properties2
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/provider/ModelViewsHeaderLabelProvider.java125
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/TableViewCreationTester.java37
-rw-r--r--sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java103
20 files changed, 1049 insertions, 0 deletions
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.classpath b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.project b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.project
new file mode 100644
index 00000000000..aa7f080ea05
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.nattable.views.config</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>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..9714ef3ace9
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/META-INF/MANIFEST.MF
@@ -0,0 +1,34 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: %Bundle-Name
+Bundle-SymbolicName: org.eclipse.papyrus.infra.nattable.views.config;singleton:=true
+Bundle-Version: 0.10.0.qualifier
+Bundle-Activator: org.eclipse.papyrus.infra.nattable.views.config.Activator
+Bundle-Vendor: %Bundle-Vendor
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.nattable.model;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.core.log;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.nattable;bundle-version="0.10.0",
+ org.eclipse.nebula.widgets.nattable.core,
+ org.eclipse.papyrus.infra.emf.nattable;bundle-version="0.10.0",
+ org.eclipse.emf.edit,
+ org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.0",
+ org.eclipse.emf.transaction,
+ org.eclipse.gmf.runtime.emf.type.core,
+ org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.services.labelprovider;bundle-version="0.10.0",
+ org.eclipse.papyrus.infra.widgets;bundle-version="0.10.0",
+ org.eclipse.papyrus.uml.tools;bundle-version="0.10.0"
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Export-Package: org.eclipse.papyrus.infra.nattable.views.config,
+ org.eclipse.papyrus.infra.nattable.views.config.celleditor,
+ org.eclipse.papyrus.infra.nattable.views.config.manager.axis,
+ org.eclipse.papyrus.infra.nattable.views.config.manager.cell,
+ org.eclipse.papyrus.infra.nattable.views.config.messages,
+ org.eclipse.papyrus.infra.nattable.views.config.provider,
+ org.eclipse.papyrus.infra.nattable.views.config.utils
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/OSGI-INF/l10n/bundle.properties b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/OSGI-INF/l10n/bundle.properties
new file mode 100644
index 00000000000..928ca7a4737
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/OSGI-INF/l10n/bundle.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.infra.nattable.views.editor.config
+Bundle-Vendor = Eclipse Modeling Project
+Bundle-Name = Papyrus Views Config (Incubation) \ No newline at end of file
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/about.html b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/about.html
@@ -0,0 +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>June 5, 2007</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>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/build.properties b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/build.properties
new file mode 100644
index 00000000000..5d4530103a8
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/build.properties
@@ -0,0 +1,10 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ OSGI-INF/,\
+ about.html,\
+ icons/,\
+ resources/,\
+ plugin.xml
+src.includes = about.html
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.gif b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.gif
new file mode 100644
index 00000000000..20416f02be0
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.gif
Binary files differ
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png
new file mode 100644
index 00000000000..3eb64f31e36
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png
Binary files differ
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/plugin.xml b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/plugin.xml
new file mode 100644
index 00000000000..e6fc4ce7a79
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/plugin.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.axismanager">
+ <axisManager
+ id="org.eclipse.papyrus.infra.nattable.pagelist.contents.axis.manager"
+ manager="org.eclipse.papyrus.infra.nattable.views.config.manager.axis.EditorContextSynchronizerAxisManager">
+ </axisManager>
+ <axisManager
+ id="org.eclipse.papyrus.infra.nattable.page.view.feature.axis.manager"
+ manager="org.eclipse.papyrus.infra.nattable.views.config.manager.axis.EditorFeatureAxisManager">
+ </axisManager>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.cellmanager">
+ <cellManager
+ id="org.eclipse.papyrus.infra.nattable.page.editor.modelviewscellmanager"
+ manager="org.eclipse.papyrus.infra.nattable.views.config.manager.cell.ModelViewsCellManager"
+ order="50">
+ </cellManager>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.services.labelprovider.labelProvider">
+ <labelProvider
+ priority="1000"
+ provider="org.eclipse.papyrus.infra.nattable.views.config.provider.ModelViewsHeaderLabelProvider">
+ <labelProviderContext
+ context="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider">
+ </labelProviderContext>
+ <labelProviderContext
+ context="org.eclipse.papyrus.infra.nattable.header.labelprovider">
+ </labelProviderContext>
+ </labelProvider>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.celleditor.configuration">
+ <configuration
+ class="org.eclipse.papyrus.infra.nattable.views.config.celleditor.ModelViewsCellEditorConfiguration"
+ order="50">
+ </configuration>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.tester">
+ <tester
+ class="org.eclipse.papyrus.infra.nattable.views.config.utils.TableViewCreationTester"
+ id="org.eclipse.papyrus.infra.nattable.views.config.creation.tester">
+ </tester>
+ </extension>
+ <extension
+ point="org.eclipse.papyrus.infra.nattable.configuration">
+ <configuration
+ file="resources/viewpage.nattableconfiguration">
+ </configuration>
+ </extension>
+</plugin>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration
new file mode 100644
index 00000000000..96196d7537c
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/resources/viewpage.nattableconfiguration
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<nattableconfiguration:TableConfiguration xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:nattableaxis="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxis" xmlns:nattableaxisconfiguration="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisconfiguration" xmlns:nattableaxisprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattableaxisprovider" xmlns:nattableconfiguration="http://www.eclipse.org/papyrus/nattable/model/nattableconfiguration" xmlns:nattablelabelprovider="http://www.eclipse.org/papyrus/nattable/model/table/nattablecontentprovider" xmlns:nattabletester="http://www.eclipse.org/papyrus/nattable/model/table/nattabletester" description="This table lists all pages (editors) which have the same context than the table of views (or children of the context)" name="TableOfViews" type="PapyrusTableViewsEditor" iconPath="platform:/plugin/org.eclipse.papyrus.infra.nattable.views.config/icons/nattablepageeditor.png" defaultRowAxisProvider="//@rowAxisProviders.0" defaultColumnAxisProvider="//@columnAxisProviders.0">
+ <creationTester xsi:type="nattabletester:JavaTableTester" tester="org.eclipse.papyrus.infra.nattable.views.config.creation.tester"/>
+ <rowHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration" indexStyle="NUMERIC">
+ <ownedLabelConfiguration xsi:type="nattablelabelprovider:ObjectLabelProviderConfiguration"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.pagelist.contents.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.labelprovider" headerLabelConfiguration="//@rowHeaderAxisConfiguration/@ownedLabelConfiguration.0"/>
+ </rowHeaderAxisConfiguration>
+ <columnHeaderAxisConfiguration xsi:type="nattableaxisconfiguration:TableHeaderAxisConfiguration">
+ <ownedLabelConfiguration xsi:type="nattablelabelprovider:FeatureLabelProviderConfiguration"/>
+ <axisManagers xsi:type="nattableaxisconfiguration:AxisManagerRepresentation" axisManagerId="org.eclipse.papyrus.infra.nattable.page.view.feature.axis.manager" labelProviderContext="org.eclipse.papyrus.infra.nattable.header.feature.labelprovider"/>
+ </columnHeaderAxisConfiguration>
+ <columnAxisProviders xsi:type="nattableaxisprovider:SlaveObjectAxisProvider" description="Provides the features of the views" name="Papyrus Views feature provider">
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/name"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/context"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/isOpen"/>
+ <axis xsi:type="nattableaxis:FeatureIdAxis" manager="//@columnHeaderAxisConfiguration/@axisManagers.0" element="nattable_editor_pages:/type"/>
+ </columnAxisProviders>
+ <rowAxisProviders xsi:type="nattableaxisprovider:MasterObjectAxisProvider"/>
+</nattableconfiguration:TableConfiguration>
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/Activator.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/Activator.java
new file mode 100644
index 00000000000..95ecdb7434d
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/Activator.java
@@ -0,0 +1,55 @@
+package org.eclipse.papyrus.infra.nattable.views.config;
+
+import org.eclipse.papyrus.infra.core.log.LogHelper;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.papyrus.infra.nattable.views.editor.config"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ public static LogHelper log;
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/celleditor/ModelViewsCellEditorConfiguration.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/celleditor/ModelViewsCellEditorConfiguration.java
new file mode 100644
index 00000000000..db111a71c4d
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/celleditor/ModelViewsCellEditorConfiguration.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.celleditor;
+
+import org.eclipse.papyrus.infra.emf.nattable.celleditor.config.EStructuralFeatureEditorConfig;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
+
+
+/**
+ * The cell editor configuration for the table model views
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ModelViewsCellEditorConfiguration extends EStructuralFeatureEditorConfig {
+
+ public static final String CONFIG_EDITOR_ID = "MODEL_VIEW_CELL_EDITOR_ID";
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.EStructuralFeatureEditorConfig#getFeatureIdentifier(org.eclipse.papyrus.infra.nattable.model.nattable.Table,
+ * java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ @Override
+ protected int getFeatureIdentifier(Table table, Object axisElement) {
+ if(((String)axisElement).equals(Utils.NATTABLE_EDITOR_PAGE_ID + Utils.VIEW_CONTEXT)) {
+ return SINGLE_EMF_REFERENCE;
+ } else if(((String)axisElement).equals(Utils.NATTABLE_EDITOR_PAGE_ID + Utils.VIEW_IS_OPEN)) {
+ return SINGLE_BOOLEAN;
+ } else if(((String)axisElement).equals(Utils.NATTABLE_EDITOR_PAGE_ID + Utils.VIEW_NAME)) {
+ return SINGLE_STRING;
+ } else if(((String)axisElement).equals(Utils.NATTABLE_EDITOR_PAGE_ID + Utils.VIEW_EDITOR_TYPE)) {
+ return SINGLE_STRING;
+ }
+ return UNKNOWN_TYPE;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.EStructuralFeatureEditorConfig#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table,
+ * java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ @Override
+ public boolean handles(Table table, Object axisElement) {
+ if(table.getTableConfiguration().getType().equals(Utils.TABLE_VIEW_TYPE_VALUE)) {
+ return axisElement instanceof String && ((String)axisElement).startsWith(Utils.NATTABLE_EDITOR_PAGE_ID);
+ }
+ return false;
+ }
+
+ @Override
+ public String getEditorId() {
+ return CONFIG_EDITOR_ID;
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
new file mode 100644
index 00000000000..5b3a4f6c2dd
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorContextSynchronizerAxisManager.java
@@ -0,0 +1,135 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.manager.axis;
+
+import java.util.List;
+
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.core.sashwindows.di.DiPackage;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager;
+import org.eclipse.papyrus.infra.nattable.manager.cell.CellManagerFactory;
+import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager;
+import org.eclipse.papyrus.infra.nattable.manager.table.NattableModelManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisconfiguration.AxisManagerRepresentation;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider;
+import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class EditorContextSynchronizerAxisManager extends AbstractSynchronizedOnFeatureAxisManager {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#init(org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager,
+ * java.lang.String, org.eclipse.papyrus.infra.nattable.model.nattable.Table,
+ * org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxisprovider.AbstractAxisProvider, boolean)
+ *
+ * @param manager
+ * @param rep
+ * @param table
+ * @param provider
+ * @param mustRefreshOnAxisChanges
+ */
+ @Override
+ public void init(final INattableModelManager manager, final AxisManagerRepresentation rep, final Table table, final AbstractAxisProvider provider, boolean mustRefreshOnAxisChanges) {
+ super.init(manager, rep, table, provider, mustRefreshOnAxisChanges);
+ }
+
+
+ @Override
+ protected void addContextFeatureValueListener() {
+ this.featureListener = new AdapterImpl() {
+
+ @Override
+ public void notifyChanged(Notification msg) {
+ if(msg.getFeature() == DiPackage.eINSTANCE.getPageList_AvailablePage()) {
+ updateAxisContents();
+ ((NattableModelManager)getTableManager()).refreshNattable();
+ }
+ }
+ };
+ final PageList pageList = Utils.getPageList(getTable());
+ pageList.eAdapters().add(this.featureListener);
+ }
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractSynchronizedOnFeatureAxisManager#verifyCoupleContextFeature()
+ *
+ */
+ @Override
+ protected void verifyCoupleContextFeature() {
+ //nothing to do
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#updateAxisContents()
+ *
+ */
+ @Override
+ public synchronized void updateAxisContents() {
+ final PageList pageList = Utils.getPageList(getTable());
+ final List<Object> elements = getTableManager().getElementsList(getRepresentedContentProvider());
+ elements.clear();//FIXME risk of blinking with the glazed list!
+ for(final PageRef ref : pageList.getAvailablePage()) {
+ final Object page = ref.getPageIdentifier();
+ if(mustBeDisplayedInThisTable(page)) {
+ elements.add(page);
+ }
+ }
+ }
+
+
+ /**
+ *
+ * @param page
+ * a page
+ * @return
+ * <code>true</code> if the page is referenced by a child of the context of the table or by the context itself
+ */
+ private boolean mustBeDisplayedInThisTable(final Object page) {
+ final Object value = CellManagerFactory.INSTANCE.getCrossValue(page, Utils.NATTABLE_EDITOR_PAGE_ID + Utils.VIEW_CONTEXT);
+ if(value instanceof EObject) {
+ final EObject tableContext = getTable().getContext();
+ EObject container = (EObject)value;
+ while(container != null) {
+ if(container == tableContext) {
+ return true;
+ }
+ container = container.eContainer();
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager#dispose()
+ *
+ */
+ @Override
+ public void dispose() {
+ final PageList pageList = Utils.getPageList(getTable());
+ pageList.eAdapters().remove(this.featureListener);
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorFeatureAxisManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorFeatureAxisManager.java
new file mode 100644
index 00000000000..26800ed0ffd
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/axis/EditorFeatureAxisManager.java
@@ -0,0 +1,43 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.manager.axis;
+
+import java.util.List;
+
+import org.eclipse.papyrus.infra.nattable.manager.axis.AbstractAxisManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IAxis;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattableaxis.IdAxis;
+import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
+
+/**
+ * The feature axis content provider for the ModelViews table
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class EditorFeatureAxisManager extends AbstractAxisManager {
+
+ @Override
+ public synchronized void updateAxisContents() {
+ final List<Object> elements = getTableManager().getElementsList(getRepresentedContentProvider());
+ for(final IAxis current : getRepresentedContentProvider().getAxis()) {
+ if(current instanceof IdAxis) {
+ final String id = (String)current.getElement();
+ if(id.startsWith(Utils.NATTABLE_EDITOR_PAGE_ID) && !elements.contains(id)) {
+ elements.add(id);
+ }
+ }
+ }
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
new file mode 100644
index 00000000000..77843954d3e
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/manager/cell/ModelViewsCellManager.java
@@ -0,0 +1,270 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.manager.cell;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.AbstractEditCommandRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.nattable.manager.cell.AbstractCellManager;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.views.config.Activator;
+import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
+import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
+import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
+
+/**
+ * The Cell manager for the ModelViews table
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ModelViewsCellManager extends AbstractCellManager {
+
+ /**
+ * the name of the feature which references the context of a diagram
+ */
+ private static final String DIAGRAM_CONTEXT_FEATURE_NAME = "element"; //$NON-NLS-1$
+
+ /**
+ * the name of the feature which references the EMF-Facet table in the PapyrusTableInstance
+ */
+ private static final String PAPYRUS_TABLE_INSTANCE__TABLE_INSTANCE2_FEATURE_NAME = "table"; //$NON-NLS-1$
+
+ /**
+ *
+ * @param obj1
+ * @param obj2
+ * @return
+ */
+ protected List<Object> organizeObject(final Object obj1, final Object obj2) {
+ final List<Object> objects = new ArrayList<Object>();
+ if(obj1 instanceof String && ((String)obj1).startsWith(Utils.NATTABLE_EDITOR_PAGE_ID)) {
+ objects.add(obj2);
+ objects.add(obj1);
+ } else if(obj2 instanceof String && ((String)obj2).startsWith(Utils.NATTABLE_EDITOR_PAGE_ID)) {
+ objects.add(obj1);
+ objects.add(obj2);
+ }
+ if(objects.size() == 2) {
+ final Object first = objects.get(0);
+ if(first instanceof EObject) {
+ final IPageManager mngr = Utils.getIPagneManager((EObject)first);
+ if(mngr != null && !mngr.allPages().contains(first)) {
+ return Collections.emptyList();
+ }
+ }
+ }
+
+ return objects;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#handles(java.lang.Object, java.lang.Object)
+ *
+ * @param obj1
+ * @param obj2
+ * @return
+ */
+ public boolean handles(Object obj1, Object obj2) {
+ return organizeObject(obj1, obj2).size() == 2;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#handlersAxisElement(java.lang.Object)
+ *
+ * @param obj
+ * @return
+ */
+ public boolean handlersAxisElement(Object obj) {
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getValue(java.lang.Object, java.lang.Object)
+ *
+ * @param obj1
+ * @param obj2
+ * @return
+ */
+ public Object getValue(Object obj1, Object obj2) {
+ final List<Object> objects = organizeObject(obj1, obj2);
+ final String featureName = ((String)objects.get(1)).replace(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
+ final Object editor = objects.get(0);
+ if(Utils.VIEW_NAME.equals(featureName)) {
+ return getEditorName(editor);
+ }
+ if(Utils.VIEW_CONTEXT.equals(featureName)) {
+ return getEditorContext(editor);
+ }
+ if(Utils.VIEW_IS_OPEN.equals(featureName)) {
+ return getEditorIsOpen(editor);
+ }
+ if(Utils.VIEW_EDITOR_TYPE.equals(featureName)) {
+ return getEditorType(editor);
+ }
+ return NOT_AVALAIBLE;
+ }
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#isCellEditable(java.lang.Object, java.lang.Object)
+ *
+ * @param obj1
+ * @param obj2
+ * @return
+ * <code>true</code> excepted if the edited feature is isOpen
+ */
+ public boolean isCellEditable(Object obj1, Object obj2) {
+ final List<Object> objects = organizeObject(obj1, obj2);
+ final String featureName = ((String)objects.get(1)).replace(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
+ return featureName.equals(Utils.VIEW_NAME);
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.manager.cell.ICellManager#getSetValueCommand(org.eclipse.emf.edit.domain.EditingDomain,
+ * java.lang.Object, java.lang.Object, java.lang.Object)
+ *
+ * @param domain
+ * @param obj1
+ * @param obj2
+ * @param newValue
+ * @return
+ */
+ public Command getSetValueCommand(EditingDomain domain, Object obj1, Object obj2, Object newValue) {
+ final List<Object> objects = organizeObject(obj1, obj2);
+ if(objects.get(0) instanceof EObject) {
+ final EObject editor = (EObject)objects.get(0);
+ final String featureName = ((String)objects.get(1)).replace(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
+ if(Utils.VIEW_NAME.equals(featureName)) {
+ EStructuralFeature feature = editor.eClass().getEStructuralFeature(Utils.VIEW_NAME);
+ final AbstractEditCommandRequest request = new SetRequest((TransactionalEditingDomain)domain, editor, feature, newValue);
+ final IElementEditService provider = ElementEditServiceUtils.getCommandProvider(editor);
+ return new GMFtoEMFCommandWrapper(provider.getEditCommand(request));
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the type of the editor
+ */
+ protected Object getEditorType(final Object editor) {
+ if(editor instanceof EObject) {
+ if(editor instanceof Table) {
+ return ((Table)editor).getTableConfiguration().getType();
+ } else {
+ EStructuralFeature feature = ((EObject)editor).eClass().getEStructuralFeature(Utils.VIEW_EDITOR_TYPE);
+ if(feature != null) {
+ return ((EObject)editor).eGet(feature);
+ }
+ }
+ }
+ return NOT_AVALAIBLE;
+ }
+
+ /**
+ *
+ * @param editor
+ * the editor
+ * @return
+ * <code>true</code> if the current editor is open
+ */
+ protected Object getEditorIsOpen(final Object editor) {
+ if(editor instanceof EObject) {
+ IPageManager mngr = null;
+ try {
+ mngr = ServiceUtilsForResource.getInstance().getIPageManager(((EObject)editor).eResource());
+ return mngr.isOpen(editor);
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ }
+
+ return NOT_AVALAIBLE;
+ }
+
+ /**
+ *
+ * @param editor
+ * an editor
+ * @return
+ * the name of the editor
+ */
+ protected Object getEditorName(final Object editor) {
+ if(editor instanceof EObject) {
+ if(editor instanceof EObject) {
+ final EObject eobject = (EObject)editor;
+ EStructuralFeature feature = eobject.eClass().getEStructuralFeature(Utils.VIEW_NAME);
+ if(feature != null) {
+ return eobject.eGet(feature);
+ }
+ }
+ }
+ return NOT_AVALAIBLE;
+ }
+
+ /**
+ *
+ * @param editor
+ * the editor
+ * @return
+ * the context of this editor
+ */
+ protected Object getEditorContext(final Object editor) {
+ if(editor instanceof EObject) {
+ EObject eobject = (EObject)editor;
+ EStructuralFeature feature = eobject.eClass().getEStructuralFeature(Utils.VIEW_CONTEXT);
+ if(feature == null) {//it is maybe a diagram
+ //workaround for the diagram
+ feature = eobject.eClass().getEStructuralFeature(DIAGRAM_CONTEXT_FEATURE_NAME);
+ }
+ if(feature != null) {
+ return eobject.eGet(feature);
+ }
+ //its maybe an old table
+ EStructuralFeature tmp = eobject.eClass().getEStructuralFeature(PAPYRUS_TABLE_INSTANCE__TABLE_INSTANCE2_FEATURE_NAME);
+ if(tmp != null) {
+ final EObject tableinstance2 = (EObject)eobject.eGet(tmp);
+ if(tableinstance2 != null) {
+ feature = tableinstance2.eClass().getEStructuralFeature(Utils.VIEW_CONTEXT);
+ return tableinstance2.eGet(feature);
+ }
+
+ }
+ }
+ return NOT_AVALAIBLE;
+ }
+
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/Messages.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/Messages.java
new file mode 100644
index 00000000000..22fed7d91a3
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/Messages.java
@@ -0,0 +1,19 @@
+package org.eclipse.papyrus.infra.nattable.views.config.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.nattable.views.config.messages.messages"; //$NON-NLS-1$
+
+ public static String TableViewCreationTester_TheTableViewCanBeCreated;
+
+ public static String TableViewCreationTester_TheTableViewCantBeCreated;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/messages.properties b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/messages.properties
new file mode 100644
index 00000000000..d2e3e095d46
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/messages/messages.properties
@@ -0,0 +1,2 @@
+TableViewCreationTester_TheTableViewCanBeCreated=The table of view can be created
+TableViewCreationTester_TheTableViewCantBeCreated=The table of view can't be created, the context is not an element of the model
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/provider/ModelViewsHeaderLabelProvider.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/provider/ModelViewsHeaderLabelProvider.java
new file mode 100644
index 00000000000..e7d3d5163d5
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/provider/ModelViewsHeaderLabelProvider.java
@@ -0,0 +1,125 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.provider;
+
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.papyrus.infra.emf.nattable.provider.EMFFeatureHeaderLabelProvider;
+import org.eclipse.papyrus.infra.emf.nattable.registry.EStructuralFeatureImageRegistry;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.FeatureLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ILabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.nattablelabelprovider.ObjectLabelProviderConfiguration;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.nattable.utils.ILabelProviderContextElement;
+import org.eclipse.papyrus.infra.nattable.utils.LabelProviderCellContextElement;
+import org.eclipse.papyrus.infra.nattable.views.config.utils.Utils;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * The label provider used for ModelView header
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class ModelViewsHeaderLabelProvider extends EMFFeatureHeaderLabelProvider {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFFeatureHeaderLabelProvider#accept(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public boolean accept(final Object element) {
+ if(element instanceof ILabelProviderContextElement) {
+ final Object object = ((ILabelProviderContextElement)element).getObject();
+ final String id = AxisUtils.getPropertyId(object);
+ if(id != null) {
+ return id.startsWith(Utils.NATTABLE_EDITOR_PAGE_ID);
+ }
+ }
+ return false;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFFeatureHeaderLabelProvider#getText(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public String getText(final Object element) {
+ final Object object = ((ILabelProviderContextElement)element).getObject();
+ final IConfigRegistry configRegistry = ((ILabelProviderContextElement)element).getConfigRegistry();
+ final String id = AxisUtils.getPropertyId(object);
+ final String name = id.replaceFirst(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
+ Object type = null;
+ boolean isDerived = false;
+ int lowerBounds = 1;
+ int upperBounds = 1;
+ if(Utils.VIEW_NAME.equals(name)) {
+ lowerBounds = 0;
+ type = EcorePackage.eINSTANCE.getEString();
+ } else if(Utils.VIEW_IS_OPEN.equals(name)) {
+ isDerived = true;
+ type = EcorePackage.eINSTANCE.getEBoolean();
+ } else if(Utils.VIEW_CONTEXT.equals(name)) {
+ isDerived = true;
+ type = EcorePackage.eINSTANCE.getEObject();
+ } else if(Utils.VIEW_EDITOR_TYPE.equals(name)) {
+ type = EcorePackage.eINSTANCE.getEString();
+ }
+ ILabelProviderConfiguration conf = null;
+ if(element instanceof LabelProviderCellContextElement) {
+ conf = getLabelConfiguration((LabelProviderCellContextElement)element);
+ }
+ if(conf instanceof ObjectLabelProviderConfiguration && !((ObjectLabelProviderConfiguration)conf).isDisplayLabel()) {
+ return "";
+ }
+ if(conf instanceof FeatureLabelProviderConfiguration) {
+ return getText((FeatureLabelProviderConfiguration)conf, configRegistry, name, type, isDerived, lowerBounds, upperBounds);
+ } else {
+ return super.getText(element);
+ }
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.provider.EMFFeatureHeaderLabelProvider#getImage(java.lang.Object)
+ *
+ * @param element
+ * @return
+ */
+ @Override
+ public Image getImage(final Object element) {
+ ILabelProviderConfiguration conf = null;
+ if(element instanceof LabelProviderCellContextElement) {
+ conf = getLabelConfiguration((LabelProviderCellContextElement)element);
+ }
+ if(conf instanceof ObjectLabelProviderConfiguration && !((ObjectLabelProviderConfiguration)conf).isDisplayIcon()) {
+ return null;
+ }
+ final Object object = ((ILabelProviderContextElement)element).getObject();
+ final String id = AxisUtils.getPropertyId(object);
+ final String columnName = id.replaceFirst(Utils.NATTABLE_EDITOR_PAGE_ID, ""); //$NON-NLS-1$
+ if(Utils.VIEW_NAME.equals(columnName) || Utils.VIEW_IS_OPEN.equals(columnName) || Utils.VIEW_EDITOR_TYPE.equals(columnName)) {
+ return EStructuralFeatureImageRegistry.getAttributeIcon();
+ } else if(Utils.VIEW_CONTEXT.equals(columnName)) {
+ return EStructuralFeatureImageRegistry.getLinkIcon();
+ }
+ return null;
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/TableViewCreationTester.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/TableViewCreationTester.java
new file mode 100644
index 00000000000..978d96adfb0
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/TableViewCreationTester.java
@@ -0,0 +1,37 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.utils;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.papyrus.infra.nattable.tester.ITableTester;
+import org.eclipse.papyrus.infra.nattable.views.config.Activator;
+import org.eclipse.papyrus.infra.nattable.views.config.messages.Messages;
+import org.eclipse.papyrus.uml.tools.model.UmlModel;
+
+
+public class TableViewCreationTester implements ITableTester {
+
+ @Override
+ public IStatus isAllowed(Object context) {
+ if(context instanceof EObject) {
+ final EObject current = (EObject)context;
+ if(current.eResource() != null && current.eResource().getURI().fileExtension().equals(UmlModel.UML_FILE_EXTENSION)) {//FIXME remove the uml dependency
+ return new Status(IStatus.OK, Activator.PLUGIN_ID, Messages.TableViewCreationTester_TheTableViewCanBeCreated);
+ }
+ }
+ return new Status(IStatus.ERROR, Activator.PLUGIN_ID, Messages.TableViewCreationTester_TheTableViewCantBeCreated);
+ }
+}
diff --git a/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java
new file mode 100644
index 00000000000..a0edf952196
--- /dev/null
+++ b/sandbox/TableV3/org.eclipse.papyrus.infra.nattable.views.config/src/org/eclipse/papyrus/infra/nattable/views/config/utils/Utils.java
@@ -0,0 +1,103 @@
+/*****************************************************************************
+ * Copyright (c) 2013 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.nattable.views.config.utils;
+
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.papyrus.infra.core.resource.ModelSet;
+import org.eclipse.papyrus.infra.core.resource.sasheditor.DiModel;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
+import org.eclipse.papyrus.infra.core.sashwindows.di.PageList;
+import org.eclipse.papyrus.infra.core.sashwindows.di.SashWindowsMngr;
+import org.eclipse.papyrus.infra.core.sashwindows.di.util.DiUtils;
+import org.eclipse.papyrus.infra.core.services.ServiceException;
+import org.eclipse.papyrus.infra.emf.utils.ServiceUtilsForResource;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.views.config.Activator;
+
+/**
+ *
+ * @author Vincent Lorenzo
+ *
+ */
+public class Utils {
+
+ private Utils() {
+ //to prevent instanciation
+ }
+
+ /**
+ * the prefix used for the editor
+ */
+ public static final String NATTABLE_EDITOR_PAGE_ID = "nattable_editor_pages:/"; //$NON-NLS-1$
+
+ /**
+ * the name column
+ */
+ public static final String VIEW_NAME = "name"; //$NON-NLS-1$
+
+ /**
+ * the context column
+ */
+ public static final String VIEW_CONTEXT = "context"; //$NON-NLS-1$
+
+ /**
+ * the isOpen column
+ */
+ public static final String VIEW_IS_OPEN = "isOpen"; //$NON-NLS-1$
+
+ /**
+ * the type column
+ */
+ public static final String VIEW_EDITOR_TYPE = "type"; //$NON-NLS-1$
+
+ /**
+ * the type of the table views
+ */
+ public static final String TABLE_VIEW_TYPE_VALUE = "PapyrusTableViewsEditor";
+
+ /**
+ *
+ * @return
+ * the page list used for this model
+ */
+ public static final PageList getPageList(final Table table) {
+ final Resource resource = table.eResource();
+ final ModelSet modelSet = (ModelSet)resource.getResourceSet();
+ final Resource diResource = modelSet.getAssociatedResource(resource, DiModel.DI_FILE_EXTENSION, false);
+ final SashWindowsMngr windowMngr = DiUtils.lookupSashWindowsMngr(diResource);
+ final PageList pageList = windowMngr.getPageList();
+ assert pageList != null;
+ return pageList;
+ }
+
+ /**
+ *
+ * @param eobject
+ * an eobject
+ * @return
+ * the IPageMngr found thanks to this eobject or <code>null</code> if not found
+ */
+ public static final IPageManager getIPagneManager(final EObject eobject) {
+ IPageManager mngr = null;
+ try {
+ mngr = ServiceUtilsForResource.getInstance().getIPageManager(eobject.eResource());
+ } catch (ServiceException e) {
+ Activator.log.error(e);
+ }
+ return mngr;
+ }
+
+
+}

Back to the top