Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java')
-rw-r--r--incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java
index 3886b835e84..6cdc93283a8 100644
--- a/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java
+++ b/incoming/TableEFacet/org.eclipse.papyrus.infra.table.efacet.common/src/org/eclipse/papyrus/infra/table/efacet/common/listener/AbstractTableTriggerListener.java
@@ -14,6 +14,14 @@ 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;
@@ -82,4 +90,22 @@ public abstract class AbstractTableTriggerListener extends TriggerListener {
* @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;
+ }
}

Back to the top