summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLaurent Wouters2014-04-04 10:18:44 (EDT)
committerLaurent Wouters2014-04-04 10:18:44 (EDT)
commit92ba18865c43d19b5388964e50cc5b1af10a3f10 (patch)
tree0347ccfc40f715cf2871755d80524f42882951e8
parentf93b63ee7072c2fac4ca4894f665fb706bec8d2a (diff)
downloadorg.eclipse.papyrus-92ba18865c43d19b5388964e50cc5b1af10a3f10.zip
org.eclipse.papyrus-92ba18865c43d19b5388964e50cc5b1af10a3f10.tar.gz
org.eclipse.papyrus-92ba18865c43d19b5388964e50cc5b1af10a3f10.tar.bz2
[clean] Retiring org.eclipse.papyrus.infra.table.efacet.commonlast/org.eclipse.papyrus.infra.table.efacet.common
Signed-off-by: Laurent Wouters <laurent.wouters@cea.fr>
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.classpath7
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.project28
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/META-INF/MANIFEST.MF45
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/build.properties6
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/down.gifbin541 -> 0 bytes
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.gifbin965 -> 0 bytes
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.pngbin1347 -> 0 bytes
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/up.gifbin542 -> 0 bytes
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/plugin.xml146
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/Activator.java70
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractPapyrusNestedEditor.java407
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractSynchronizedTableEditor.java110
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractTableEditor.java506
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/EditorNameInitializer.java126
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/AbstractTableEditorFactory.java197
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusCommandFactory.java303
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusTableEfacetCommandFactory.java120
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractCreateTableEditorHandler.java356
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractMoveRowHandler.java144
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/DownRowHandler.java43
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/UpRowHandler.java43
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/input/PapyrusTableEditorInput.java77
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java111
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/FillingListener.java371
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/MoveTableLineListener.java91
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/EMFFacetTableModelResource.java126
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/PapyrusTableModelResource.java126
-rw-r--r--deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/tester/TablePropertyTester.java46
29 files changed, 0 insertions, 3612 deletions
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.classpath b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.classpath
deleted file mode 100644
index 55b6205..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.classpath
+++ /dev/null
@@ -1,7 +0,0 @@
-<?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 excluding="org/eclipse/papyrus/infra/table/efacet/common/modelresource/EMFFacetTableModelResource.java|org/eclipse/papyrus/infra/table/efacet/common/copy/CustomizationUtils.java|org/eclipse/papyrus/infra/table/efacet/common/copy/TableInstanceUtils.java|org/eclipse/papyrus/infra/table/efacet/common/listener/TableFillingModeListener.java" kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.project b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.project
deleted file mode 100644
index 1c89b79..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.project
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.papyrus.infra.table.efacet.common</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/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.settings/org.eclipse.jdt.core.prefs b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.settings/org.eclipse.jdt.core.prefs
deleted file mode 100644
index 44217f8..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/.settings/org.eclipse.jdt.core.prefs
+++ /dev/null
@@ -1,7 +0,0 @@
-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/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/META-INF/MANIFEST.MF b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/META-INF/MANIFEST.MF
deleted file mode 100644
index bbff1b3..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/META-INF/MANIFEST.MF
+++ /dev/null
@@ -1,45 +0,0 @@
-Manifest-Version: 1.0
-Require-Bundle: org.eclipse.ui,
- org.eclipse.core.runtime,
- org.eclipse.emf.edit,
- org.eclipse.emf.transaction,
- org.eclipse.papyrus.infra.core;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.core.log;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.table.efacet.metamodel;bundle-version="0.10.1",
- org.eclipse.emf.facet.widgets.table.ui,
- org.eclipse.emf.workspace,
- org.eclipse.core.databinding,
- org.eclipse.emf.facet.widgets.nattable,
- org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1",
- org.eclipse.emf.facet.widgets.nattable.instance,
- org.eclipse.papyrus.infra.table.efacet.papyrustableconfiguration.metamodel;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.table.efacet.metamodel.edit;bundle-version="0.10.1",
- org.eclipse.gmf.runtime.emf.commands.core,
- org.eclipse.gmf.runtime.diagram.ui;bundle-version="1.6.0",
- net.sourceforge.nattable.core;bundle-version="2.1.0",
- org.eclipse.core.expressions,
- org.eclipse.papyrus.infra.services.edit;bundle-version="0.10.1",
- org.eclipse.emf.facet.widgets.celleditors.editor;bundle-version="0.2.0",
- org.eclipse.emf.facet.widgets.celleditors.ecore;bundle-version="0.2.0",
- org.eclipse.emf.facet.efacet.core,
- org.eclipse.emf.facet.util.core,
- org.eclipse.papyrus.infra.core.sasheditor;bundle-version="0.10.1",
- org.eclipse.ui.ide;bundle-version="3.8.0",
- org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1",
- org.eclipse.papyrus.infra.core.sasheditor.di;bundle-version="0.10.1",
- org.eclipse.emf.edit.ui;bundle-version="2.8.0"
-Export-Package: org.eclipse.papyrus.infra.table.efacet.common.editor,
- org.eclipse.papyrus.infra.table.efacet.common.factory,
- org.eclipse.papyrus.infra.table.efacet.common.handlers,
- org.eclipse.papyrus.infra.table.efacet.common.listener
-Bundle-Vendor: Eclipse Modeling Project
-Bundle-ActivationPolicy: lazy
-Bundle-Version: 0.10.1.qualifier
-Bundle-Name: Common Plugin for the efacet table editor (Incubation)
-Bundle-ManifestVersion: 2
-Bundle-Activator: org.eclipse.papyrus.infra.table.efacet.common.Activa
- tor
-Bundle-SymbolicName: org.eclipse.papyrus.infra.table.efacet.common;sin
- gleton:=true
-Bundle-RequiredExecutionEnvironment: J2SE-1.5
-
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/build.properties b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/build.properties
deleted file mode 100644
index 259d16d..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/build.properties
+++ /dev/null
@@ -1,6 +0,0 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- build.properties
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/down.gif b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/down.gif
deleted file mode 100644
index 47b3672..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/down.gif
+++ /dev/null
Binary files differ
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.gif b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.gif
deleted file mode 100644
index 4c90487..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.gif
+++ /dev/null
Binary files differ
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.png b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.png
deleted file mode 100644
index 2a97952..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/table.png
+++ /dev/null
Binary files differ
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/up.gif b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/up.gif
deleted file mode 100644
index 2dd3d81..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/icons/up.gif
+++ /dev/null
Binary files differ
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/plugin.xml b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/plugin.xml
deleted file mode 100644
index 467a5c5..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/plugin.xml
+++ /dev/null
@@ -1,146 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.papyrus.infra.core.model">
- <model
- classname="org.eclipse.papyrus.infra.table.efacet.common.modelresource.PapyrusTableModelResource"
- description="Model Resource for Papyrus Table EFacet ">
- </model>
- </extension>
-<extension id="papyrus.table.menuspapyrus.table.menu" name="Papyrus Table Menus" point="org.eclipse.ui.menus">
- <menuContribution allPopups="false" locationURI="popup:org.eclipse.papyrus.views.modelexplorer.modelexplorer.popup?after=org.eclipse.papyrus.views.modelexplorer.popupmenu.creatediagram">
- <menu icon="icons/table.gif" id="org.eclipse.papyrus.views.modelexplorer.popupmenu.table.efacet.creation" label="New EFacet Table" mnemonic="&amp;T" tooltip="The table menu">
- </menu>
- </menuContribution>
- <menuContribution allPopups="false" locationURI="menu:org.eclipse.papyrus.ui.menu?after=org.eclipse.papyrus.uml.diagram.ui.menu.diagrams">
- <menu icon="icons/table.gif" id="org.eclipse.papyrus.ui.menu.efacet.table.creation" label="EFacet Tables" mnemonic="&amp;T" tooltip="The table menu">
- </menu>
- </menuContribution>
- <menuContribution locationURI="toolbar:org.eclipse.ui.main.toolbar?endof=org.eclipse.papyrus.uml.diagram.ui.toolbar">
- <toolbar id="org.eclipse.papyrus.toolbar.table.efacet.creation" label="Papyrus EFacet Table Toolbar">
- </toolbar>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.commands">
- <command
- categoryId="org.eclipse.emf.facet.widgets.table.command.category"
- description="Move the line up"
- id="org.eclipse.papyrus.infra.table.efacet.common.command.moveuprow"
- name="Move Line Up">
- </command>
- <command
- categoryId="org.eclipse.emf.facet.widgets.table.command.category"
- description="Move the line down"
- id="org.eclipse.papyrus.infra.table.efacet.common.command.movedownrow"
- name="Move Line Down">
- </command>
- </extension>
- <extension
- point="org.eclipse.ui.menus">
- <menuContribution
- allPopups="false"
- locationURI="popup:org.eclipse.ui.popup.any">
- <command
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.moveuprow"
- icon="icons/up.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <and>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- <with
- variable="activePart">
- <test
- forcePluginActivation="true"
- property="org.eclipse.papyrus.infra.table.efacet.common.propertyTester.isPapyrusTableEfacet"
- value="true">
- </test>
- </with>
- </and>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.movedownrow"
- icon="icons/down.gif"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <and>
- <with
- variable="activeEditorId">
- <equals
- value="org.eclipse.papyrus.infra.core.papyrusEditor">
- </equals>
- </with>
- <with
- variable="activePart">
- <test
- forcePluginActivation="true"
- property="org.eclipse.papyrus.infra.table.efacet.common.propertyTester.isPapyrusTableEfacet"
- value="true">
- </test>
- </with>
- </and>
- </visibleWhen>
- </command>
- </menuContribution>
- </extension>
- <extension
- point="org.eclipse.ui.handlers">
- <handler
- class="org.eclipse.papyrus.infra.table.efacet.common.handlers.DownRowHandler"
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.movedownrow">
- </handler>
- <handler
- class="org.eclipse.papyrus.infra.table.efacet.common.handlers.UpRowHandler"
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.moveuprow">
- </handler>
- </extension>
- <extension
- point="org.eclipse.ui.bindings">
- <key
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.moveuprow"
- contextId="org.eclipse.papyrus.infra.table.efacet.common.context"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="ALT+ARROW_UP">
- </key>
- <key
- commandId="org.eclipse.papyrus.infra.table.efacet.common.command.movedownrow"
- contextId="org.eclipse.papyrus.infra.table.efacet.common.context"
- schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"
- sequence="ALT+ARROW_DOWN">
- </key>
- </extension>
- <extension
- point="org.eclipse.ui.contexts">
- <context
- description="Papyrus Table Context"
- id="org.eclipse.papyrus.infra.table.efacet.common.context"
- name="Papyrus Table Context"
- parentId="org.eclipse.ui.contexts.window">
- </context>
- </extension>
- <extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.papyrus.infra.table.efacet.common.tester.TablePropertyTester"
- id="org.eclipse.papyrus.infra.table.efacet.common.propertyTester"
- namespace="org.eclipse.papyrus.infra.table.efacet.common.propertyTester"
- properties="isPapyrusTableEfacet"
- type="org.eclipse.ui.IWorkbenchPart">
- </propertyTester>
- </extension>
- <extension
- point="org.eclipse.emf.facet.widgets.celleditors.commandFactories">
- <commandFactory
- class="org.eclipse.papyrus.infra.table.efacet.common.factory.PapyrusCommandFactory">
- </commandFactory>
- </extension>
-</plugin>
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/Activator.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/Activator.java
deleted file mode 100644
index 695bdeb..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/Activator.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common;
-
-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.efacet.common"; //$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- public static LogHelper log;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- @Override
- public void start(final BundleContext context) throws Exception {
- super.start(context);
- this.log = new LogHelper(this);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(final 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/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractPapyrusNestedEditor.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractPapyrusNestedEditor.java
deleted file mode 100644
index 2b7b819..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractPapyrusNestedEditor.java
+++ /dev/null
@@ -1,407 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.efacet.common.editor;
-
-import java.util.EventObject;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.common.command.CommandStackListener;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.part.EditorPart;
-
-//TODO : we should continue to develp this class in order it looks like to the abstract class of GMFDiagramEditor in Papyrus then move it in an upper plugin
-public abstract class AbstractPapyrusNestedEditor extends EditorPart implements IEditingDomainProvider {
-
- protected final ServicesRegistry servicesRegistry;
-
- private final CommandStackListener commandListener = new CommandStackListener() {
-
- public void commandStackChanged(final EventObject event) {
- Display.getCurrent().asyncExec(new Runnable() {
-
- public void run() {
- firePropertyChange(PROP_DIRTY);
- }
- });
- }
- };
-
- public AbstractPapyrusNestedEditor(final ServicesRegistry registry) {
- this.servicesRegistry = registry;
- }
-
- public final EditingDomain getEditingDomain() {
- try {
- return ServiceUtils.getInstance().getTransactionalEditingDomain(this.servicesRegistry);
- } catch (final ServiceException e) {
- Activator.log.error(e);
- }
- return null;
- }
-
- /**
- * @generated
- */
- @Override
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- /**
- * This sets up the editing domain for the model editor
- */
- protected void configureEditorEditingDomain() {
- Assert.isNotNull(getEditingDomain());
- getEditingDomain().getCommandStack().removeCommandStackListener(this.commandListener);
- getEditingDomain().getCommandStack().addCommandStackListener(this.commandListener);
- }
-
- @Override
- public void dispose() {
- super.dispose();
- getEditingDomain().getCommandStack().removeCommandStackListener(this.commandListener);
- }
-
- // /**
- // * The location of diagram icon in the plug-in
- // */
- // private static final String DIAG_IMG_PATH =
- // "icons/obj16/Diagram_Class.gif";
- //
- // /**
- // * The image descriptor of the diagram icon
- // */
- // private static final ImageDescriptor DIAG_IMG_DESC =
- // UMLDiagramEditorPlugin.getBundledImageDescriptor(UmlClassDiagramForMultiEditor.DIAG_IMG_PATH);
- //
- //
- // /**
- // * @generated
- // */
- // public static final String ID = "org.eclipse.papyrus.uml.diagram.clazz.part.UMLDiagramEditorID"; //$NON-NLS-1$
- //
- // /**
- // * @generated
- // */
- // public static final String CONTEXT_ID = "org.eclipse.papyrus.uml.diagram.clazz.ui.diagramContext"; //$NON-NLS-1$
- //
- // @Override
- // public void doSave(final IProgressMonitor monitor) {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // @Override
- // public void doSaveAs() {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // @Override
- // public void init(final IEditorSite site, final IEditorInput input) throws
- // PartInitException {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // @Override
- // public boolean isDirty() {
- // // TODO Auto-generated method stub
- // return false;
- // }
- //
- // @Override
- // public boolean isSaveAsAllowed() {
- // // TODO Auto-generated method stub
- // return false;
- // }
- //
- // @Override
- // public void createPartControl(final Composite parent) {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // @Override
- // public void setFocus() {
- // // TODO Auto-generated method stub
- //
- // }
- //
- // /**
- // * @generated
- // */
- // @Override
- // protected PreferencesHint getPreferencesHint() {
- // return UMLDiagramEditorPlugin.DIAGRAM_PREFERENCES_HINT;
- // }
- //
- // /**
- // * @generated
- // */
- // public void gotoMarker(final IMarker marker) {
- // MarkerNavigationService.getInstance().gotoMarker(this, marker);
- // }
- //
- // /**
- // * @generated
- // */
- // @Override
- // public boolean isSaveAsAllowed() {
- // return true;
- // }
- //
- // /**
- // * @generated
- // */
- // @Override
- // protected String getContextID() {
- // return CONTEXT_ID;
- // }
- //
- // /**
- // * @generated
- // */
- // @Override
- // public TransactionalEditingDomain getEditingDomain() {
- // return editingDomain;
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
- // /**
- // * @generated
- // */
- // @Override
- // public void doSaveAs() {
- // performSaveAs(new NullProgressMonitor());
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
- // /**
- // * @generated
- // */
- // @Override
- // protected void performSaveAs(final IProgressMonitor progressMonitor) {
- // // Nothing
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
- // /**
- // * @generated
- // */
- // @Override
- // protected TransactionalEditingDomain createEditingDomain() {
- // // Already configured
- // return editingDomain;
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
- // /**
- // * @generated
- // */
- // @Override
- // protected void configureDiagramEditDomain() {
- // super.configureDiagramEditDomain();
- // getDiagramEditDomain().getDiagramCommandStack().addCommandStackListener(new
- // CommandStackListener() {
- //
- // public void commandStackChanged(final EventObject event) {
- // firePropertyChange(IEditorPart.PROP_DIRTY);
- // }
- // });
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
- // /**
- // * @generated
- // */
- // @Override
- // public void doSave(final IProgressMonitor progressMonitor) {
- // // The saving of the resource is done by the CoreMultiDiagramEditor
- // lastSavdeOperation = getOperationHistory().getUndoOperation(getUndoContext());
- // }
- //
- // //------------------------//from UMLDiagramEditor (in class diagram
- // plugin
-
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // * The associated Diagram.
- // */
- // private Diagram diagram;
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // * Object used to synchronize the name of the editor with the name of the
- // * diagram.
- // */
- // private PartNameSynchronizer partNameSynchronizer;
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // * service serviceRegistry of the backbone
- // */
- // private ServicesRegistry servicesRegistry;
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // * Constructor.
- // *
- // * @param servicesRegistry
- // * @param diagram
- // * @throws ServiceException
- // */
- // public UmlGmfDiagramEditor(final ServicesRegistry servicesRegistry, final
- // Diagram diagram) throws ServiceException {
- // super(true);
- // this.diagram = diagram;
- // this.servicesRegistry = servicesRegistry;
- // // Install synchronizer
- // this.partNameSynchronizer = new PartNameSynchronizer(diagram);
- //
- // // Register this part to the ISaveAndDirtyService.
- // // This will allows to be notified of saveAs events, and the isDirty
- // // flag will be taken into
- // // account.
- // final ISaveAndDirtyService saveAndDirtyService =
- // servicesRegistry.getService(ISaveAndDirtyService.class);
- // saveAndDirtyService.registerIsaveablePart(this);
- //
- // // TODO: unregister when editor is disposed !
- // }
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // * Dispose services used in this part.
- // *
- // * @see
- // org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor#dispose()
- // *
- // */
- // @Override
- // public void dispose() {
- // super.dispose();
- //
- // ISaveAndDirtyService saveAndDirtyService;
- // try {
- // saveAndDirtyService =
- // this.servicesRegistry.getService(ISaveAndDirtyService.class);
- // saveAndDirtyService.removeIsaveablePart(this);
- //
- // } catch (final ServiceException e) {
- // // the service can't be found. Maybe it is already disposed.
- // // Do nothing
- // }
- //
- // }
- //
- // //---------fro mUMLGrmfDiagramEditor
- // /**
- // *
- // * @return the backbone service serviceRegistry. it cannot return null.
- // */
- // public ServicesRegistry getServicesRegistry() {
- // return this.servicesRegistry;
- // }
- //
- // public class SynchronizableGmfDiagramEditor extends DiagramDocumentEditor
- // implements IRevealSemanticElement {
- //
- // public SynchronizableGmfDiagramEditor(final boolean hasFlyoutPalette) {
- // super(hasFlyoutPalette);
- // }
- //
- //
- // /**
- // * reveal all editpart that represent an element in the given list.
- // *
- // * @see
- // org.eclipse.papyrus.infra.core.ui.IRevealSemanticElement#revealSemanticElement(java.util.List)
- // *
- // */
- // public void revealSemanticElement(final List<?> elementList) {
- // //create an instance that can get semantic element from gmf
- // final SemanticFromGMFElement semanticFromGMFElement = new
- // SemanticFromGMFElement();
- //
- // // get the graphical viewer
- // final GraphicalViewer graphicalViewer = getGraphicalViewer();
- // if(graphicalViewer != null) {
- //
- // //look for among all edit part if the semantic is contained in the list
- // final Iterator<?> iter =
- // graphicalViewer.getEditPartRegistry().values().iterator();
- // IGraphicalEditPart researchedEditPart = null;
- // while(iter.hasNext() && researchedEditPart == null) {
- // final Object currentEditPart = iter.next();
- // //look for only among IPrimary editpart to avoid compartment and labels
- // of links
- // if(currentEditPart instanceof IPrimaryEditPart) {
- // if(elementList.contains(semanticFromGMFElement.getSemanticElement(currentEditPart)))
- // {
- // researchedEditPart = ((IGraphicalEditPart)currentEditPart);
- // }
- // }
- //
- // }
- // //an editpart has been found so put selection on it.
- // if(researchedEditPart != null) {
- // graphicalViewer.select(researchedEditPart);
- // }
- // }
- // }
- //
- // /**
- // * Configures my diagram edit domain with its command stack.
- // * This method has been completely overridden in order to use a proxy
- // stack.
- // */
- // @Override
- // protected void configureDiagramEditDomain() {
- //
- // final DefaultEditDomain editDomain = getEditDomain();
- //
- // if(editDomain != null) {
- // final CommandStack stack = editDomain.getCommandStack();
- // if(stack != null) {
- // // dispose the old stack
- // stack.dispose();
- // }
- //
- // // create and assign the new stack
- // final CheckedDiagramCommandStack diagramStack = new
- // CheckedDiagramCommandStack(getDiagramEditDomain());
- //
- // editDomain.setCommandStack(diagramStack);
- // }
- //
- // final DiagramEditDomain diagEditDomain =
- // (DiagramEditDomain)getDiagramEditDomain();
- // diagEditDomain.setActionManager(createActionManager());
- // }
- // }
- //
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractSynchronizedTableEditor.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractSynchronizedTableEditor.java
deleted file mode 100644
index db69e8a..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractSynchronizedTableEditor.java
+++ /dev/null
@@ -1,110 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.editor;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.TriggerListener;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.table.efacet.common.input.PapyrusTableEditorInput;
-import org.eclipse.papyrus.infra.table.efacet.common.listener.FillingListener;
-import org.eclipse.papyrus.infra.table.efacet.common.listener.MoveTableLineListener;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.contexts.IContextService;
-
-public abstract class AbstractSynchronizedTableEditor extends AbstractTableEditor {
-
-
-
- /** listener on the model for synchronized table */
- private TriggerListener fillingListener;
-
- /** to listen moving lines in the table */
- private TriggerListener moveLineListener;
-
- /**
- *
- * Constructor.
- *
- * @param servicesRegistry
- * the service serviceRegistry
- * @param rawModel
- * the raw model
- */
- public AbstractSynchronizedTableEditor(final ServicesRegistry servicesRegistry, final PapyrusTable rawModel) {
- super(servicesRegistry, rawModel);
- }
-
-
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.nattable.workbench.editor.NatTableEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
- *
- * @param site
- * @param input
- * @throws PartInitException
- */
- @Override
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
- final PapyrusTableEditorInput tableEditorInput = new PapyrusTableEditorInput(this.rawModel, getEditingDomain());
- super.init(site, tableEditorInput);
- }
-
-
- /**
- * add listeners on the context of the table and on the table itself
- */
- @Override
- protected void configureEditorEditingDomain() {
- super.configureEditorEditingDomain();
- final EditingDomain editingDomain = getEditingDomain();
- Assert.isTrue(editingDomain instanceof TransactionalEditingDomain);
-
- this.fillingListener = new FillingListener(this.rawModel);
- ((TransactionalEditingDomain)editingDomain).addResourceSetListener(this.fillingListener);
-
- this.moveLineListener = new MoveTableLineListener(this.rawModel);
- ((TransactionalEditingDomain)editingDomain).addResourceSetListener(this.moveLineListener);
- }
-
- @Override
- public void createPartControl(final Composite parent) {
- final IContextService contextService = (IContextService)getSite().getService(IContextService.class);
- //FIXME : before Eclipse Juno, this line was not necessary
- //see bug 367816 and bug 382218
- contextService.activateContext("org.eclipse.papyrus.infra.table.efacet.common.context"); //$NON-NLS-1$
- super.createPartControl(parent);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.common.internal.NatTableEditor#dispose()
- *
- * {@inheritDoc}
- */
- @Override
- public void dispose() {
- ((TransactionalEditingDomain)getEditingDomain()).removeResourceSetListener(this.fillingListener);
- ((TransactionalEditingDomain)getEditingDomain()).removeResourceSetListener(this.moveLineListener);
- super.dispose();
- }
-
-
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractTableEditor.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractTableEditor.java
deleted file mode 100644
index 24c5fcf..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/AbstractTableEditor.java
+++ /dev/null
@@ -1,506 +0,0 @@
-/**
- * Copyright (c) 2012 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
- * Duplicated code from EMF-Facet
- */
-
-package org.eclipse.papyrus.infra.table.efacet.common.editor;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.emf.common.command.BasicCommandStack;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.edit.domain.IEditingDomainProvider;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidget;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetFactory;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetInternal;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetProvider;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetView;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.action.MenuManager;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-import org.eclipse.papyrus.infra.table.efacet.common.input.PapyrusTableEditorInput;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrustablePackage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorSite;
-import org.eclipse.ui.PartInitException;
-
-
-/**
- * Adapted code from EMF-Facet
- *
- *
- */
-public class AbstractTableEditor extends AbstractPapyrusNestedEditor implements ISelectionProvider {
-
- /** listener on the selection changes */
- private final ISelectionChangedListener localSelectionListener = new SelectionChangeListener();
-
- /** the list of the registered selection listeners */
- private final List<ISelectionChangedListener> registeredSelectionListener = new ArrayList<ISelectionChangedListener>();
-
- /** the id for the menu of the editor */
- private final static String ID = "org.eclipse.papyrus.infra.table.efacet.common.editor";
-
- protected ITableWidget natTableWidget;
-
- /** the table instance */
- protected PapyrusTable rawModel;
-
-
-
- public AbstractTableEditor(final ServicesRegistry servicesRegistry, final PapyrusTable rawModel) {
- super(servicesRegistry);
- this.rawModel = rawModel;
- new PartNameSynchronizer(rawModel);
- }
-
- @SuppressWarnings("rawtypes")
- // We cannot change the method signature because of the override
- @Override
- public Object getAdapter(final Class adapter) {
- if(adapter == ITableWidgetProvider.class) {
- return new ITableWidgetProvider() {
-
- public ITableWidget getTableWidget() {
- return AbstractTableEditor.this.natTableWidget;
- }
- };
- }
- if(adapter == PapyrusTable.class) {
- return this.natTableWidget.getTable().eContainer();
- } else if(adapter == Table.class) {
- return this.natTableWidget.getTable();
- }
- return null;
- }
-
- @Override
- public void init(final IEditorSite site, final IEditorInput input) throws PartInitException {
- if(input instanceof PapyrusTableEditorInput) {
- setSite(site);
- setInput(input);
- setPartName(this.rawModel.getName());
- configureEditorEditingDomain();
- } else {
- throw new PartInitException("Input should be of type TableEditorInput"); //$NON-NLS-1$
- }
- }
-
-
-
- /**
- *
- * @see org.eclipse.ui.part.WorkbenchPart#createPartControl(org.eclipse.swt.widgets.Composite)
- *
- * @param parent
- */
- @Override
- public void createPartControl(final Composite parent) {
-
- final Composite editorComposite = createCompositeCompositeWthTableBorder(parent);
-
- // the composite owning the table
- final Composite tableComposite = new Composite(editorComposite, SWT.NONE);
- final GridLayout tableCompositeGridLayout = new GridLayout(1, true);
- tableComposite.setLayout(tableCompositeGridLayout);
-
- final GridData compositeTableGridLayout = new GridData();
- compositeTableGridLayout.grabExcessHorizontalSpace = true;
- compositeTableGridLayout.grabExcessVerticalSpace = true;
- compositeTableGridLayout.horizontalAlignment = SWT.FILL;
- compositeTableGridLayout.verticalAlignment = SWT.FILL;
- tableComposite.setLayoutData(compositeTableGridLayout);
- final FilteredMenuManager menuMgr = new FilteredMenuManager("#PopUp", AbstractTableEditor.ID);
- this.natTableWidget = createNattableWidget(tableComposite, this, this.rawModel.getTable(), menuMgr);
- this.natTableWidget.addSelectionChangedListener(new SelectionChangeListener());
- getSite().setSelectionProvider(this);
- getSite().registerContextMenu(menuMgr, this.natTableWidget);
- }
-
- /**
- *
- * @param tableComposite
- * the composite
- * @param domainProvider
- * the editing domain provider
- * @param table
- * the table
- * @param menuMgr2
- * the menu manager for the widget
- * @return
- */
- private ITableWidget createNattableWidget(final Composite tableComposite, final IEditingDomainProvider domainProvider, final Table table, final MenuManager menuMgr) {
- final ITableWidget widget = ITableWidgetFactory.INSTANCE.createTableWidget(tableComposite, domainProvider, table, menuMgr);
- final GridData tableGridData = new GridData();
- tableGridData.grabExcessHorizontalSpace = true;
- tableGridData.grabExcessVerticalSpace = true;
- tableGridData.horizontalAlignment = SWT.FILL;
- tableGridData.verticalAlignment = SWT.FILL;
- widget.getComposite().setLayoutData(tableGridData);
- return widget;
- }
-
- private Composite createCompositeCompositeWthTableBorder(final Composite parent) {
- final Composite editorComposite = new Composite(parent, SWT.BORDER);
- final GridLayout editorGridLayout = new GridLayout(1, true);
- editorGridLayout.marginHeight = 0;
- editorGridLayout.marginWidth = 0;
-
- final GridData data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = SWT.FILL;
- editorComposite.setLayoutData(data);
- editorComposite.setLayout(editorGridLayout);
- return editorComposite;
- }
-
- @Override
- public void setFocus() {
- this.natTableWidget.getComposite().setFocus();
- }
-
- @Override
- public boolean isDirty() {
- return ((BasicCommandStack)getEditingDomain().getCommandStack()).isSaveNeeded();
- }
-
- @Override
- public void doSave(final IProgressMonitor monitor) {
- //nothing to do here, the save is done by the CoreMultiDiagramEditor
- }
-
- @Override
- public void doSaveAs() {
- //nothing to do here, the save is done by the CoreMultiDiagramEditor
- }
-
- public void setSelection(final ISelection selection) {
- this.natTableWidget.setSelection(selection);
- }
-
-
-
- @Override
- public void dispose() {
- super.dispose();
- this.natTableWidget.removeSelectionChangedListener(this.localSelectionListener);
- this.registeredSelectionListener.clear();
- }
-
-
- /**
- * Warning, we should avoid to use this method.
- * It will be better to ask to emffacet to open their API
- *
- * @return
- * the grid selection
- */
- //currently never used
- public List<Object> getGridSelection() {
- final String errorMessage = "We are using java reflect API to get the Grid Selection of the table";
- Activator.log.warn(errorMessage);
- final Class<?> cl = this.natTableWidget.getClass();
- ITableWidgetView view = null;
- ITableWidgetInternal nattableWidget = null;
- try {
- Field field = cl.getDeclaredField("nattableWidget");
- field.setAccessible(true);
- nattableWidget = (ITableWidgetInternal)field.get(this.natTableWidget);
- field = nattableWidget.getClass().getDeclaredField("view");
- field.setAccessible(true);
- view = (ITableWidgetView)field.get(nattableWidget);
- } catch (final SecurityException e) {
- Activator.log.error(errorMessage, e);
- } catch (final NoSuchFieldException e) {
- Activator.log.error(errorMessage, e);
- } catch (final IllegalArgumentException e) {
- Activator.log.error(errorMessage, e);
- } catch (final IllegalAccessException e) {
- Activator.log.error(errorMessage, e);
- }
- return view.getGridSelection();
- }
-
- public ISelection getSelection() {
-
- // StructuredSelection selection = null;
- // final List<EObject> selectedEObject = ((org.eclipse.emf.facet.widgets.table.ui.ITableWidget)this.natTableWidget).getSelectedRowEObjects();
- // final ITableWidgetView view = getTableWidgetView();
- //
- // final List<Object> gridSelection = view.getGridSelection();
- // final List<Column> selectedColumn = new ArrayList<Column>();
- // final List<Row> selectedRow = new ArrayList<Row>();
- // final List<IGridElement> grid = new ArrayList<IGridElement>();
- // if(gridSelection.isEmpty()) {
- // return new StructuredSelection(this.tableEditorInput.getPapyrusTable());
- // }
- //
- // for(final Object current : gridSelection) {
- // if(current instanceof Column) {
- // selectedColumn.add((Column)current);
- // } else if(current instanceof IGridElement) {
- // grid.add((IGridElement)current);
- // } else if(current instanceof Row) {
- // selectedRow.add((Row)current);
- // }
- // // org.eclipse.emf.facet.widgets.table.ui.nattable.internal.nattable.dataprovider.GridElement
- // int i = 0;
- // i++;
- // }
- //
- // //we ignore columns!
- // if(!selectedRow.isEmpty()) {
- // selection = new StructuredSelection(((org.eclipse.emf.facet.widgets.table.ui.ITableWidget)this.natTableWidget).getSelectedRowEObjects());
- // } else if(!gridSelection.isEmpty()) {
- // final List<Object> eobject = new ArrayList<Object>();
- // final IFacetManager facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(this.tableEditorInput.getPapyrusTable().eResource().getResourceSet());
- // for(final IGridElement gridElement : grid) {
- //
- // try {
- // eobject.add(TableWidgetUtils.getValueOf(gridElement, facetManager));
- // } catch (final FacetManagerException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- // int i = 0;
- // i++;
- // }
- // return new StructuredSelection(eobject);
- // }
- //
- //
- //
- // if(!selectedEObject.isEmpty()) {
- // //return
- // selection = new StructuredSelection(selectedEObject);
- // } else {
- // // final ISelection tableSelection = this.natTableWidget.getSelection();
- // // if(tableSelection.isEmpty()) {
- // selection = new StructuredSelection(this.tableEditorInput.getPapyrusTable());
- // // }
- // }
- StructuredSelection selection = null;
- selection = (StructuredSelection)this.natTableWidget.getSelection();
- if(selection.isEmpty()) {
- selection = new StructuredSelection(this.rawModel);
- }
- return selection;
- }
-
- public void addSelectionChangedListener(final ISelectionChangedListener listener) {
- this.registeredSelectionListener.add(listener);
- }
-
- public void removeSelectionChangedListener(final ISelectionChangedListener listener) {
- this.registeredSelectionListener.remove(listener);
- }
-
- /**
- *
- * This listener dispatches the selection change events to the registered listeners
- *
- */
- private class SelectionChangeListener implements ISelectionChangedListener {
-
- /**
- *
- * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
- * s
- * @param event
- */
- public void selectionChanged(final SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if(selection.isEmpty()) {
- selection = new StructuredSelection(AbstractTableEditor.this.rawModel);
- }
- for(final ISelectionChangedListener current : AbstractTableEditor.this.registeredSelectionListener) {
- current.selectionChanged(new SelectionChangedEvent(AbstractTableEditor.this, selection));
- }
- }
- }
-
- /**
- *
- * This menu manager allows to filter the contribution to the menu of the table
- * FIXME : try to do that with capabilities and activities
- *
- */
- private class FilteredMenuManager extends MenuManager {
-
-
- /** the qualified name of forbidden contribution */
- private List<String> forbiddenContributions = null;
-
- /** the pattern of authorized contribution */
- private List<String> authorizedPattern = new ArrayList<String>();
-
- public FilteredMenuManager(final String text, final String id) {
- super(text, id);
- this.forbiddenContributions = new ArrayList<String>();
- this.forbiddenContributions.add("org.eclipse.emf.facet.widgets.nattable.examples.ecore.internal.commands.openEclorTabularEditor");
- this.forbiddenContributions.add("org.eclipse.emf.facet.widgets.nattable.workbench.action4");
- this.forbiddenContributions.add("org.eclipse.emf.facet.widgets.nattable.workbench.action3");
- this.forbiddenContributions.add("org.eclipse.emf.facet.widgets.table.ui.workbench.command1");
- this.forbiddenContributions.add("org.eclipse.emf.facet.widgets.table.ui.workbench.command2");
-
- this.authorizedPattern = new ArrayList<String>();
- this.authorizedPattern.add("papyrus");
- this.authorizedPattern.add("table");
- this.authorizedPattern.add("org.eclipse.ui.edit.delete");
- this.authorizedPattern.add("org.eclipse.ui.edit.copy");
- this.authorizedPattern.add("org.eclipse.ui.edit.selectAll");
- }
-
-
-
- /**
- * We filter the contribution to the table menu
- *
- * @see org.eclipse.jface.action.MenuManager#doItemFill(org.eclipse.jface.action.IContributionItem, int)
- *
- * @param ci
- * @param index
- */
- @Override
- protected void doItemFill(final IContributionItem ci, final int index) {
- if(isAllowedInTableMenu(ci)) {
- super.doItemFill(ci, index);
- }
- }
-
- private boolean isAllowedInTableMenu(final IContributionItem ci) {
- final String contributionId = ci.getId();
- boolean autorized = true;
- for(final String current : this.forbiddenContributions) {
- if(contributionId.contains(current)) {
- autorized = false;
- }
- }
- if(autorized) {
- for(final String current : this.authorizedPattern) {
- if(contributionId.contains(current)) {
- autorized = true;
- }
- }
- }
- return autorized;
- }
-
- }
-
- /**
- * A class taking in charge the synchronization of the partName and the table name.
- * When table name change, the other is automatically updated.
- *
- * @author vincent lorenzo
- * adapted class from UmlGmfDiagramEditor
- */
- public class PartNameSynchronizer {
-
- /** the papyrus table */
- private PapyrusTable papyrusTable;
-
- /**
- * Listener on diagram name change.
- */
- private final Adapter tableNameListener = new Adapter() {
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- */
- public void notifyChanged(final Notification notification) {
- if(notification.getFeatureID(PapyrusTable.class) == PapyrustablePackage.PAPYRUS_TABLE__NAME && notification.getNotifier() == PartNameSynchronizer.this.papyrusTable) {
- setPartName(PartNameSynchronizer.this.papyrusTable.getName());
- }
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#getTarget()
- *
- * @return
- */
- public Notifier getTarget() {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#setTarget(org.eclipse.emf.common.notify.Notifier)
- *
- * @param newTarget
- */
- public void setTarget(final Notifier newTarget) {
- }
-
- /**
- *
- * @see org.eclipse.emf.common.notify.Adapter#isAdapterForType(java.lang.Object)
- *
- * @param type
- * @return
- */
- public boolean isAdapterForType(final Object type) {
- return false;
- }
-
- };
-
- /**
- *
- * Constructor.
- *
- * @param diagram
- */
- public PartNameSynchronizer(final PapyrusTable papyrusTable) {
- setTable(papyrusTable);
- }
-
- /**
- * Change the associated diagram.
- *
- * @param papyrusTable
- */
- public void setTable(final PapyrusTable papyrusTable) {
- // Remove from old table, if any
- if(this.papyrusTable != null) {
- papyrusTable.eAdapters().remove(this.tableNameListener);
- }
- // Set new table
- this.papyrusTable = papyrusTable;
- // Set editor name
- setPartName(papyrusTable.getName());
- // Listen to name change
- papyrusTable.eAdapters().add(this.tableNameListener);
- }
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/EditorNameInitializer.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/EditorNameInitializer.java
deleted file mode 100644
index 14e4fea..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/editor/EditorNameInitializer.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2012 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.efacet.common.editor;
-
-import java.util.Collection;
-import java.util.SortedSet;
-import java.util.TreeSet;
-
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Setting;
-import org.eclipse.emf.ecore.util.ECrossReferenceAdapter;
-
-/**
- *
- * This class provides useful method to get an unused name for a new editor
- *
- */
-//TODO move it in an upper plugin
-public class EditorNameInitializer {
-
- private EditorNameInitializer() {
- //to prenvent instanciation
- }
-
- /**
- * This method returns the owner for the feature called "name". In some specific case (like PapyrusTable) the name is not owned by the eobject
- * which provides the context of the editor!
- *
- * @param eobject
- * an eobject
- * @return
- * the eobject which contains a feature called "name" or null if not found
- */
- private static final EObject getNameFeatureOwner(final EObject eobject) {
- EObject owner = eobject;
- while(owner.eContainer() != null) {
- EStructuralFeature nameFeature = ((EObject)eobject).eClass().getEStructuralFeature("name");
- if(nameFeature == null) {
- owner = owner.eContainer();
- } else {
- return owner;
- }
- }
- return null;
- }
-
- /**
- * This method returns the feature called "name". In some specific case (like PapyrusTable) the name is not owned by the eobject
- * which provides the context of the editor!
- *
- * @param eobject
- * an eobject
- * @return
- * the name feature or <code>null</code> if not found
- */
- private static final EStructuralFeature getNameFeature(final EObject eobject) {
- EObject owner = eobject;
- while(owner.eContainer() != null) {
- EStructuralFeature nameFeature = ((EObject)eobject).eClass().getEStructuralFeature("name");
- if(nameFeature == null) {
- owner = owner.eContainer();
- } else {
- return nameFeature;
- }
- }
- return null;
- }
-
- /**
- *
- * @param editorModelEClass
- * the eclass of the model of the editor
- * @param wantedNameWithoutIndex
- * the wantedname for the new editor
- * @param context
- * the context of the editor
- * @return
- * the name for this editor
- */
- public static final String getNameWithIncrement(final EClass editorModelEClass, final String wantedNameWithoutIndex, final EObject context) {
- //a set of the existing index for the wantedName
- final SortedSet<Integer> existingIndex = new TreeSet<Integer>();
- final ECrossReferenceAdapter crossRef = ECrossReferenceAdapter.getCrossReferenceAdapter(context);
- final Collection<Setting> crossReference = crossRef.getNonNavigableInverseReferences(context, true);
- for(Setting set : crossReference) {
- final EObject eobject = set.getEObject();
- if(eobject.eClass() == editorModelEClass) {
- final EStructuralFeature nameFeature = getNameFeature(eobject);
- if(nameFeature != null) {
- final EObject featureOwner = getNameFeatureOwner(eobject);
- Object currentName = featureOwner.eGet(nameFeature);
- if(currentName instanceof String) {
- String aName = (String)currentName;
- if(aName.contains(wantedNameWithoutIndex)) {
- String lastChar = aName.substring(aName.length() - 1, aName.length());
- try {
- Integer value = Integer.parseInt(lastChar);
- existingIndex.add(value);
- } catch (Exception e) {
- //nothing to do
- }
- }
- }
- }
- }
- }
- int index = 0;
- if(!existingIndex.isEmpty()) {
- index = existingIndex.last().intValue() + 1;
- }
- return wantedNameWithoutIndex + String.valueOf(index);
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/AbstractTableEditorFactory.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/AbstractTableEditorFactory.java
deleted file mode 100644
index 19f87d5..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/AbstractTableEditorFactory.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.factory;
-
-import java.lang.reflect.Constructor;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
-import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.part.EditorActionBarContributor;
-
-public class AbstractTableEditorFactory extends AbstractEditorFactory {
-
- public AbstractTableEditorFactory(final Class<?> diagramClass, final String expectedType) {
- super(diagramClass, expectedType);
- }
-
- /**
- * Create the IPageModel that is used by the SashWindows to manage the
- * editor.
- *
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#createIPageModel(java.lang.Object)
- *
- * @param pageIdentifier
- * The model pushed in the sashmodel by the creation command
- * @return A model implementing the IPageModel
- */
- public IPageModel createIPageModel(final Object pageIdentifier) {
- return new TableEditorModel(pageIdentifier, getServiceRegistry());
- }
-
- /**
- * @see org.eclipse.papyrus.infra.core.editorsfactory.IEditorFactory#isPageModelFactoryFor(java.lang.Object)
- *
- * @param pageIdentifier
- * @return
- */
- public boolean isPageModelFactoryFor(final Object pageIdentifier) {
- if(pageIdentifier instanceof PapyrusTable) {
- return getExpectedType().equals(((PapyrusTable)pageIdentifier).getType());
- }
- return false;
- }
-
- /**
- * IEditorModel used internally by the SashContainer. This model know how to
- * handle IEditor creation.
- *
- * @author cedric dumoulin
- *
- */
- class TableEditorModel implements IEditorModel {
-
- /**
- * The servicesRegistry provided at creation.
- */
- private final ServicesRegistry servicesRegistry;
-
- /**
- * The created editor.
- */
- private IEditorPart editor;
-
- /**
- * The raw model stored in the SashProvider.
- */
- private final PapyrusTable rawModel;
-
- /**
- *
- * Constructor.
- */
- public TableEditorModel(final Object pageIdentifier, final ServicesRegistry servicesRegistry) {
- this.rawModel = (PapyrusTable)pageIdentifier;
- this.servicesRegistry = servicesRegistry;
- }
-
- /**
- * Create the IEditor for the diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#createIEditorPart()
- * @return
- * @throws PartInitException
- *
- */
- public IEditorPart createIEditorPart() throws PartInitException {
- try {
-
- final Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTable.class);
- final IEditorPart newEditor = (IEditorPart)c.newInstance(this.servicesRegistry, this.rawModel);
- this.editor = newEditor;
- return this.editor;
-
- } catch (final Exception e) {
- // Lets propagate. This is an implementation problem that should
- // be solved by
- // programmer.
- throw new PartInitException("Can't create TableEditor", e); //$NON-NLS-1$
- }
-
- }
-
- /**
- * Get the action bar requested by the Editor.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IEditorModel#getActionBarContributor()
- * @return
- *
- */
- public EditorActionBarContributor getActionBarContributor() {
-
- final String actionBarId = AbstractTableEditorFactory.this.editorDescriptor.getActionBarContributorId();
-
- // Do nothing if no EditorActionBarContributor is specify.
- if(actionBarId == null || actionBarId.length() == 0) {
- return null;
- }
-
- // Try to get it.
-
- // Get ServiceRegistry
- // ServicesRegistry serviceRegistry = getServicesRegistry();
- ActionBarContributorRegistry registry;
- try {
- registry = this.servicesRegistry.getService(ActionBarContributorRegistry.class);
- } catch (final ServiceException e) {
- Activator.log.error(e);
- return null;
- }
-
- try {
- return registry.getActionBarContributor(actionBarId);
- } catch (final BackboneException e) {
- Activator.log.error(e);
- return null;
- }
- }
-
- /**
- * Get the underlying RawModel. Return the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getRawModel()
- * @return
- *
- */
- public Object getRawModel() {
- return this.rawModel;
- }
-
- /**
- * Get the icon to be shown by Tabs
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabIcon()
- * @return
- *
- */
- public Image getTabIcon() {
- final ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null) {
- return null;
- }
-
- return imageDescriptor.createImage();
- }
-
- /**
- * Get the title of the Diagram.
- *
- * @see org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageModel#getTabTitle()
- * @return
- *
- */
- public String getTabTitle() {
- return this.rawModel.getName();
- }
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusCommandFactory.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusCommandFactory.java
deleted file mode 100644
index 971cf6c..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusCommandFactory.java
+++ /dev/null
@@ -1,303 +0,0 @@
-/*****************************************************************************
- * 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.efacet.common.factory;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.UnexecutableCommand;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.facet.infra.browser.custom.AttributeView;
-import org.eclipse.emf.facet.infra.browser.custom.CustomViewFeature;
-import org.eclipse.emf.facet.infra.browser.custom.MetamodelView;
-import org.eclipse.emf.facet.infra.browser.custom.ReferenceView;
-import org.eclipse.emf.facet.infra.browser.custom.StaticFeatureValue;
-import org.eclipse.emf.facet.infra.browser.custom.TypeView;
-import org.eclipse.emf.facet.infra.facet.Facet;
-import org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory;
-import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.Column;
-import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.Row;
-import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableInstance;
-import org.eclipse.emf.facet.widgets.nattable.internal.painter.Customization;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
-import org.eclipse.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.services.edit.service.ElementEditServiceUtils;
-import org.eclipse.papyrus.infra.services.edit.service.IElementEditService;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-
-/**
- *
- * This factory is used by the Papyrus Table when the editing domain is an instanceof TransactionalEditingDomain
- *
- */
-//TODO we should write a switch for the command factory (one for old tables and another one for new tabels)
-@SuppressWarnings("restriction")
-public class PapyrusCommandFactory extends DefaultCommandFactory {
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#handles(org.eclipse.emf.edit.domain.EditingDomain)
- *
- * {@inheritDoc}
- */
- @Override
- public boolean handles(final EditingDomain editingDomain) {
- return editingDomain instanceof TransactionalEditingDomain;
- }
-
- /**
- *
- * @param owner
- * the owner object
- * @param feature
- * the feature to edit
- * @return <code>true</code> if object is an {@link EObject} and feature a {@link EStructuralFeature}
- */
- protected boolean testArgs(final Object owner, final Object feature) {
- if(feature != null) {
- if(feature instanceof EStructuralFeature) {
- /*
- * The ElementEditService can be used for UML Element and for view and for... others things,
- * but it doesn't work correctly with the nattable widget elements
- */
- if(isEMFFacetElement(owner)) {
- return false;
- } else if(owner instanceof EObject) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- * The ElementEditService can be used for UML Element and for view and for... others things, but it doesn't work correctly with the nattable
- * widget
- * elements
- *
- * @param owner
- * an object
- * @return
- * <code>true</code> if the object is an EMF-Facet object
- */
- private boolean isEMFFacetElement(final Object owner) {
- if(owner instanceof TableInstance) {
- return true;
- } else if(owner instanceof MetamodelView) {
- return true;
- } else if(owner instanceof Row) {
- return true;
- } else if(owner instanceof Column) {
- return true;
- } else if(owner instanceof Facet) {
- return true;
- } else if(owner instanceof Customization) {
- return true;
- } else if(owner instanceof TypeView) {
- return true;
- } else if(owner instanceof ReferenceView) {
- return true;
- } else if(owner instanceof AttributeView) {
- return true;
- } else if(owner instanceof CustomViewFeature) {
- return true;
- } else if(owner instanceof StaticFeatureValue) {
- return true;
- }
- //we add this test,because, it is possible that we forget some emf-facet elements
- String className = owner.getClass().getCanonicalName();
- if(className.contains("org.eclipse.emf.facet")) { //$NON-NLS-1$
- String message = "the type " + className + " should be included in the test"; //$NON-NLS-1$ //$NON-NLS-2$
- Activator.getDefault().log.info(message);
- return true;
- }
- return false;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createAddCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object, java.lang.Object, java.lang.Object)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createAddCommand(final EditingDomain editingDomain, final Object owner, final Object feature, final Object value) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(owner)) {
- return super.createAddCommand(editingDomain, owner, feature, value);
- }
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
- if(testArgs(owner, feature) && elementEditService != null) {
- EObject current = (EObject)owner;
- Object values = current.eGet((EStructuralFeature)feature);
- if(values instanceof List<?>) {
- ArrayList<Object> newList = new ArrayList<Object>();
- newList.addAll((List<?>)values);
- newList.add(value);
- SetRequest request = new SetRequest((TransactionalEditingDomain)editingDomain, current, (EStructuralFeature)feature, newList);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createDeleteCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createDeleteCommand(final EditingDomain editingDomain, final Object elementToDestroy) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(elementToDestroy)) {
- return super.createDeleteCommand(editingDomain, elementToDestroy);
- }
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(elementToDestroy);
- if(testArgs(elementToDestroy, null) && elementEditService != null) {
- DestroyElementRequest request = new DestroyElementRequest((TransactionalEditingDomain)editingDomain, (EObject)elementToDestroy, false);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createMoveCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object, java.lang.Object, java.lang.Object, int)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createMoveCommand(final EditingDomain editingDomain, final Object owner, final Object feature, final Object value, final int index) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(owner)) {
- return super.createMoveCommand(editingDomain, owner, feature, value, index);
- }
-
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
- if(testArgs(owner, feature) && elementEditService != null) {
- EObject current = (EObject)owner;
- Object values = current.eGet((EStructuralFeature)feature);
- if(values instanceof List<?>) {
- ArrayList<Object> newList = new ArrayList<Object>();
- newList.addAll((List<?>)values);
- int currentIndex = ((List<?>)values).indexOf(value);
- newList.remove(currentIndex);
- newList.add(index, value);
- SetRequest request = new SetRequest((TransactionalEditingDomain)editingDomain, (EObject)owner, (EStructuralFeature)feature, newList);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createRemoveCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object, java.lang.Object, java.lang.Object)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createRemoveCommand(final EditingDomain editingDomain, final Object owner, final Object feature, final Object value) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(owner)) {
- return super.createRemoveCommand(editingDomain, owner, feature, value);
- }
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
- if(testArgs(owner, feature) && elementEditService != null) {
- DestroyReferenceRequest request = new DestroyReferenceRequest((TransactionalEditingDomain)editingDomain, (EObject)owner, (EReference)feature, (EObject)value, false);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createSetCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object, java.lang.Object, java.lang.Object)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createSetCommand(final EditingDomain editingDomain, final Object owner, final Object feature, final Object value) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(owner)) {
- return super.createSetCommand(editingDomain, owner, feature, value);
- }
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
- if(testArgs(owner, feature) && elementEditService != null) {
- SetRequest request = new SetRequest((TransactionalEditingDomain)editingDomain, (EObject)owner, (EStructuralFeature)feature, value);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @see org.eclipse.emf.facet.widgets.celleditors.internal.DefaultCommandFactory#createSetCommand(org.eclipse.emf.edit.domain.EditingDomain,
- * java.lang.Object, java.lang.Object, java.lang.Object, int)
- *
- * {@inheritDoc}
- */
- @Override
- public Command createSetCommand(final EditingDomain editingDomain, final Object owner, final Object feature, final Object value, final int index) {
- //the ElementEditService doesn't work correctly with nattable elements, so we test the edited element
- if(isEMFFacetElement(owner)) {
- return super.createSetCommand(null, owner, feature, value, index);
- }
- IElementEditService elementEditService = ElementEditServiceUtils.getCommandProvider(owner);
- if(testArgs(owner, feature) && elementEditService != null) {
- EObject current = (EObject)owner;
- Object values = current.eGet((EStructuralFeature)feature);
- if(values instanceof List<?>) {
- ArrayList<Object> newList = new ArrayList<Object>();
- newList.addAll((List<?>)values);
- newList.set(index, value);
- SetRequest request = new SetRequest((TransactionalEditingDomain)editingDomain, (EObject)owner, (EStructuralFeature)feature, newList);
- ICommand command = elementEditService.getEditCommand(request);
- if(command.canExecute()) {
- return new GMFtoEMFCommandWrapper(command);
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusTableEfacetCommandFactory.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusTableEfacetCommandFactory.java
deleted file mode 100644
index 22b89f4..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/factory/PapyrusTableEfacetCommandFactory.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.factory;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.command.UnexecutableCommand;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.edit.command.MoveCommand;
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Row;
-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.efacet.metamodel.papyrustable.PapyrusTable;
-
-/**
- *
- * This factory provides commands for the PapyrusTable
- *
- */
-public class PapyrusTableEfacetCommandFactory {
-
- private PapyrusTableEfacetCommandFactory() {
- //to prevent instanciation
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param table
- * the table
- * @param rowToMove
- * the row to move
- * @return
- * the command to move the row
- */
- public static final Command getMoveLineUpCommand(final EditingDomain domain, final Table table, final Row rowToMove) {
- if(domain != null && table != null && rowToMove != null) {
- final EList<Row> allRows = table.getRows();
- final int currentIndex = allRows.indexOf(rowToMove);
- if(currentIndex != -1) {
- final int newIndex = currentIndex - 1;
- if(newIndex >= 0) {
- final MoveCommand cmd = new MoveCommand(domain, table, TablePackage.eINSTANCE.getTable_Rows(), rowToMove, newIndex);
- cmd.setLabel("Move Line Up"); //$NON-NLS-1$
- return cmd;
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param table
- * the table
- * @param rowToMove
- * the row to move
- * @return
- * the command to move the row
- */
- public static final Command getMoveLineDownCommand(final EditingDomain domain, final Table table, final Row rowToMove) {
- if(domain != null && table != null && rowToMove != null) {
- final EList<Row> allRows = table.getRows();
- final int currentIndex = allRows.indexOf(rowToMove);
- if(currentIndex != -1) {
- final int newIndex = currentIndex + 1;
- if(newIndex <= allRows.size() - 1) {
- final MoveCommand cmd = new MoveCommand(domain, table, TablePackage.eINSTANCE.getTable_Rows(), rowToMove, newIndex);
- cmd.setLabel("Move Line Down"); //$NON-NLS-1$
- return cmd;
- }
- }
- }
- return UnexecutableCommand.INSTANCE;
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param table
- * the table
- * @param rowToMove
- * the row to move
- * @return
- * the command to move the row
- */
- public static final Command getMoveLineUpCommand(final EditingDomain domain, final PapyrusTable table, final Row rowToMove) {
- return getMoveLineUpCommand(domain, table.getTable(), rowToMove);
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param table
- * the table
- * @param rowToMove
- * the row to move
- * @return
- * the command to move the row
- */
- public static final Command getMoveLineDownCommand(final EditingDomain domain, final PapyrusTable table, final Row rowToMove) {
- return getMoveLineDownCommand(domain, table.getTable(), rowToMove);
- }
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractCreateTableEditorHandler.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractCreateTableEditorHandler.java
deleted file mode 100644
index 0a04068..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractCreateTableEditorHandler.java
+++ /dev/null
@@ -1,356 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.handlers;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-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.emf.facet.widgets.table.metamodel.v0_2_0.tableconfiguration.TableConfiguration;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.TableWidgetUtils;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.InputDialog;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.papyrus.commands.CheckedOperationHistory;
-import org.eclipse.papyrus.infra.core.editor.BackboneException;
-import org.eclipse.papyrus.infra.core.editor.IMultiDiagramEditor;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.core.resource.NotFoundException;
-import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageMngr;
-import org.eclipse.papyrus.infra.core.services.ServiceException;
-import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
-import org.eclipse.papyrus.infra.core.utils.EditorUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtils;
-import org.eclipse.papyrus.infra.core.utils.ServiceUtilsForActionHandlers;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-import org.eclipse.papyrus.infra.table.efacet.common.editor.EditorNameInitializer;
-import org.eclipse.papyrus.infra.table.efacet.common.modelresource.PapyrusTableModelResource;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrustableFactory;
-import org.eclipse.papyrus.infra.table.efacet.papyrustableconfiguration.metamodel.papyrustableconfiguration.PapyrusTableConfiguration;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-
-public abstract class AbstractCreateTableEditorHandler extends AbstractHandler {
-
- /** the default name for the table */
- private final String defaultName;
-
- /** the name for the table */
- private String name;
-
- /** the editor type */
- private final String editorType;
-
- /**
- *
- * Constructor.
- *
- * @param editorType
- * the type of the editor
- * @param defaultName
- * the default name for this editor
- */
- public AbstractCreateTableEditorHandler(final String editorType, final String defaultName) {
- Assert.isNotNull(editorType != null);
- this.editorType = editorType;
- this.defaultName = defaultName;
- }
-
- /**
- * Should be overridden in order to restrict creation
- *
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
- * @return
- */
- @Override
- public boolean isEnabled() {
- final EObject context = getTableContext();
- return context instanceof EObject;
- }
-
- /**
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- public Object execute(final ExecutionEvent event) throws ExecutionException {
- try {
-
- runAsTransaction();
- } catch (final ServiceException e) {
- throw new ExecutionException("Can't create TableEditor", e); //$NON-NLS-1$
- }
- return null;
- }
-
- /**
- *
- * @return <code>true</code> to open the name dialog
- */
- protected boolean shouldOpenNameDialog() {
- return true;
- }
-
-
-
- /**
- * Run the command as a transaction. Create a Transaction and delegate the
- * command to {@link #doExecute(ServicesRegistry)}.
- *
- * @throws ServiceException
- *
- */
- public void runAsTransaction() throws ServiceException {
- final ServicesRegistry serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
- final TransactionalEditingDomain domain = ServiceUtils.getInstance().getTransactionalEditingDomain(serviceRegistry);
-
-
- // default Value
- this.name = EditorNameInitializer.getNameWithIncrement(TablePackage.eINSTANCE.getTable(), defaultName, getTableContext());
-
- if(shouldOpenNameDialog()) {// this test is used to allow the JUnit
- // test without ui!
- final InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "Create new table", "Table Name", this.name, null); //$NON-NLS-1$ //$NON-NLS-2$
- if(dialog.open() == Dialog.OK) {
- // get the name and the description for the table
- this.name = dialog.getValue();
- } else {
- return;
- }
- }
-
-
- // Create the transactional command
- final AbstractEMFOperation command = new AbstractEMFOperation(domain, "Create " + this.editorType) { //$NON-NLS-1$
-
- @Override
- protected IStatus doExecute(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- try {
- AbstractCreateTableEditorHandler.this.doExecute(serviceRegistry);
- } catch (final ServiceException e) {
- Activator.log.error(e);
- return Status.CANCEL_STATUS;
- } catch (final NotFoundException e) {
- Activator.log.error(e);
- return Status.CANCEL_STATUS;
- }
- return Status.OK_STATUS;
- }
- };
-
- // Execute the command
- try {
- CheckedOperationHistory.getInstance().execute(command, new NullProgressMonitor(), null);
- } catch (final ExecutionException e) {
- Activator.log.error("Can't create Table Editor", e); //$NON-NLS-1$
- }
- }
-
- /**
- * Do the execution of the command.
- *
- * @param serviceRegistry
- * @throws ServiceException
- * @throws NotFoundException
- */
- public void doExecute(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
-
- final Object editorModel = createEditorModel(serviceRegistry);
- // Get the mngr allowing to add/open new editor.
- final IPageMngr pageMngr = ServiceUtils.getInstance().getIPageMngr(serviceRegistry);
- // add the new editor model to the sash.
- pageMngr.openPage(editorModel);
-
- }
-
- /**
- * Create a model identifying the editor. This model will be saved with the
- * sash
- *
- * @return
- * @throws ServiceException
- * @throws NotFoundException
- * The model where to save the TableInstance is not found.
- */
- protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
- final PapyrusTable papyrusTable = PapyrustableFactory.eINSTANCE.createPapyrusTable();
- papyrusTable.setName(this.name);
- papyrusTable.setType(this.editorType);
- final PapyrusTableModelResource papyrusModel = (PapyrusTableModelResource)ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(PapyrusTableModelResource.MODEL_ID);
- papyrusModel.addPapyrusTable(papyrusTable);
-
- final PapyrusTableConfiguration configuration = getPapyrusTableConfiguration();
- if(configuration != null) {
- papyrusTable.setFillingMode(configuration.getFillingMode());
- papyrusTable.setContextFeature(configuration.getListenContextFeature());
- papyrusTable.getQueries().addAll(configuration.getFillingQueries());
- }
-
- final EObject context = getTableContext();
- Assert.isNotNull(context);
-
- final String description = null;
- TableConfiguration tableConfiguration = null;
- if(configuration != null) {
- tableConfiguration = configuration.getTableConfiguration();
- }
- final Object parameter = null;
- final Table table = TableWidgetUtils.createTableInstance(Collections.EMPTY_LIST, description, tableConfiguration, context, parameter);
-
- papyrusTable.setTable(table);
-
- return papyrusTable;
- }
-
- /**
- *
- * @return the configuration to use for the table. This method can return <code>null</code>
- */
- protected final PapyrusTableConfiguration getPapyrusTableConfiguration() {
- PapyrusTableConfiguration configuration = null;
- final ResourceSet resourceSet = getTableContext().eResource().getResourceSet();
-
- final URI uri = getPapyrusTableConfigurationURI();
- if(uri != null) {
- final Resource resource = resourceSet.getResource(uri, true);
- EcoreUtil.resolveAll(resource);
- if(resource.getContents().get(0) instanceof PapyrusTableConfiguration) {
- configuration = (PapyrusTableConfiguration)resource.getContents().get(0);
- }
- }
- return configuration;
- }
-
- /**
- *
- * @return the URI of the Papyrus Table Configuration
- */
- protected URI getPapyrusTableConfigurationURI() {
- return null;
- }
-
- /**
- * Get the current MultiDiagramEditor.
- *
- * @return
- * @throws BackboneException
- */
- protected IMultiDiagramEditor getMultiDiagramEditor() throws BackboneException {
- return EditorUtils.getMultiDiagramEditorChecked();
- }
-
- /**
- * Returns the context used to create the table
- *
- * @return the context used to create the table or <code>null</code> if not
- * found
- * @throws ServiceException
- */
- protected EObject getTableContext() {
- final List<EObject> selection = getSelection();
-
- if(!selection.isEmpty()) {
- return selection.get(0);
- }
-
- // we shouldn't try to find a valid context when the selection is not
- // valid!
- ModelSet modelSet = null;
- ServicesRegistry serviceRegistry;
- try {
- serviceRegistry = ServiceUtilsForActionHandlers.getInstance().getServiceRegistry();
- modelSet = ServiceUtils.getInstance().getModelSet(serviceRegistry);
- } catch (final NullPointerException npe) {
- //
- } catch (final ServiceException exception) {
-
- }
-
- if(modelSet != null) {
- final IModel model = modelSet.getModel(org.eclipse.papyrus.infra.core.resource.uml.UmlModel.MODEL_ID);
-
- if(model instanceof AbstractBaseModel) {
- return getRootElement(((AbstractBaseModel)model).getResource());
- }
- }
- return null;
- }
-
- /**
- *
- * @return
- */
- protected List<EObject> getSelection() {
- final List<EObject> selectedElements = new ArrayList<EObject>();
- final ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- if(selection instanceof IStructuredSelection) {
-
- final IStructuredSelection structuredSelection = (IStructuredSelection)selection;
-
- final Iterator<?> it = structuredSelection.iterator();
- while(it.hasNext()) {
- final Object object = it.next();
- if(object instanceof IAdaptable) {
- final EObject currentEObject = (EObject)((IAdaptable)object).getAdapter(EObject.class);
-
- if(currentEObject != null) {
- selectedElements.add(currentEObject);
- }
- }
-
- }
- }
- return selectedElements;
- }
-
- /**
- * Get the root element associated with canvas.
- */
- protected EObject getRootElement(final Resource modelResource) {
- EObject rootElement = null;
- if(modelResource != null && modelResource.getContents() != null && modelResource.getContents().size() > 0) {
- final Object root = modelResource.getContents().get(0);
- if(root instanceof EObject) {
- rootElement = (EObject)root;
- }
- }
- return rootElement;
- }
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractMoveRowHandler.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractMoveRowHandler.java
deleted file mode 100644
index 7321629..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/AbstractMoveRowHandler.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.handlers;
-
-import java.util.List;
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
-import org.eclipse.emf.facet.widgets.table.ui.ITableWidget;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidgetProvider;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
-import org.eclipse.papyrus.infra.table.efacet.common.editor.AbstractSynchronizedTableEditor;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.PlatformUI;
-
-//import org.eclipse.emf.facet.widgets.table.ui.internal.exported.ITableWidget;
-
-/**
- *
- * the abstract class for the move line handler
- *
- */
-public abstract class AbstractMoveRowHandler extends AbstractHandler {
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- *
- * @param event
- * @return
- * @throws ExecutionException
- */
- public final Object execute(final ExecutionEvent event) throws ExecutionException {
- final Command cmd = getMoveRowCommand();
- if(cmd != null && cmd.canExecute()) {
- //we save the current row selection
- final List<EObject> selectedRows = getSelectedRowEObject();
- getEditingDomain().getCommandStack().execute(cmd);
-
- //we set the old row selection
- final ITableWidget widget = getTableWidget();
- widget.selectRows(selectedRows, true);
- }
- return null;
- }
-
- /**
- *
- * @see org.eclipse.core.commands.AbstractHandler#isEnabled()
- *
- * @return
- */
- @Override
- public boolean isEnabled() {
- return (getSelectedRowEObject().size() == 1) && getMoveRowCommand().canExecute();
-
- }
-
- /**
- *
- * @return
- * a list of the selected rows
- */
- protected List<EObject> getSelectedRowEObject() {
- final ITableWidget widget = getTableWidget();
- return widget.getSelectedRowEObjects();
- }
-
- /**
- *
- * @return
- * the current table editor
- */
- protected AbstractSynchronizedTableEditor getCurrentTableEditor() {
- final IWorkbenchPart page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
- if(page instanceof CoreMultiDiagramEditor) {
- final IEditorPart activeEditor = ((CoreMultiDiagramEditor)page).getActiveEditor();
- if(activeEditor instanceof AbstractSynchronizedTableEditor) {
- return (AbstractSynchronizedTableEditor)activeEditor;
- }
- }
- return null;
- }
-
-
- /**
- *
- * @return
- * the current nattable widget
- */
- protected ITableWidget getTableWidget() {
- final AbstractSynchronizedTableEditor editor = getCurrentTableEditor();
- if(editor != null) {
- final ITableWidgetProvider provider = (ITableWidgetProvider)editor.getAdapter(ITableWidgetProvider.class);
- if(provider != null) {
- final Object widget = provider.getTableWidget();
- if(widget instanceof ITableWidget) {
- return (ITableWidget)widget;
- }
- }
- }
- return null;
- }
-
- /**
- *
- * @return the editing domain to use for the command
- */
- protected TransactionalEditingDomain getEditingDomain() {
- return (TransactionalEditingDomain)getCurrentTableEditor().getEditingDomain();
- }
-
- /**
- *
- * @return
- * the current table
- */
- protected Table getTable() {
- return (Table)getCurrentTableEditor().getAdapter(Table.class);
- }
-
- /**
- *
- * @return
- * the command to move the lines
- */
- protected abstract Command getMoveRowCommand();
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/DownRowHandler.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/DownRowHandler.java
deleted file mode 100644
index 7de13e2..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/DownRowHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.handlers;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Row;
-import org.eclipse.papyrus.infra.table.efacet.common.factory.PapyrusTableEfacetCommandFactory;
-
-/**
- *
- * This handler allows to move a line down
- *
- */
-public class DownRowHandler extends AbstractMoveRowHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.efacet.common.handlers.AbstractMoveRowHandler#getMoveRowCommand()
- *
- * @return
- */
- @Override
- protected Command getMoveRowCommand() {
- final EObject element = getSelectedRowEObject().get(0);
- for(final Row row : getTable().getRows()) {
- if(row.getElement() == element) {
- return PapyrusTableEfacetCommandFactory.getMoveLineDownCommand(getEditingDomain(), getTable(), row);
- }
- }
- return null;
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/UpRowHandler.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/UpRowHandler.java
deleted file mode 100644
index f009409..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/handlers/UpRowHandler.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.handlers;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Row;
-import org.eclipse.papyrus.infra.table.efacet.common.factory.PapyrusTableEfacetCommandFactory;
-
-/**
- *
- * This handler allows to move a line up
- *
- */
-public class UpRowHandler extends AbstractMoveRowHandler {
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.efacet.common.handlers.AbstractMoveRowHandler#getMoveRowCommand()
- *
- * @return
- */
- @Override
- protected Command getMoveRowCommand() {
- final EObject element = getSelectedRowEObject().get(0);
- for(final Row row : getTable().getRows()) {
- if(row.getElement() == element) {
- return PapyrusTableEfacetCommandFactory.getMoveLineUpCommand(getEditingDomain(), getTable(), row);
- }
- }
- return null;
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/input/PapyrusTableEditorInput.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/input/PapyrusTableEditorInput.java
deleted file mode 100644
index 95ee61a..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/input/PapyrusTableEditorInput.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009, 2010 Mia-Software.
- * 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 Bros (Mia-Software) - Bug 331203 - table model editor - initial API and implementation
- * Nicolas Guyomar (Mia-Software) - Bug 332924 - To be able to save the table
- * Nicolas Guyomar (Mia-Software) - Bug 333029 - To be able to save the size of the lines and the columns
- *******************************************************************************/
-package org.eclipse.papyrus.infra.table.efacet.common.input;
-
-import org.eclipse.emf.edit.domain.EditingDomain;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IPersistableElement;
-
-/**
- * Comes from org.eclipse.emf.facet.widget.nattable.workbench.
- *
- * This class should not be used by others plugins
- */
-public class PapyrusTableEditorInput implements IEditorInput {
-
- /** The input for the Table widget */
- private final PapyrusTable papyrusTable;
-
- /** A textual description of what is shown in the editor */
- private final String description;
-
- private final EditingDomain editingDomain;
-
- public PapyrusTableEditorInput(final PapyrusTable papyrusTable, final EditingDomain editingDomain) {
- this.papyrusTable = papyrusTable;
- this.description = papyrusTable.getTable().getDescription();
- this.editingDomain = editingDomain;
- }
-
- public PapyrusTable getPapyrusTable() {
- return this.papyrusTable;
- }
-
- public String getDescription() {
- return this.description;
- }
-
- public boolean exists() {
- return false;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return null;
- }
-
- public String getName() {
- return "PapyrusTable Model"; //$NON-NLS-1$
- }
-
- public IPersistableElement getPersistable() {
- return null;
- }
-
- public String getToolTipText() {
- return "PapyrusTable Model"; //$NON-NLS-1$
- }
-
- public Object getAdapter(@SuppressWarnings("rawtypes") final Class adapter) {
- return null;
- }
-
- public EditingDomain getEditingDomain() {
- return this.editingDomain;
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java
deleted file mode 100644
index 6cdc932..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java
+++ /dev/null
@@ -1,111 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.listener;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory;
-import org.eclipse.emf.facet.widgets.celleditors.ICommandFactoriesRegistry;
-import org.eclipse.emf.facet.widgets.celleditors.ICommandFactory;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
-import org.eclipse.emf.facet.widgets.table.ui.command.ITableCommandFactory;
-import org.eclipse.emf.facet.widgets.table.ui.command.ITableCommandFactoryFactory;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.TriggerListener;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-
-
-
-public abstract class AbstractTableTriggerListener extends TriggerListener {
-
- /** The table. */
- protected final PapyrusTable table;
-
- /**
- * Instantiates a new abstract table trigger listener.
- *
- * @param papyrusTable
- * the papyrus table
- */
- public AbstractTableTriggerListener(final PapyrusTable papyrusTable) {
- this.table = papyrusTable;
- }
-
- /**
- * @see org.eclipse.emf.transaction.TriggerListener#trigger(org.eclipse.emf.transaction.TransactionalEditingDomain,
- * org.eclipse.emf.common.notify.Notification)
- *
- * @param domain
- * @param notification
- * @return
- */
-
- @Override
- protected final Command trigger(final TransactionalEditingDomain domain, final Notification notification) {
- if(isManagedNotification(notification)) {
- return getSynchronizationCommand(domain, notification);
- }
- return null;
- }
-
- /**
- * Gets the synchronization command.
- *
- * @param domain
- * the domain
- * @param notification
- * the notification
- * @return the synchronization command
- */
- protected Command getSynchronizationCommand(final TransactionalEditingDomain domain, final Notification notification) {
- return null;
- }
-
- /**
- * Checks if is managed notification.
- *
- * @param notification
- * the notification
- * @return true, if is managed notification
- */
- protected abstract boolean isManagedNotification(Notification notification);
-
- /**
- * Gets the command name.
- *
- * @param notification
- * the notification
- * @return the command name
- */
- protected abstract String getCommandName(final Notification notification);
-
- /**
- *
- * @param editingDomain
- * the editing domain
- * @param resourceSet
- * the resource set
- * @param table
- * the table
- * @return
- * the command factory for these parameters
- */
- public static ITableCommandFactory getTableCmdFactory(final TransactionalEditingDomain editingDomain, final ResourceSet resourceSet, final Table table) {
- final IFacetManager facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(resourceSet);
- final ICommandFactory commandFactory = ICommandFactoriesRegistry.INSTANCE.getCommandFactoryFor(editingDomain);
- final ITableCommandFactory tableCmdFactory = ITableCommandFactoryFactory.DEFAULT.createTableCommandFactory(table, editingDomain, commandFactory, facetManager);
- return tableCmdFactory;
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/FillingListener.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/FillingListener.java
deleted file mode 100644
index 0cdd0cc..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/FillingListener.java
+++ /dev/null
@@ -1,371 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.listener;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionException;
-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.CompoundCommand;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.ETypedElement;
-import org.eclipse.emf.facet.efacet.core.IFacetManager;
-import org.eclipse.emf.facet.efacet.core.IFacetManagerFactory;
-import org.eclipse.emf.facet.efacet.core.exception.FacetManagerException;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.FacetReference;
-import org.eclipse.emf.facet.efacet.metamodel.v0_2_0.efacet.extensible.Query;
-import org.eclipse.emf.facet.widgets.table.ui.command.ITableCommandFactory;
-import org.eclipse.emf.facet.widgets.table.ui.internal.exported.TableWidgetUtils;
-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.papyrus.commands.wrappers.GMFtoEMFCommandWrapper;
-import org.eclipse.papyrus.infra.core.sashwindows.di.PageRef;
-import org.eclipse.papyrus.infra.core.sashwindows.di.TabFolder;
-import org.eclipse.papyrus.infra.table.efacet.common.Activator;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrustablePackage;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.TableContentsUtils;
-
-/**
- *
- * This listener provides the command to synchronize the table when something changes in the uml file OR when the table is opened
- *
- */
-public class FillingListener extends AbstractTableTriggerListener {
-
- /**
- * this set stores the eobjects already managed by an addRow command
- */
- private final Set<EObject> addedEObjects = new HashSet<EObject>();
-
- /**
- * this set stores the eobjects already managed by a deleteRow command
- */
- private final Set<EObject> deletedEObjects = new HashSet<EObject>();
-
-
- /**
- *
- * Constructor.
- *
- * @param table
- * the table to fill
- * @param natTableWidget
- */
- public FillingListener(final PapyrusTable table) {
- super(table);
- }
-
- /**
- *
- * @param domain
- * the editing domain used for the command
- * @return
- */
- @Override
- public Command getSynchronizationCommand(final TransactionalEditingDomain domain, final Notification notification) {
- //we build the list of the eobjects to add and remove
- List<EObject> toAdd = null;
- List<EObject> toRemove = null;
- CompoundCommand compoundCommand = null;
- if(this.table.isUsingUser()) {
- toAdd = Collections.emptyList();
- toRemove = Collections.emptyList();
- } else if(this.table.isUsingContextFeature()) {
- final EReference ref = this.table.getContextFeature();
- if(!ref.isDerived()) {//TODO improve the usage of the notification in this case
- //TODO verify that the query to define accepted elements in a table is already called
- final List<EObject>[] addRemove = getElementToAddRemoveUsingContextFeature(this.table);
- toAdd = addRemove[0];
- toRemove = addRemove[1];
- } else {
- //TODO verify that the query to define accepted elements in a table is already called
- final List<EObject>[] addRemove = getElementToAddRemoveUsingContextFeature(this.table);
- toAdd = addRemove[0];
- toRemove = addRemove[1];
- }
- } else if(this.table.isUsingQueries()) {
- final List<EObject>[] addRemove = getElementToAddRemoveUsingQueries(this.table);
- toAdd = addRemove[0];
- toRemove = addRemove[1];
- }
-
- //we clean the list (remove eobject already managed)
- toAdd.removeAll(this.addedEObjects);
- toRemove.removeAll(this.deletedEObjects);
-
- //we update the list of already managed elements
- this.addedEObjects.addAll(toAdd);
- this.deletedEObjects.addAll(toRemove);
-
- final ITableCommandFactory factory = getTableCmdFactory(domain, this.table.getTable().eResource().getResourceSet(), this.table.getTable());
- final Command removeCommand = createRemoveCommand(domain, factory, toRemove);
- final Command addCommand = createAddCommand(domain, factory, toAdd);
-
- if(removeCommand != null || addCommand != null) {
- compoundCommand = new CompoundCommand(getCommandName(notification));
- if(removeCommand != null && removeCommand.canExecute()) {
- compoundCommand.append(removeCommand);
- }
- if(addCommand != null && addCommand.canExecute()) {
- compoundCommand.append(addCommand);
- }
- }
- return compoundCommand;
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param factory
- * the factory to use to build the command
- * @param toRemove
- * the eobjets to remove
- * @return
- * the command to remove rows
- */
- private final Command createRemoveCommand(final TransactionalEditingDomain domain, final ITableCommandFactory factory, final List<EObject> toRemove) {
- CompoundCommand cmd = null;
- if(!toRemove.isEmpty()) {
- cmd = new CompoundCommand("Table Synchronization Command (Remove Rows)");
- cmd.append(factory.createRemoveRowByEObjectCommand(toRemove));
- cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Clean the set deletedEObjects", null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- FillingListener.this.deletedEObjects.removeAll(toRemove);
- return CommandResult.newOKCommandResult();
- }
- }));
- }
- return cmd;
- }
-
- /**
- *
- * @param domain
- * the editing domain
- * @param factory
- * the factory to use to build the command
- * @param toAdd
- * the eobjects to add
- * @return
- * the command to add rows
- */
- private final Command createAddCommand(final TransactionalEditingDomain domain, final ITableCommandFactory factory, final List<EObject> toAdd) {
- CompoundCommand cmd = null;
- if(!toAdd.isEmpty()) {
- cmd = new CompoundCommand("Table Synchronization Command (Remove Rows)");
- //duplicated code from the widget
- cmd.append(factory.createAddRowsCommand(toAdd));
- cmd.append(factory.createSetFacetSetsCommand(this.table.getTable().getFacetSets()));
-
- cmd.append(new GMFtoEMFCommandWrapper(new AbstractTransactionalCommand(domain, "Clean the set addedEObjects", null) {
-
- @Override
- protected CommandResult doExecuteWithResult(final IProgressMonitor monitor, final IAdaptable info) throws ExecutionException {
- FillingListener.this.addedEObjects.removeAll(toAdd);;
- return CommandResult.newOKCommandResult();
- }
- }));
- }
- return cmd;
- }
-
-
-
- /**
- *
- * @return
- * an array of lists. the first list contains the elements to add and the second list contains the elements to remove
- */
- @SuppressWarnings("unchecked")
- private final List<EObject>[] getElementToAddRemoveUsingQueries(final PapyrusTable papyrusTable) {
- final List<?>[] addRemove = new List<?>[2];
- final List<EObject> toAdd = new ArrayList<EObject>();
- final List<EObject> toRemove = new ArrayList<EObject>();
- final IFacetManager facetManager = IFacetManagerFactory.DEFAULT.getOrCreateFacetManager(papyrusTable.eResource());
- final Set<EObject> allElements = new HashSet<EObject>();
- for(final Query current : papyrusTable.getQueries()) {
- EObject container = current.eContainer();
- if(container instanceof FacetReference) {
- try {
- List<EObject> res = facetManager.getOrInvokeMultiValued(papyrusTable, (ETypedElement)container, null);
- if(res != null) {
- allElements.addAll(res);
- }
- } catch (FacetManagerException e) {
- Activator.log.equals(e);
- }
- }
- }
- final List<EObject> currentContent = TableContentsUtils.getTableContents(papyrusTable, papyrusTable.getTable().getContext(), false);
- final ArrayList<EObject> newValue = new ArrayList<EObject>((Set<EObject>)allElements);
- //fill the add list
-
- toAdd.addAll(newValue);
- toAdd.removeAll(currentContent);
-
- //fill the removeList
- currentContent.removeAll(newValue);
- toRemove.addAll(currentContent);
-
- addRemove[0] = toAdd;
- addRemove[1] = toRemove;
- return (List<EObject>[])addRemove;
- }
-
-
- /**
- *
- * @return
- * an array of lists. the first list contains the elements to add and the second list contains the elements to remove
- */
- @SuppressWarnings("unchecked")
- private final List<EObject>[] getElementToAddRemoveUsingContextFeature(final PapyrusTable papyrusTable) {
- final List<?>[] addRemove = new List<?>[2];
- final List<EObject> toAdd = new ArrayList<EObject>();
- final List<EObject> toRemove = new ArrayList<EObject>();
- addRemove[0] = toAdd;
- addRemove[1] = toRemove;
-
-
- final List<EObject> currentContent = TableWidgetUtils.getElements(papyrusTable.getTable());
- final Object value = papyrusTable.getTable().getContext().eGet(papyrusTable.getContextFeature());
- if(value instanceof List<?>) {
- final ArrayList<EObject> newValue = new ArrayList<EObject>((List<EObject>)value);
- //fill the add list
- // newValue.removeAll(currentContent);
- toAdd.addAll(newValue);
- toAdd.removeAll(currentContent);
-
- //fill the removeList
- currentContent.removeAll(newValue);
- toRemove.addAll(currentContent);
- } else {
- //we do nothing
- }
- return (List<EObject>[])addRemove;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.efacet.common.listener.AbstractSynchronizedTableListener#isManagedNotification(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- * @return
- */
- @Override
- protected boolean isManagedNotification(final Notification notification) {
- return isUsingQueries() || isTableOpening(notification) || isModifyingModel(notification) || isFillingModeChanging(notification);
- }
-
- /**
- *
- * @return
- * <code>true</code> if the table is filled using queries
- */
- protected boolean isUsingQueries() {
- return this.table.isUsingQueries();
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if the filling mode is changing
- */
- protected boolean isFillingModeChanging(final Notification notification) {
- return (notification.getNotifier() == this.table && notification.getFeature() == PapyrustablePackage.eINSTANCE.getPapyrusTable_FillingMode());
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if we are opening a table
- */
- protected boolean isTableOpening(final Notification notification) {
- final Object notifier = notification.getNotifier();
- if(notifier instanceof EObject) {
- final EObject eobject = (EObject)notifier;
- if(notifier instanceof TabFolder) {
- final Object newValue = notification.getNewValue();
- PageRef ref = null;
- if(newValue instanceof PageRef) {
- ref = (PageRef)newValue;
- }
- if(ref != null && ref.getEmfPageIdentifier() == this.table) {
- return true;
- }
- }
- }
- return false;
- }
-
- /**
- *
- * @param notification
- * a notification
- * @return
- * <code>true</code> if we are modifying the model
- */
- protected boolean isModifyingModel(final Notification notification) {
- final Object notifier = notification.getNotifier();
- if(notifier instanceof EObject) {
- final EObject eobject = (EObject)notifier;
- if(eobject.eResource() != null && eobject.eResource() == this.table.getTable().getContext().eResource()) { //$NON-NLS-1$
- return true;
- }
- }
- return false;
- }
-
- /**
- *
- * @param notification
- * the notification
- * @return
- * the name of the command to use
- */
- @Override
- protected String getCommandName(final Notification notification) {
- final String commandName;
- if(isUsingQueries()) {
- commandName = "Synchronized Table Command (Contents Changes Using Queries)";
- } else if(isFillingModeChanging(notification)) {
- commandName = "Synchronized Table Command (Filling Mode Changed)";
- } else if(isTableOpening(notification)) {
- commandName = "Synchronized Table Command (Updating Opening Table)";
- } else if(isModifyingModel(notification)) {
- commandName = "Synchronized Table Command (Update for Model Changes)";
- } else {
- commandName = "";
- }
- return commandName;
- }
-
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/MoveTableLineListener.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/MoveTableLineListener.java
deleted file mode 100644
index ea0113c..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/MoveTableLineListener.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.listener;
-
-import java.util.List;
-
-import org.eclipse.emf.common.command.Command;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.edit.command.MoveCommand;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Row;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.TablePackage;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-
-/**
- *
- * This listener allows to know when a line has been moved in the table
- *
- */
-public class MoveTableLineListener extends AbstractTableTriggerListener {
-
- /**
- *
- * Constructor.
- *
- * @param table
- */
- public MoveTableLineListener(final PapyrusTable table) {
- super(table);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.efacet.common.listener.AbstractSynchronizedTableListener#isManagedNotification(org.eclipse.emf.common.notify.Notification)
- *
- * @param notification
- * @return
- */
- @Override
- protected boolean isManagedNotification(final Notification notification) {
- if(notification.getEventType() == Notification.MOVE && notification.getNotifier() == this.table.getTable() && notification.getFeature() == TablePackage.eINSTANCE.getTable_Rows()) {
- if(this.table.isUsingContextFeature()) {
- final EStructuralFeature feature = this.table.getContextFeature();
- if(feature != null && feature.isOrdered()) {
- return true;
- }
-
- }
- }
- return false;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.table.efacet.common.listener.AbstractSynchronizedTableListener#getSynchronizationCommand(org.eclipse.emf.transaction.TransactionalEditingDomain,
- * org.eclipse.emf.common.notify.Notification)
- *
- * @param domain
- * @param notification
- * @return
- */
- @Override
- public Command getSynchronizationCommand(final TransactionalEditingDomain domain, final Notification notification) {
- final EObject tableContext = this.table.getTable().getContext();
- final Object currentValue = tableContext.eGet(this.table.getContextFeature());
- final EObject movedValue = ((Row)notification.getNewValue()).getElement();
- if(currentValue instanceof List<?>) {
- final MoveCommand cmd = new MoveCommand(domain, tableContext, this.table.getContextFeature(), movedValue, notification.getPosition());
- cmd.setLabel(getCommandName(notification));
- return cmd;
- }
- return null;
- }
-
- @Override
- protected String getCommandName(final Notification notification) {
- return "Move Line Command (Update the Model)";
- }
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/EMFFacetTableModelResource.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/EMFFacetTableModelResource.java
deleted file mode 100644
index 51802eb..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/EMFFacetTableModelResource.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 LIFL & 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:
- * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.table.efacet.common.modelresource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.widgets.nattable.instance.tableinstance.TableInstance;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
-import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-
-
-
-/**
- * A model used to save data from the {@link DefaultNattableEditor}
- *
- * @author cedric dumoulin
- *
- */
-public class EMFFacetTableModelResource extends /* AbstractBaseModel */AbstractModelWithSharedResource<TableInstance> implements IModel {
-
- /*
- * To save in a new file :
- * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
- */
-
-
- /**
- * File extension used for notation.
- */
- // public static final String NOTATION_FILE_EXTENSION = "nattable"; //$NON-NLS-1$
-
- public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
-
- /**
- * Model ID.
- */
- public static final String MODEL_ID = "org.eclipse.papyrus.emf.facet.table.resource.TableModel"; //$NON-NLS-1$
-
-
- /**
- *
- * Constructor.
- *
- */
- public EMFFacetTableModelResource() {
-
- }
-
- // Initialize stuff in the model.
- @Override
- public void init(final ModelSet modelManager) {
- super.init(modelManager);
- // nothing to do now
- }
-
- /**
- * Get the file extension used for this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- return NOTATION_FILE_EXTENSION;
- }
-
- /**
- * Get the identifier used to register this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- return MODEL_ID;
- }
-
-
- /**
- * Add a new initialized {@link Diagram} to the model.
- *
- * @param newDiagram
- * The diagram to add.
- */
- public void addTableInstance(final Table tableInstance) {
- getResource().getContents().add(tableInstance);
- }
-
- /**
- * Add a new initialized {@link Diagram} to the model.
- *
- * @param newDiagram
- * The diagram to add.
- */
- public void removeTableInstance(final Table tableInstance) {
- getResource().getContents().remove(tableInstance);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
- *
- * @param object
- * @return
- */
- @Override
- protected boolean isModelRoot(final EObject object) {
- return false;
- }
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/PapyrusTableModelResource.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/PapyrusTableModelResource.java
deleted file mode 100644
index 01a743d..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/modelresource/PapyrusTableModelResource.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/*****************************************************************************
- * Copyright (c) 2011 LIFL & 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:
- * Cedric Dumoulin (LIFL) cedric.dumoulin@lifl.fr - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.table.efacet.common.modelresource;
-
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.facet.widgets.table.metamodel.v0_2_0.table.Table;
-import org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource;
-import org.eclipse.papyrus.infra.core.resource.IModel;
-import org.eclipse.papyrus.infra.core.resource.ModelSet;
-import org.eclipse.papyrus.infra.table.efacet.metamodel.papyrustable.PapyrusTable;
-
-
-
-/**
- * A model used to save data from the {@link DefaultNattableEditor}
- *
- * @author cedric dumoulin
- *
- */
-public class PapyrusTableModelResource extends AbstractModelWithSharedResource<Table> implements IModel {
-
- /*
- * To save in a new file :
- * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
- */
-
-
- /**
- * File extension used for notation.
- */
- // public static final String NOTATION_FILE_EXTENSION = "nattable"; //$NON-NLS-1$
-
- public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
-
- /**
- * Model ID.
- */
- public static final String MODEL_ID = "org.eclipse.papyrus.infra.table.efacet.common.modelresource.PapyrusTableModelResource"; //$NON-NLS-1$
-
-
- /**
- *
- * Constructor.
- *
- */
- public PapyrusTableModelResource() {
-
- }
-
- // Initialize stuff in the model.
- @Override
- public void init(final ModelSet modelManager) {
- super.init(modelManager);
- // nothing to do now
- }
-
- /**
- * Get the file extension used for this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
- * @return
- */
- @Override
- protected String getModelFileExtension() {
- return NOTATION_FILE_EXTENSION;
- }
-
- /**
- * Get the identifier used to register this model.
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getIdentifier()
- *
- * @return
- */
- @Override
- public String getIdentifier() {
- return MODEL_ID;
- }
-
-
- /**
- * Add a new initialized {@link PapyrusTable} to the model.
- *
- * @param papyrusTable
- * The tableInstance to add.
- */
- public void addPapyrusTable(final PapyrusTable papyrusTable) {
- getResource().getContents().add(papyrusTable);
- }
-
- /**
- * Add a new initialized {@link PapyrusTable} to the model.
- *
- * @param papyrusTable
- * The tableInstance to add.
- */
- public void removePapyrusTable(final PapyrusTable papyrusTable) {
- getResource().getContents().remove(papyrusTable);
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
- *
- * @param object
- * @return
- */
- @Override
- protected boolean isModelRoot(final EObject object) {
- return false;
- }
-
-}
diff --git a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/tester/TablePropertyTester.java b/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/tester/TablePropertyTester.java
deleted file mode 100644
index f45ab1a..0000000
--- a/deprecated/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/tester/TablePropertyTester.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * Copyright (c) 2012 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.efacet.common.tester;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.papyrus.infra.core.editor.CoreMultiDiagramEditor;
-import org.eclipse.papyrus.infra.table.efacet.common.editor.AbstractSynchronizedTableEditor;
-
-/**
- *
- * This class provides tests to define the enablement of the actions
- *
- */
-public class TablePropertyTester extends PropertyTester {
-
- /** this property is used to know if the current editor is a PapyrusTableEditor */
- final String IS_PAPYRUS_TABLE_EFACET = "isPapyrusTableEfacet"; //$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(this.IS_PAPYRUS_TABLE_EFACET.equals(property) && receiver instanceof CoreMultiDiagramEditor) {
- return expectedValue.equals((((CoreMultiDiagramEditor)receiver).getActiveEditor() instanceof AbstractSynchronizedTableEditor));
- }
- return false;
- }
-
-}