From ca86e81cda13a010c9dbb9d177525001e65dcf91 Mon Sep 17 00:00:00 2001
From: vlorenzo
Date: Tue, 15 May 2012 14:37:52 +0000
Subject: Save the new version of the project oep.infra.table.modelexplorer
->the modelexplorer manages the new tables
---
.../.classpath | 7 ++
.../.project | 28 +++++
.../.settings/org.eclipse.core.resources.prefs | 3 +
.../.settings/org.eclipse.jdt.core.prefs | 8 ++
.../META-INF/MANIFEST.MF | 30 +++++
.../about.html | 28 +++++
.../build.properties | 12 ++
.../documentation.pdoc | 4 +
.../plugin.properties | 3 +
.../plugin.xml | 138 +++++++++++++++++++++
.../resources/PapyrusTableCustomization.uiCustom | 33 +++++
.../resources/PapyrusTableFacet.facetSet | 20 +++
.../PapyrusTableFacetCustomization.uiCustom | 31 +++++
.../PapyrusTableInstanceCustomization.uiCustom | 31 +++++
.../resources/PapyrusTableQuery.querySet | 40 ++++++
.../infra/table/modelexplorer/Activator.java | 121 ++++++++++++++++++
.../AbstractPapyrusTableModelExplorerHandler.java | 59 +++++++++
.../AbstractTableModelExplorerHandler.java | 66 ++++++++++
.../handlers/DeletePapyrusTableHandler.java | 72 +++++++++++
.../modelexplorer/handlers/DeleteTableHandler.java | 75 +++++++++++
.../handlers/DuplicatePapyrusTableHandler.java | 82 ++++++++++++
.../handlers/DuplicateTableHandler.java | 84 +++++++++++++
.../handlers/RenamePapyrusTableHandler.java | 84 +++++++++++++
.../modelexplorer/handlers/RenameTableHandler.java | 86 +++++++++++++
.../table/modelexplorer/messages/Messages.java | 34 +++++
.../modelexplorer/messages/messages.properties | 3 +
.../providers/PapyrusTablePropertyTester.java | 87 +++++++++++++
.../providers/TablePropertyTester.java | 87 +++++++++++++
.../queries/GetContainedPapyrusTables.java | 83 +++++++++++++
.../modelexplorer/queries/GetContainedTables.java | 87 +++++++++++++
.../modelexplorer/queries/GetPapyrusTableIcon.java | 32 +++++
.../modelexplorer/queries/GetPapyrusTableName.java | 32 +++++
.../table/modelexplorer/queries/GetTableIcon.java | 38 ++++++
.../table/modelexplorer/queries/GetTableName.java | 35 ++++++
.../queries/IsPapyrusTableContainer.java | 48 +++++++
.../modelexplorer/queries/IsTableContainer.java | 48 +++++++
36 files changed, 1759 insertions(+)
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.classpath
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.project
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.core.resources.prefs
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.jdt.core.prefs
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/META-INF/MANIFEST.MF
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/about.html
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/build.properties
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/documentation.pdoc
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.properties
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.xml
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableCustomization.uiCustom
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacet.facetSet
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacetCustomization.uiCustom
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableInstanceCustomization.uiCustom
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableQuery.querySet
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/Activator.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractPapyrusTableModelExplorerHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeletePapyrusTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeleteTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicatePapyrusTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicateTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenamePapyrusTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenameTableHandler.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/Messages.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/messages.properties
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/PapyrusTablePropertyTester.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/TablePropertyTester.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedPapyrusTables.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableIcon.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableName.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableName.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsPapyrusTableContainer.java
create mode 100644 sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsTableContainer.java
(limited to 'sandbox')
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.classpath b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.classpath
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.project b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.project
new file mode 100644
index 00000000000..db2442f94ec
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.project
@@ -0,0 +1,28 @@
+
+
+ org.eclipse.papyrus.infra.table.modelexplorer
+
+
+
+
+
+ org.eclipse.jdt.core.javabuilder
+
+
+
+
+ org.eclipse.pde.ManifestBuilder
+
+
+
+
+ org.eclipse.pde.SchemaBuilder
+
+
+
+
+
+ org.eclipse.pde.PluginNature
+ org.eclipse.jdt.core.javanature
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.core.resources.prefs b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..c82fec208fa
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 04 17:02:59 CET 2011
+eclipse.preferences.version=1
+encoding//src/org/eclipse/papyrus/infra/table/modelexplorer/messages/messages.properties=ISO-8859-1
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.jdt.core.prefs b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..eef3e01dddb
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Feb 18 14:48:14 CET 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
+org.eclipse.jdt.core.compiler.compliance=1.5
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.5
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/META-INF/MANIFEST.MF b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..acfac37c220
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/META-INF/MANIFEST.MF
@@ -0,0 +1,30 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.emf.facet.infra.browser.uicore;bundle-version="0.1.0",
+ org.eclipse.emf.facet.infra.browser.custom.core,
+ org.eclipse.papyrus.views.modelexplorer;bundle-version="0.9.0",
+ org.eclipse.core.expressions,
+ org.eclipse.emf.facet.widgets.nattable.instance;bundle-version="0.1.0",
+ org.eclipse.papyrus.infra.table.instance;bundle-version="0.9.0",
+ org.eclipse.uml2.uml,
+ org.eclipse.emf.facet.infra.query.core,
+ org.eclipse.core.runtime;bundle-version="3.7.0",
+ org.eclipse.emf.transaction;bundle-version="1.4.0",
+ org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
+ org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
+ com.google.guava;bundle-version="1.0.0",
+ org.eclipse.gmf.runtime.emf.type.core;bundle-version="1.4.0",
+ org.eclipse.papyrus.infra.table.metamodel;bundle-version="0.9.0"
+Export-Package: org.eclipse.papyrus.infra.table.modelexplorer,
+ org.eclipse.papyrus.infra.table.modelexplorer.handlers,
+ org.eclipse.papyrus.infra.table.modelexplorer.messages,
+ org.eclipse.papyrus.infra.table.modelexplorer.providers
+Bundle-Vendor: %pluginProvider
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 0.9.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.table.modelexplorer.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.modelexplorer;singleton:=true
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/about.html b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/about.html
@@ -0,0 +1,28 @@
+
+
+
+
+About
+
+
+About This Content
+
+June 5, 2007
+License
+
+The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise
+indicated below, the Content is provided to you under the terms and conditions of the
+Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available
+at http://www.eclipse.org/legal/epl-v10.html.
+For purposes of the EPL, "Program" will mean the Content.
+
+If you did not receive this Content directly from the Eclipse Foundation, the Content is
+being redistributed by another party ("Redistributor") 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 http://www.eclipse.org.
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/build.properties b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/build.properties
new file mode 100644
index 00000000000..8f5a4c96094
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/build.properties
@@ -0,0 +1,12 @@
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ resources/,\
+ plugin.properties,\
+ about.html,\
+ bin/,\
+ documentation.pdoc
+output.. = bin/
+src.includes = about.html
+source.. = src/
+bin.. = bin/
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/documentation.pdoc b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/documentation.pdoc
new file mode 100644
index 00000000000..e7a7257ea7e
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/documentation.pdoc
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.properties b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.properties
new file mode 100644
index 00000000000..218c6567b7f
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.infra.table.modelexplorer
+pluginProvider = Eclipse Modeling Project
+pluginName = Table Customization For Model Explorer (Incubation)
\ No newline at end of file
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.xml b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.xml
new file mode 100644
index 00000000000..8e1f221427d
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/plugin.xml
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableCustomization.uiCustom b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableCustomization.uiCustom
new file mode 100644
index 00000000000..8aff7b461f9
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableCustomization.uiCustom
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacet.facetSet b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacet.facetSet
new file mode 100644
index 00000000000..ed6c48cb863
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacet.facetSet
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacetCustomization.uiCustom b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacetCustomization.uiCustom
new file mode 100644
index 00000000000..9547b428a38
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableFacetCustomization.uiCustom
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableInstanceCustomization.uiCustom b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableInstanceCustomization.uiCustom
new file mode 100644
index 00000000000..6f012ca143a
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableInstanceCustomization.uiCustom
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableQuery.querySet b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableQuery.querySet
new file mode 100644
index 00000000000..d5a9e5db1d0
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/resources/PapyrusTableQuery.querySet
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/Activator.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/Activator.java
new file mode 100644
index 00000000000..e7433ff7ace
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/Activator.java
@@ -0,0 +1,121 @@
+/*****************************************************************************
+ * 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.table.modelexplorer;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.edit.EMFEditPlugin;
+import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
+import org.eclipse.emf.facet.infra.browser.custom.core.CustomizationsCatalog;
+import org.eclipse.emf.facet.infra.browser.uicore.CustomizationManager;
+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.table.modelexplorer"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /** the customization manager */
+ private CustomizationManager fCustomizationManager;
+
+ 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);
+ EMFEditPlugin.getComposedAdapterFactoryDescriptorRegistry();
+ }
+
+ /*
+ * (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;
+ }
+
+ /**
+ *
+ * @return the customization manager in charge to adapt element in modisco
+ */
+ public CustomizationManager getCustomizationManager() {
+ if(this.fCustomizationManager == null) {
+ this.fCustomizationManager = new CustomizationManager();
+ init(this.fCustomizationManager);
+ }
+ return this.fCustomizationManager;
+ }
+
+ /**
+ *
+ * @param customizationManager
+ * the customization manager to init
+ */
+ private void init(final CustomizationManager customizationManager) {
+ // the appearance can be customized here:
+
+ customizationManager.setShowDerivedLinks(true);
+
+ try {
+
+ // load customizations defined as default through the customization
+ // extension
+ List registryDefaultCustomizations = CustomizationsCatalog.getInstance().getRegistryDefaultCustomizations();
+ for(MetamodelView metamodelView : registryDefaultCustomizations) {
+ customizationManager.registerCustomization(metamodelView);
+ }
+ customizationManager.loadCustomizations();
+
+ } catch (Throwable e) {
+ Activator.getDefault().getLog().log(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Error initializing customizations", e)); //$NON-NLS-1$
+ }
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractPapyrusTableModelExplorerHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractPapyrusTableModelExplorerHandler.java
new file mode 100644
index 00000000000..78cc7b4b285
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractPapyrusTableModelExplorerHandler.java
@@ -0,0 +1,59 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler;
+import org.eclipse.ui.PlatformUI;
+
+public abstract class AbstractPapyrusTableModelExplorerHandler extends AbstractCommandHandler {
+
+ /**
+ * Returns the list of selected tables
+ *
+ * @return the list of selected tables
+ */
+ protected List getSelectedTables() {
+ List tables = new ArrayList();
+ ISelection selection = null;
+
+ // Get current selection
+ selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ // Get first element if the selection is an IStructuredSelection
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ Iterator> iter = structuredSelection.iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable) {
+ EObject table = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(table instanceof PapyrusTable) {
+ tables.add((PapyrusTable)table);
+ }
+ }
+ }
+ }
+ return tables;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java
new file mode 100644
index 00000000000..60684acc9ac
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/AbstractTableModelExplorerHandler.java
@@ -0,0 +1,66 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ *
+ */
+@Deprecated
+public abstract class AbstractTableModelExplorerHandler extends AbstractCommandHandler {
+
+ /**
+ * Returns the list of selected tables
+ *
+ * @return
+ * the list of selected tables
+ */
+ protected List getSelectedTables() {
+ List tables = new ArrayList();
+ ISelection selection = null;
+
+ // Get current selection
+ selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
+
+ // Get first element if the selection is an IStructuredSelection
+ if(selection instanceof IStructuredSelection) {
+ IStructuredSelection structuredSelection = (IStructuredSelection)selection;
+ Iterator> iter = structuredSelection.iterator();
+ while(iter.hasNext()) {
+ Object current = iter.next();
+ if(current instanceof IAdaptable){
+ EObject table = (EObject)((IAdaptable)current).getAdapter(EObject.class);
+ if(table instanceof PapyrusTableInstance){
+ tables.add((PapyrusTableInstance)table);
+ }
+ }
+ }
+ }
+ return tables;
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeletePapyrusTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeletePapyrusTableHandler.java
new file mode 100644
index 00000000000..b066f3a0963
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeletePapyrusTableHandler.java
@@ -0,0 +1,72 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+
+/**
+ * Handler for the delete Table action
+ *
+ *
+ *
+ */
+public class DeletePapyrusTableHandler extends AbstractPapyrusTableModelExplorerHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageMngr = getPageManager();
+
+ List tables = getSelectedTables();
+
+ if(editingDomain != null && pageMngr != null && !tables.isEmpty()) {
+ CompoundCommand command = new CompoundCommand();
+
+ for(final PapyrusTable table : tables) {
+ Command sashRemoveComd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ if(pageMngr.isOpen(table)) {
+ pageMngr.closePage(table);
+ }
+ }
+ };
+ // the destroy element command is a good way to destroy the cross reference
+ command.append(sashRemoveComd);
+ command.append(new GMFtoEMFCommandWrapper(new DestroyElementPapyrusCommand(new DestroyElementRequest(table, false))));
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeleteTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeleteTableHandler.java
new file mode 100644
index 00000000000..a644200de5a
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DeleteTableHandler.java
@@ -0,0 +1,75 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.papyrus.commands.DestroyElementPapyrusCommand;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+
+
+/**
+ * Handler for the delete Table action
+ *
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ *
+ */
+@Deprecated
+public class DeleteTableHandler extends AbstractTableModelExplorerHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageMngr = getPageManager();
+
+ List tables = getSelectedTables();
+
+ if(editingDomain != null && pageMngr != null && !tables.isEmpty()) {
+ CompoundCommand command = new CompoundCommand();
+
+ for(final PapyrusTableInstance table : tables) {
+ Command sashRemoveComd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ if(pageMngr.isOpen(table)) {
+ pageMngr.closePage(table);
+ }
+ }
+ };
+ // the destroy element command is a good way to destroy the cross reference
+ command.append(sashRemoveComd);
+ command.append(new GMFtoEMFCommandWrapper(new DestroyElementPapyrusCommand(new DestroyElementRequest(table, false))));
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicatePapyrusTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicatePapyrusTableHandler.java
new file mode 100644
index 00000000000..080c2892e89
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicatePapyrusTableHandler.java
@@ -0,0 +1,82 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.modelexplorer.messages.Messages;
+
+/**
+ * This handler provides the duplicate action for the tables
+ *
+ *
+ *
+ */
+public class DuplicatePapyrusTableHandler extends AbstractPapyrusTableModelExplorerHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageManager = getPageManager();
+ List tables = getSelectedTables();
+
+ if(editingDomain != null && pageManager != null && !tables.isEmpty()) {
+ CompoundCommand command = new CompoundCommand();
+ for(PapyrusTable table : tables) {
+
+ // Clone the current table
+ final PapyrusTable newTable = EcoreUtil.copy(table);
+
+ // Give a new name
+ newTable.setName(Messages.DuplicateTableHandler_CopyOf + newTable.getName());
+
+ //we duplicate parameters and rename the new table!
+
+
+ Command addGmfDiagramCmd = new AddCommand(editingDomain, table.eResource().getContents(), newTable);
+ // EMFCommandOperation operation = new EMFCommandOperation(editingDomain, addGmfDiagramCmd);
+
+ Command sashOpenCmd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ pageManager.openPage(newTable);
+ }
+ };
+ //
+ // // TODO : synchronize with Cedric
+ // command.append(operation.getCommand());
+ command.append(addGmfDiagramCmd);
+ command.append(sashOpenCmd);
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicateTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicateTableHandler.java
new file mode 100644
index 00000000000..4ceb296af8a
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/DuplicateTableHandler.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.CompoundCommand;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.edit.command.AddCommand;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.modelexplorer.messages.Messages;
+
+/**
+ * This handler provides the duplicate action for the tables
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ *
+ *
+ */
+@Deprecated
+public class DuplicateTableHandler extends AbstractTableModelExplorerHandler {
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ final IPageMngr pageManager = getPageManager();
+ List tables = getSelectedTables();
+
+ if(editingDomain != null && pageManager != null && !tables.isEmpty()) {
+ CompoundCommand command = new CompoundCommand();
+ for(PapyrusTableInstance table : tables) {
+
+ // Clone the current table
+ final PapyrusTableInstance newTable = EcoreUtil.copy(table);
+
+ // Give a new name
+ newTable.setName(Messages.DuplicateTableHandler_CopyOf + newTable.getName());
+
+ //we duplicate parameters and rename the new table!
+
+
+ Command addGmfDiagramCmd = new AddCommand(editingDomain, table.eResource().getContents(), newTable);
+ // EMFCommandOperation operation = new EMFCommandOperation(editingDomain, addGmfDiagramCmd);
+
+ Command sashOpenCmd = new RecordingCommand(editingDomain) {
+
+ @Override
+ protected void doExecute() {
+ pageManager.openPage(newTable);
+ }
+ };
+ //
+ // // TODO : synchronize with Cedric
+ // command.append(operation.getCommand());
+ command.append(addGmfDiagramCmd);
+ command.append(sashOpenCmd);
+ }
+ return command.isEmpty() ? UnexecutableCommand.INSTANCE : command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenamePapyrusTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenamePapyrusTableHandler.java
new file mode 100644
index 00000000000..e6a34876f79
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenamePapyrusTableHandler.java
@@ -0,0 +1,84 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.modelexplorer.messages.Messages;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This handler provides the method to rename a Table
+ *
+ *
+ *
+ */
+public class RenamePapyrusTableHandler extends AbstractPapyrusTableModelExplorerHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ List tables = getSelectedTables();
+ if(editingDomain != null && tables.size() == 1) {
+
+ final PapyrusTable table = tables.get(0);
+ final String currentName = table.getName();
+
+ if(currentName != null) {
+
+ AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameTableCommand", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableHandler_RenameAnExistingTable_Title, Messages.RenameTableHandler_NewNameMessage, currentName, null);
+ if(dialog.open() == Window.OK) {
+ final String name = dialog.getValue();
+ if(name != null && name.length() > 0) {
+ table.setName(name);
+ }
+ return CommandResult.newOKCommandResult();
+ } else {
+ return CommandResult.newCancelledCommandResult();
+ }
+ }
+ };
+ return new GMFtoEMFCommandWrapper(cmd);
+ }
+
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+
+
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenameTableHandler.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenameTableHandler.java
new file mode 100644
index 00000000000..8c8756d4c69
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/handlers/RenameTableHandler.java
@@ -0,0 +1,86 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.handlers;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.emf.common.command.Command;
+import org.eclipse.emf.common.command.UnexecutableCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.gmf.runtime.common.core.command.CommandResult;
+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand;
+import org.eclipse.jface.dialogs.InputDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.modelexplorer.messages.Messages;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This handler provides the method to rename a Table
+ *
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ *
+ */
+@Deprecated
+public class RenameTableHandler extends AbstractTableModelExplorerHandler {
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.views.modelexplorer.handler.AbstractCommandHandler#getCommand()
+ *
+ * @return
+ */
+ @Override
+ protected Command getCommand() {
+ TransactionalEditingDomain editingDomain = getEditingDomain();
+ List tables = getSelectedTables();
+ if(editingDomain != null && tables.size() == 1) {
+
+ final PapyrusTableInstance table = tables.get(0);
+ final String currentName = table.getName();
+
+ if(currentName != null) {
+
+ AbstractTransactionalCommand cmd = new AbstractTransactionalCommand(editingDomain, "RenameTableCommand", null) { //$NON-NLS-1$
+
+ @Override
+ protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) {
+ InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), Messages.RenameTableHandler_RenameAnExistingTable_Title, Messages.RenameTableHandler_NewNameMessage, currentName, null);
+ if(dialog.open() == Window.OK) {
+ final String name = dialog.getValue();
+ if(name != null && name.length() > 0) {
+ table.setName(name);
+ }
+ return CommandResult.newOKCommandResult();
+ } else {
+ return CommandResult.newCancelledCommandResult();
+ }
+ }
+ };
+ return new GMFtoEMFCommandWrapper(cmd);
+ }
+
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+
+
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/Messages.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/Messages.java
new file mode 100644
index 00000000000..7fe4c99c629
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/Messages.java
@@ -0,0 +1,34 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.table.modelexplorer.messages.messages"; //$NON-NLS-1$
+
+ public static String DuplicateTableHandler_CopyOf;
+
+ public static String RenameTableHandler_NewNameMessage;
+
+ public static String RenameTableHandler_RenameAnExistingTable_Title;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/messages.properties b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/messages.properties
new file mode 100644
index 00000000000..c5ff485ad7f
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/messages/messages.properties
@@ -0,0 +1,3 @@
+DuplicateTableHandler_CopyOf=Copy of
+RenameTableHandler_NewNameMessage=New name
+RenameTableHandler_RenameAnExistingTable_Title=Rename an existing table
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/PapyrusTablePropertyTester.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/PapyrusTablePropertyTester.java
new file mode 100644
index 00000000000..be635976ccd
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/PapyrusTablePropertyTester.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.providers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+
+/**
+ * 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 PapyrusTablePropertyTester extends PropertyTester {
+
+
+ /** property to test if the selected elements is a table */
+ public static final String IS_TABLE = "isTable"; //$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_TABLE.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean answer = isTable((IStructuredSelection)receiver);
+ return new Boolean(answer).equals(expectedValue);
+ }
+ return false;
+ }
+
+
+
+ /**
+ * Tests the selection in order to know if it contains only {@link Table}
+ *
+ * @param selection
+ * @return
+ * true
if the selection is composed by {@link Table}
+ */
+ private boolean isTable(final 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 table = NavigatorUtils.getElement(next, EObject.class);
+ if(!(table instanceof PapyrusTable)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/TablePropertyTester.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/TablePropertyTester.java
new file mode 100644
index 00000000000..e4119f15e0d
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/providers/TablePropertyTester.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.providers;
+
+import java.util.Iterator;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+
+/**
+ * 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.
+ *
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ * FIXME : i think this class is not yet used
+ */
+@Deprecated
+public class TablePropertyTester extends PropertyTester {
+
+
+ /** property to test if the selected elements is a table */
+ public static final String IS_TABLE = "isTable"; //$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_TABLE.equals(property) && receiver instanceof IStructuredSelection) {
+ boolean answer = isTable((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
+ * true
if the selection is composed by {@link TableInstance}
+ */
+ private boolean isTable(final 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 table = NavigatorUtils.getElement(next, EObject.class);
+ if(!(table instanceof PapyrusTableInstance)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedPapyrusTables.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedPapyrusTables.java
new file mode 100644
index 00000000000..7acd17935fd
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedPapyrusTables.java
@@ -0,0 +1,83 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.queries;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+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.nattable.instance.tableinstance.TableInstance;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage;
+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.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrustablePackage;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+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 GetContainedPapyrusTables extends AbstractEditorContainerQuery implements IJavaModelQuery> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Predicate p = new Predicate() {
+
+ public boolean apply(EStructuralFeature.Setting setting) {
+ return setting.getEObject() instanceof Table && setting.getEStructuralFeature() == TablePackage.Literals.TABLE__CONTEXT;
+ }
+ };
+ Function f = new Function() {
+
+ public PapyrusTable apply(EStructuralFeature.Setting setting) {
+ Collection references = PapyrusEcoreUtils.getUsages(setting.getEObject());
+ Predicate p2 = new Predicate() {
+
+ public boolean apply(Setting setting) {
+ return setting.getEObject() instanceof PapyrusTable && PapyrustablePackage.Literals.PAPYRUS_TABLE__TABLE == setting.getEStructuralFeature();
+ }
+ };
+ Iterator iterator = Iterables.filter(references, p2).iterator();
+ if(iterator.hasNext()) {
+ return (PapyrusTable)iterator.next().getEObject();
+ }
+ return null;
+ }
+
+ };
+
+ Iterable transform = Iterables.transform(Iterables.filter(PapyrusEcoreUtils.getUsages(context), p), f);
+ transform = Iterables.filter(transform, new Predicate() {
+
+ public boolean apply(PapyrusTable table) {
+ return table != null;
+ }
+ });
+ return Sets.newHashSet(transform);
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java
new file mode 100644
index 00000000000..b9f5d7ed764
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetContainedTables.java
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.queries;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.eclipse.emf.ecore.EObject;
+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.nattable.instance.tableinstance.TableInstance;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage;
+import org.eclipse.papyrus.infra.core.utils.PapyrusEcoreUtils;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrustableinstancePackage;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+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
+ *
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ * */
+@Deprecated
+//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> {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Collection evaluate(final EObject context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Predicate p = new Predicate() {
+
+ public boolean apply(EStructuralFeature.Setting setting) {
+ return setting.getEObject() instanceof TableInstance && setting.getEStructuralFeature() == TableinstancePackage.Literals.TABLE_INSTANCE__CONTEXT;
+ }
+ };
+ Function f = new Function() {
+
+ public PapyrusTableInstance apply(EStructuralFeature.Setting setting) {
+ Collection references = PapyrusEcoreUtils.getUsages(setting.getEObject());
+ Predicate p2 = new Predicate() {
+
+ public boolean apply(Setting setting) {
+ return setting.getEObject() instanceof PapyrusTableInstance && PapyrustableinstancePackage.Literals.PAPYRUS_TABLE_INSTANCE__TABLE == setting.getEStructuralFeature();
+ }
+ };
+ Iterator iterator = Iterables.filter(references, p2).iterator();
+ if(iterator.hasNext()) {
+ return (PapyrusTableInstance)iterator.next().getEObject();
+ }
+ return null;
+ }
+
+ };
+
+ Iterable transform = Iterables.transform(Iterables.filter(PapyrusEcoreUtils.getUsages(context), p), f);
+ transform = Iterables.filter(transform, new Predicate() {
+
+ public boolean apply(PapyrusTableInstance table) {
+ return table != null;
+ }
+ });
+ return Sets.newHashSet(transform);
+ }
+
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableIcon.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableIcon.java
new file mode 100644
index 00000000000..acace028157
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableIcon.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.core.editorsfactory.IPageIconsRegistryExtended;
+import org.eclipse.papyrus.infra.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
+
+/** Return the path to the icon of the corresponding table */
+public class GetPapyrusTableIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String evaluate(final PapyrusTable context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableName.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableName.java
new file mode 100644
index 00000000000..e4c92a9ea0d
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetPapyrusTableName.java
@@ -0,0 +1,32 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.metamodel.papyrustable.PapyrusTable;
+
+
+/** Return the name for the table */
+public class GetPapyrusTableName implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String evaluate(final PapyrusTable context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return context.getName();
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
new file mode 100644
index 00000000000..93778825bd8
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableIcon.java
@@ -0,0 +1,38 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.core.editorsfactory.IPageIconsRegistryExtended;
+import org.eclipse.papyrus.infra.table.instance.papyrustableinstance.PapyrusTableInstance;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractGetEditorIconQuery;
+
+/**
+ * Return the path to the icon of the corresponding table
+ *
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ */
+@Deprecated
+public class GetTableIcon extends AbstractGetEditorIconQuery implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String evaluate(final PapyrusTableInstance context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return "/" + ((IPageIconsRegistryExtended)getEditorRegistry()).getEditorURLIcon(context); //$NON-NLS-1$
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableName.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableName.java
new file mode 100644
index 00000000000..1ce8bc03c2b
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/GetTableName.java
@@ -0,0 +1,35 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.instance.papyrustableinstance.PapyrusTableInstance;
+
+/** Return the name for the table
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ */
+@Deprecated
+public class GetTableName implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public String evaluate(final PapyrusTableInstance context, final ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ return context.getName();
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsPapyrusTableContainer.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsPapyrusTableContainer.java
new file mode 100644
index 00000000000..3009ea20f15
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsPapyrusTableContainer.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.nattable.instance.tableinstance.TableInstance;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage;
+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.table.metamodel.papyrustable.PapyrusTable;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+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
+public class IsPapyrusTableContainer extends AbstractEditorContainerQuery implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Boolean evaluate(EObject context, ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Predicate p = new Predicate() {
+
+ public boolean apply(Setting arg0) {
+ return arg0.getEObject() instanceof Table && arg0.getEStructuralFeature() == TablePackage.Literals.TABLE__CONTEXT;
+ }
+ };
+ boolean answer = NavigatorUtils.find(context, p);
+ return NavigatorUtils.find(context, p);
+ }
+}
diff --git a/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsTableContainer.java b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsTableContainer.java
new file mode 100644
index 00000000000..75a8ca58c20
--- /dev/null
+++ b/sandbox/org.eclipse.papyrus.infra.table.modelexplorer/src/org/eclipse/papyrus/infra/table/modelexplorer/queries/IsTableContainer.java
@@ -0,0 +1,48 @@
+/*****************************************************************************
+ * 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.table.modelexplorer.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.nattable.instance.tableinstance.TableInstance;
+import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableinstancePackage;
+import org.eclipse.papyrus.views.modelexplorer.NavigatorUtils;
+import org.eclipse.papyrus.views.modelexplorer.queries.AbstractEditorContainerQuery;
+
+import com.google.common.base.Predicate;
+
+/** Returns true if the element contains a Table
+ * @deprecated Papyrus changes its table metamodel. This class is used to managed the old table metamodel.
+ * for details see : 371616: [Table Editor] Tabular Editor should be rewritten to use the new EMF-Facet Metamodels
+ */
+@Deprecated
+//FIXME this query is declared using Element in the querySet -> change into EObject when the EMF-Facet bug will be corrected 365744
+public class IsTableContainer extends AbstractEditorContainerQuery implements IJavaModelQuery {
+
+ /**
+ * {@inheritDoc}
+ */
+ public Boolean evaluate(EObject context, ParameterValueList parameterValues) throws ModelQueryExecutionException {
+ Predicate p = new Predicate() {
+
+ public boolean apply(Setting arg0) {
+ return arg0.getEObject() instanceof TableInstance && arg0.getEStructuralFeature() == TableinstancePackage.Literals.TABLE_INSTANCE__CONTEXT;
+ }
+ };
+ return NavigatorUtils.find(context, p);
+ }
+}
--
cgit v1.2.3