Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorptessier2014-01-22 08:49:13 +0000
committerptessier2014-01-22 08:49:13 +0000
commit1e1a9d7cbce89fa3782945999a9138680eb0d7b0 (patch)
treeff5dbb63b7ee797fb2bb209b73496db9b9eafb09 /deprecated
parenta45cf37f5d48260bafff5d4778b72ac78522e468 (diff)
downloadorg.eclipse.papyrus-1e1a9d7cbce89fa3782945999a9138680eb0d7b0.tar.gz
org.eclipse.papyrus-1e1a9d7cbce89fa3782945999a9138680eb0d7b0.tar.xz
org.eclipse.papyrus-1e1a9d7cbce89fa3782945999a9138680eb0d7b0.zip
386118: [EMF Facet] Papyrus should progressively support EMF Facet 0.2
https://bugs.eclipse.org/bugs/show_bug.cgi?id=386118
Diffstat (limited to 'deprecated')
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/.classpath7
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/.project28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.core.resources.prefs3
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.jdt.core.prefs8
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/META-INF/MANIFEST.MF28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/about.html28
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/build.properties7
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.gifbin0 -> 919 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.pngbin0 -> 1341 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.gifbin0 -> 918 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.pngbin0 -> 1283 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/rename.gifbin0 -> 922 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.gifbin0 -> 983 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.pngbin0 -> 1340 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.gifbin0 -> 982 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.pngbin0 -> 1333 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/icons/table.gifbin0 -> 965 bytes
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/plugin.properties3
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/plugin.xml319
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/Activator.java67
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/AbstractTableExtensionContributionFactory.java61
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CommonColumnHandler.java56
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInPopupContributionItem.java130
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInTableMenuContributionItem.java212
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/HideEmptyColumnsHandler.java50
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/Messages.java34
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/messages.properties3
-rw-r--r--deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/providers/TableTester.java79
28 files changed, 1123 insertions, 0 deletions
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/.classpath b/deprecated/org.eclipse.papyrus.infra.table.menu/.classpath
new file mode 100644
index 00000000000..2d1a4302f04
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/.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/J2SE-1.5"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/.project b/deprecated/org.eclipse.papyrus.infra.table.menu/.project
new file mode 100644
index 00000000000..2db93db7442
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.papyrus.infra.table.menu</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/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.core.resources.prefs b/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 00000000000..f6b3322e995
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,3 @@
+#Fri Nov 04 17:02:25 CET 2011
+eclipse.preferences.version=1
+encoding//src/org/eclipse/papyrus/infra/table/menu/messages/messages.properties=ISO-8859-1
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.jdt.core.prefs b/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..62e64d3aa81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,8 @@
+#Fri Feb 11 11:37:09 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/deprecated/org.eclipse.papyrus.infra.table.menu/META-INF/MANIFEST.MF b/deprecated/org.eclipse.papyrus.infra.table.menu/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..896f3742600
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/META-INF/MANIFEST.MF
@@ -0,0 +1,28 @@
+Manifest-Version: 1.0
+Require-Bundle: org.eclipse.core.expressions,
+ org.eclipse.papyrus.uml.diagram.common;bundle-version="1.0.0",
+ org.eclipse.papyrus.uml.diagram.menu;bundle-version="1.0.0",
+ org.eclipse.emf.facet.infra.common.core;bundle-version="0.1.0",
+ org.eclipse.papyrus.infra.table.common;bundle-version="1.0.0",
+ org.eclipse.emf.facet.widgets.nattable,
+ org.eclipse.emf.facet.widgets.nattable.instance;bundle-version="0.1.0",
+ org.eclipse.emf.facet.widgets.nattable.workbench;bundle-version="0.1.0",
+ org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.5.0",
+ org.eclipse.papyrus.editor;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.core;bundle-version="1.0.0",
+ org.eclipse.ui.ide;bundle-version="3.8.0",
+ org.eclipse.papyrus.infra.core.sasheditor;bundle-version="1.0.0"
+Export-Package: org.eclipse.papyrus.infra.table.menu,
+ org.eclipse.papyrus.infra.table.menu.handler,
+ org.eclipse.papyrus.infra.table.menu.providers
+Bundle-Vendor: %providerName
+Bundle-ActivationPolicy: lazy
+Bundle-Version: 1.0.0.qualifier
+Bundle-Name: %pluginName
+Bundle-Localization: plugin
+Bundle-ManifestVersion: 2
+Bundle-Activator: org.eclipse.papyrus.infra.table.menu.Activator
+Bundle-SymbolicName: org.eclipse.papyrus.infra.table.menu;singleton:=t
+ rue
+Bundle-RequiredExecutionEnvironment: J2SE-1.5
+
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/about.html b/deprecated/org.eclipse.papyrus.infra.table.menu/about.html
new file mode 100644
index 00000000000..82d49bf5f81
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/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/deprecated/org.eclipse.papyrus.infra.table.menu/build.properties b/deprecated/org.eclipse.papyrus.infra.table.menu/build.properties
new file mode 100644
index 00000000000..16e737b65fa
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/build.properties
@@ -0,0 +1,7 @@
+#
+#Mon Sep 12 09:30:19 CEST 2011
+bin.includes=META-INF/,.,plugin.xml,plugin.properties,icons/,about.html
+output..=bin/
+src.includes = about.html
+source..=src/
+bin..=bin/
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.gif
new file mode 100644
index 00000000000..30c569ad03e
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.png b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.png
new file mode 100644
index 00000000000..91e5ec5fa2d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/empty.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.gif
new file mode 100644
index 00000000000..125919fbd84
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.png b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.png
new file mode 100644
index 00000000000..7e2aeeeb7ed
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/not_NA.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/rename.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/rename.gif
new file mode 100644
index 00000000000..e6f786eca9a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/rename.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.gif
new file mode 100644
index 00000000000..4df20a606f6
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.png b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.png
new file mode 100644
index 00000000000..9202230bd24
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.gif
new file mode 100644
index 00000000000..d046cff4062
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.png b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.png
new file mode 100644
index 00000000000..64e9d00387c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/select_column_to_hide_2.png
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/icons/table.gif b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/table.gif
new file mode 100644
index 00000000000..4c9048708b0
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/icons/table.gif
Binary files differ
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.properties b/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.properties
new file mode 100644
index 00000000000..596bb8a7d4d
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.properties
@@ -0,0 +1,3 @@
+#Properties file for org.eclipse.papyrus.infra.table.menu
+providerName = Eclipse Modeling Project
+pluginName = Papyrus Table Menu (Incubation) \ No newline at end of file
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.xml b/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.xml
new file mode 100644
index 00000000000..8ec17253a83
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/plugin.xml
@@ -0,0 +1,319 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <!--extension
+ point="org.eclipse.ui.commands">
+ <command
+ categoryId="org.eclipse.emf.facet.widgets.nattable.command.category"
+ defaultHandler="org.eclipse.papyrus.infra.table.menu.handler.CommonColumnHandler"
+ description="Show only the common columns"
+ id="org.eclipse.emf.facet.widget.nattable.common.columns.command"
+ name="Common Columns Command">
+ <state
+ class="org.eclipse.jface.commands.ToggleState"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
+ </command>
+ <command
+ categoryId="org.eclipse.emf.facet.widgets.nattable.command.category"
+ defaultHandler="org.eclipse.papyrus.infra.table.menu.handler.HideEmptyColumnsHandler"
+ description="This command hides the empty columns"
+ id="org.eclipse.emf.facet.widget.nattable.empty.columns.command"
+ name="Hide Empty Columns Command">
+ <state
+ class="org.eclipse.jface.commands.ToggleState"
+ id="org.eclipse.ui.commands.toggleState">
+ </state>
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ allPopups="false"
+ locationURI="menu:org.eclipse.ui.main.menu?before=navigate">
+ <menu
+ icon="icons/table.gif"
+ id="org.eclipse.papyrus.table.menu"
+ label="&amp;Table"
+ tooltip="The table Menu">
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.loadCustomizationCommand"
+ icon="platform:/plugin/org.eclipse.emf.facet.widgets.nattable.workbench/icons/uiCustom.gif"
+ id="org.eclipse.papyrus.table.menu.load.customization"
+ style="push"
+ tooltip="%load.customization">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.loadFacetCommand"
+ icon="platform:/plugin/org.eclipse.emf.facet.widgets.nattable.workbench/icons/facet.gif"
+ id="org.eclipse.papyrus.table.menu.load.emf.facet"
+ style="push"
+ tooltip="%load.emf.facet">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.hideColumnCommand"
+ icon="icons/select_column_to_hide_2.gif"
+ id="org.eclipse.papyrus.table.menu.hide.empty.column"
+ style="push"
+ tooltip="%select.column.to.hide">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.sortColumnByTypeCommand"
+ icon="platform:/plugin/org.eclipse.emf.facet.widgets.nattable.workbench/icons/sort_links_by_type.gif"
+ id="org.eclipse.papyrus.table.menu.sort.column"
+ style="push"
+ tooltip="%sort.column.by.type">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.sortColumnByNameAToZCommand"
+ icon="platform:/plugin/org.eclipse.emf.facet.widgets.nattable.workbench/icons/sort_columns_by_name_A_to_Z.gif"
+ style="push"
+ tooltip="Sort Column By Name (From A to Z)">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen> //TODO should be externalized
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widgets.nattable.sortColumnByNameZToACommand"
+ icon="platform:/plugin/org.eclipse.emf.facet.widgets.nattable.workbench/icons/sort_columns_by_name_Z_to_A.gif"
+ style="push"
+ tooltip="Sort Column By Name (From Z to A)">
+ <visibleWhen
+ checkEnabled="false">
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ </visibleWhen>
+ </command>
+ <separator
+ name="org.eclipse.papyrus.table.menu.separator"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.emf.facet.widget.nattable.empty.columns.command"
+ icon="icons/empty.gif"
+ id="org.eclipse.papyrus.table.menu.hide.empty.column"
+ label="&amp;Hide the empty columns"
+ style="toggle"
+ tooltip="Hide the empty columns">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor">
+ </instanceof>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widget.nattable.common.columns.command"
+ icon="icons/not_NA.gif"
+ id="org.eclipse.papyrus.table.menu.common.column"
+ label="&amp;Show only the common columns"
+ style="toggle"
+ tooltip="Show only the common columns">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor">
+ </instanceof>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ <visibleWhen>
+ <with
+ variable="activeEditorId">
+ <equals
+ value="org.eclipse.papyrus.infra.core.papyrusEditor">
+ </equals>
+ </with>
+ </visibleWhen>
+ </menu>
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ locationURI="toolbar:org.eclipse.emf.facet.widgets.nattable.workbench.editor.NatTableEditor.toolbar">
+ <separator
+ name="org.eclipse.papyrus.table.menu.separator1"
+ visible="true">
+ </separator>
+ <command
+ commandId="org.eclipse.emf.facet.widget.nattable.empty.columns.command"
+ icon="icons/empty.gif"
+ id="org.eclipse.emf.facet.papyrus.table.toolbar.hide.empty.column"
+ label="&amp;Hide the empty columns"
+ style="toggle"
+ tooltip="Hide the empty columns">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor">
+ </instanceof>
+ </with>
+ <with
+ variable="activePart">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.emf.facet.widgets.nattable.workbench.tablePartTester.isTableEditor"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.emf.facet.widget.nattable.common.columns.command"
+ icon="icons/not_NA.gif"
+ id="org.eclipse.emf.facet.papyrus.table.toolbartab.common.column"
+ label="&amp;Show only the common columns"
+ style="toggle"
+ tooltip="Show only the common columns">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.papyrus.table.menu.providers.TableTester.isTable"
+ value="true">
+ </test>
+ </with>
+ <with
+ variable="activeEditor">
+ <instanceof
+ value="org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor">
+ </instanceof>
+ </with>
+ <with
+ variable="activePart">
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.emf.facet.widgets.nattable.workbench.tablePartTester.isTableEditor"
+ value="true">
+ </test>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ allPopups="true"
+ class="org.eclipse.papyrus.infra.table.menu.handler.CreateNewElementInPopupContributionItem"
+ locationURI="popup:org.eclipse.ui.popup.any">
+ </menuContribution>
+ <menuContribution
+ allPopups="false"
+ class="org.eclipse.papyrus.infra.table.menu.handler.CreateNewElementInTableMenuContributionItem"
+ locationURI="menu:org.eclipse.papyrus.table.menu?before=org.eclipse.papyrus.table.menu.load.customization">
+ </menuContribution>
+ </extension-->
+ <extension
+ point="org.eclipse.core.expressions.propertyTesters">
+ <propertyTester
+ class="org.eclipse.papyrus.infra.table.menu.providers.TableTester"
+ id="org.eclipse.papyrus.table.menu.providers.TableTester"
+ namespace="org.eclipse.papyrus.table.menu.providers.TableTester"
+ properties="isTable"
+ type="org.eclipse.jface.viewers.IStructuredSelection">
+ </propertyTester>
+ </extension>
+
+
+
+
+
+
+
+</plugin>
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/Activator.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/Activator.java
new file mode 100644
index 00000000000..4db2eb8032c
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/Activator.java
@@ -0,0 +1,67 @@
+/*****************************************************************************
+ * 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.menu;
+
+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 ID = "org.eclipse.papyrus.infra.table.menu"; //$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * 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;
+ }
+
+ /*
+ * (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/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/AbstractTableExtensionContributionFactory.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/AbstractTableExtensionContributionFactory.java
new file mode 100644
index 00000000000..cf94a5db334
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/AbstractTableExtensionContributionFactory.java
@@ -0,0 +1,61 @@
+/*****************************************************************************
+ * 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.menu.handler;
+
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.menus.ExtensionContributionFactory;
+import org.eclipse.ui.menus.IContributionRoot;
+import org.eclipse.ui.services.IServiceLocator;
+
+
+public abstract class AbstractTableExtensionContributionFactory extends ExtensionContributionFactory {
+
+ /**
+ * The service locator
+ */
+ protected IServiceLocator serviceLocator;
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
+ this.serviceLocator = serviceLocator;
+ }
+
+ /**
+ *
+ * @return
+ * the {@link INatTableWidgetProvider} or <code>null</code> if not found
+ */
+ protected INatTableWidgetProvider getINatTableWidgetProvider() {
+ INatTableWidgetProvider provider = null;;
+ if(PlatformUI.getWorkbench() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow() != null && PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage() != null) {
+ IWorkbenchPart activePart = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
+ if(activePart != null) {
+ if(activePart instanceof CoreMultiDiagramEditor) {
+ IEditorPart activeEditor = ((CoreMultiDiagramEditor)activePart).getActiveEditor();
+ if(activeEditor instanceof IAdaptable) {
+ provider = (INatTableWidgetProvider)activeEditor.getAdapter(INatTableWidgetProvider.class);
+ }
+ }
+ }
+ }
+ return provider;
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CommonColumnHandler.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CommonColumnHandler.java
new file mode 100644
index 00000000000..d8dc8a0008a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CommonColumnHandler.java
@@ -0,0 +1,56 @@
+/*****************************************************************************
+ * 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.menu.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidget;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * This class provides the handler to show only the common columns or to display all the columns
+ *
+ *
+ *
+ */
+public class CommonColumnHandler extends AbstractHandler implements IHandler {
+
+
+
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+ INatTableWidgetProvider provider = (INatTableWidgetProvider)editor.getAdapter(INatTableWidgetProvider.class);
+ if(provider != null) {
+ INatTableWidget widget = provider.getNatTableWidget();
+ widget.setOnlyShowCommonColumns(!widget.getTableInstance().isOnlyShowCommonColumns());
+ //change the state of the command
+ HandlerUtil.toggleCommandState(event.getCommand());
+ }
+ return null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInPopupContributionItem.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInPopupContributionItem.java
new file mode 100644
index 00000000000..916dfd3ac1a
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInPopupContributionItem.java
@@ -0,0 +1,130 @@
+/*****************************************************************************
+ * 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.menu.handler;
+
+
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidget;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.InstantiationMethod;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.papyrus.infra.table.menu.messages.Messages;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.menus.IContributionRoot;
+import org.eclipse.ui.services.IServiceLocator;
+
+
+/**
+ *
+ * This class create a menu to get the action to create new elements in the table in the popup menu.
+ * This code is adapted from the class org.eclipse.emf.facet.widgets.nattable.workbench.internal.handlers.CreateNewElementContributionItem
+ */
+public class CreateNewElementInPopupContributionItem extends AbstractTableExtensionContributionFactory {
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateNewElementInPopupContributionItem() {
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
+ super.createContributionItems(serviceLocator, additions);
+ final INatTableWidgetProvider provider = getINatTableWidgetProvider();
+ if(provider != null) {
+ final INatTableWidget natTableWidget = provider.getNatTableWidget();
+ MenuManager manager = new MenuManager(Messages.CreateMenuForNewElementInPopupContributionItem_CreateNewElementMenu) {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void fill(Menu parent, int index) {
+ super.fill(parent, index);
+ getMenu().getParentItem().setEnabled(natTableWidget.getInstantionMethodHistory().size() != 0);
+ Image image = Activator.getImage("IMG_OBJ_ADD"); //$NON-NLS-1$
+ getMenu().getParentItem().setImage(image);
+ }
+
+ };
+
+ manager.setVisible(true);
+ IContributionItem item = new ContributionItem() {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void fill(final Menu menu, int index) {
+ for(int i = 0; i < natTableWidget.getInstantionMethodHistory().size(); i++) {
+ final InstantiationMethod meth = natTableWidget.getInstantionMethodHistory().get(i);
+ MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
+ menuItem.setText(i + " " + meth.getName()); //$NON-NLS-1$
+ menuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ for(MenuItem menuItem2 : menu.getItems()) {
+ menuItem2.setSelection(false);
+ }
+ MenuItem localMenuItem = (MenuItem)e.widget;
+ localMenuItem.setSelection(true);
+ natTableWidget.createNewElement(meth);
+ }
+ });
+ }
+ boolean enabled = menu.getItemCount() != 0;
+ menu.setEnabled(enabled);
+ }
+ };
+
+ Menu menu = manager.getMenu();
+ if(menu != null) {
+ menu.setEnabled(false);
+ }
+ manager.add(item);
+ Expression visibleWhen = new Expression() {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ return EvaluationResult.TRUE;
+ }
+ };
+
+ additions.addContributionItem(manager, visibleWhen);
+ }
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInTableMenuContributionItem.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInTableMenuContributionItem.java
new file mode 100644
index 00000000000..39bee33f3a1
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/CreateNewElementInTableMenuContributionItem.java
@@ -0,0 +1,212 @@
+/*****************************************************************************
+ * 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.menu.handler;
+import java.util.List;
+
+import org.eclipse.core.expressions.EvaluationResult;
+import org.eclipse.core.expressions.Expression;
+import org.eclipse.core.expressions.IEvaluationContext;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidget;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.emf.facet.widgets.nattable.tableconfiguration.InstantiationMethod;
+import org.eclipse.jface.action.ContributionItem;
+import org.eclipse.jface.action.IContributionItem;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.papyrus.infra.table.menu.messages.Messages;
+import org.eclipse.papyrus.uml.diagram.common.Activator;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.swt.widgets.MenuItem;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.ISelectionService;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.menus.IContributionRoot;
+import org.eclipse.ui.services.IServiceLocator;
+
+
+/**
+ *
+ * This class create a menu to get the action to create new elements in the table in the popup menu.
+ * This code is adapted from the class org.eclipse.emf.facet.widgets.nattable.workbench.internal.handlers.CreateNewElementContributionItem
+ */
+public class CreateNewElementInTableMenuContributionItem extends AbstractTableExtensionContributionFactory {
+
+ /**
+ * A listener on the selection
+ */
+ private ISelectionListener listener;
+
+ /**
+ *
+ * Constructor.
+ *
+ */
+ public CreateNewElementInTableMenuContributionItem() {
+ this.listener = null;
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void createContributionItems(final IServiceLocator serviceLocator, IContributionRoot additions) {
+ super.createContributionItems(serviceLocator, additions);
+ final MenuManager manager = new MenuManager(Messages.CreateMenuForNewElementInPopupContributionItem_CreateNewElementMenu) {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void fill(Menu parent, int index) {
+ super.fill(parent, index);
+ Image image = Activator.getImage("IMG_OBJ_ADD"); //$NON-NLS-1$
+ getMenu().getParentItem().setImage(image);
+ INatTableWidgetProvider provider = CreateNewElementInTableMenuContributionItem.this.getINatTableWidgetProvider();
+ if(provider != null) {
+ List<InstantiationMethod> methods = provider.getNatTableWidget().getInstantionMethodHistory();
+ getMenu().getParentItem().setEnabled(methods.size() != 0);
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void dispose() {
+ if(CreateNewElementInTableMenuContributionItem.this.listener != null) {
+ ISelectionService selectionService = (ISelectionService)serviceLocator.getService(ISelectionService.class);
+ selectionService.removeSelectionListener(listener);
+ }
+ super.dispose();
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+
+ };
+
+ final IContributionItem item = new ContributionItem() {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public void fill(final Menu menu, int index) {
+ INatTableWidgetProvider provider = getINatTableWidgetProvider();
+ if(provider != null) {
+ final INatTableWidget natTableWidget = provider.getNatTableWidget();
+ for(int i = 0; i < natTableWidget.getInstantionMethodHistory().size(); i++) {
+ final InstantiationMethod meth = natTableWidget.getInstantionMethodHistory().get(i);
+ MenuItem menuItem = new MenuItem(menu, SWT.CHECK);
+ menuItem.setText(i + " " + meth.getName()); //$NON-NLS-1$
+ menuItem.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(final SelectionEvent e) {
+ for(MenuItem menuItem2 : menu.getItems()) {
+ menuItem2.setSelection(false);
+ }
+ MenuItem localMenuItem = (MenuItem)e.widget;
+ localMenuItem.setSelection(true);
+ natTableWidget.createNewElement(meth);
+ }
+ });
+
+
+ }
+ boolean enabled = menu.getItemCount() != 0;
+ menu.setEnabled(enabled);
+ }
+ }
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public boolean isDynamic() {
+ return true;
+ }
+ };
+
+ manager.add(item);
+
+ Expression visibleWhen = new Expression() {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ @Override
+ public EvaluationResult evaluate(IEvaluationContext context) throws CoreException {
+ INatTableWidgetProvider provider = getINatTableWidgetProvider();
+ if(provider != null) {
+ return EvaluationResult.TRUE;
+ }
+ return EvaluationResult.FALSE;
+ }
+
+ };
+
+ additions.addContributionItem(manager, visibleWhen);
+ addSelectionListener(manager);
+ }
+
+ /**
+ * Add a listener to refresh the menu when the selection changes.
+ *
+ * @param manager
+ * the menu manager for the contribution of this class
+ */
+ protected void addSelectionListener(final MenuManager manager) {
+ ISelectionService selectionService = (ISelectionService)this.serviceLocator.getService(ISelectionService.class);
+ this.listener = new ISelectionListener() {
+
+ /**
+ *
+ * {@inheritDoc}
+ */
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ final INatTableWidgetProvider provider = getINatTableWidgetProvider();
+ if(provider != null) {
+ manager.setVisible(true);
+ INatTableWidget widget = provider.getNatTableWidget();
+ if(manager.getMenu() != null && !manager.getMenu().isDisposed()) {
+ manager.getMenu().getParentItem().setEnabled(widget.getInstantionMethodHistory().size() != 0);
+ }
+ } else {
+ manager.setVisible(false);
+ }
+ manager.updateAll(true);
+
+ }
+ };
+ selectionService.addSelectionListener(listener);
+ }
+
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/HideEmptyColumnsHandler.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/HideEmptyColumnsHandler.java
new file mode 100644
index 00000000000..662c29687ac
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/handler/HideEmptyColumnsHandler.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * 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:
+ * Nicolas Guyomar (Mia-Software) - Bug 335020 - Nattable widget should use the Eclipse framework
+ *******************************************************************************/
+package org.eclipse.papyrus.infra.table.menu.handler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidget;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * This class provides the handler to hide or show the empty column
+ *
+ *
+ *
+ */
+public class HideEmptyColumnsHandler extends AbstractHandler {
+
+ /**
+ *
+ * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ *
+ * @param event
+ * @return
+ * @throws ExecutionException
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editor = HandlerUtil.getActiveEditor(event);
+ INatTableWidgetProvider provider = (INatTableWidgetProvider)editor.getAdapter(INatTableWidgetProvider.class);
+ if(provider != null) {
+ INatTableWidget widget = provider.getNatTableWidget();
+ widget.setHideEmptyColumns(!widget.getTableInstance().isHideEmptyColumns());
+ //change the state of the command
+ HandlerUtil.toggleCommandState(event.getCommand());
+ }
+ return null;
+ }
+
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/Messages.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/Messages.java
new file mode 100644
index 00000000000..d6efab40964
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/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.menu.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.table.menu.messages.messages"; //$NON-NLS-1$
+
+ public static String CreateMenuForNewElementInPopupContributionItem_CreateNewElementMenu;
+
+ public static String EditTableHandler_EditDescription_Message;
+
+ public static String EditTableHandler_EditDescription_Title;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/messages.properties b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/messages.properties
new file mode 100644
index 00000000000..6bd6c4265d8
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/messages/messages.properties
@@ -0,0 +1,3 @@
+CreateMenuForNewElementInPopupContributionItem_CreateNewElementMenu=&Create new Element
+EditTableHandler_EditDescription_Message=Enter a new description.
+EditTableHandler_EditDescription_Title=Change the description
diff --git a/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/providers/TableTester.java b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/providers/TableTester.java
new file mode 100644
index 00000000000..bc42f8e2f28
--- /dev/null
+++ b/deprecated/org.eclipse.papyrus.infra.table.menu/src/org/eclipse/papyrus/infra/table/menu/providers/TableTester.java
@@ -0,0 +1,79 @@
+/*****************************************************************************
+ * 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.menu.providers;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.emf.facet.widgets.nattable.INatTableWidgetProvider;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * This tester provides action in order to active handlers
+ *
+ *
+ *
+ */
+public class TableTester extends PropertyTester {
+
+ /**
+ * the properties to tests
+ */
+ 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(Object receiver, String property, Object[] args, Object expectedValue) {
+ if(IS_TABLE.equals(property) && expectedValue instanceof Boolean) {
+ boolean answer = isTable();
+ return new Boolean(answer).equals(expectedValue);
+ }
+ return false;
+ }
+
+ /**
+ * Tests if the current editor is a table
+ *
+ * @return
+ * <code>true</code> if the current editor is a table
+ */
+ protected boolean isTable() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ if (wb != null) {
+ IWorkbenchWindow window = wb.getActiveWorkbenchWindow();
+ if (window != null) {
+ IWorkbenchPage page = window.getActivePage();
+ if (page != null) {
+ IEditorPart editor = page.getActiveEditor();
+ if(editor != null) {
+ Object provider = editor.getAdapter(INatTableWidgetProvider.class);
+ return provider != null;
+ }
+ }
+ }
+ }
+ return false;
+ }
+
+}

Back to the top