Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2013-07-09 15:24:22 +0000
committervlorenzo2013-07-09 15:24:22 +0000
commitebbd4078d91ac0664fd669bfad7de96a0c375a0c (patch)
tree886a2c388dc9136e9e914bb8592b5a4ac84ccead /sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
parent23caf2e84ac57b98106e504a90ade17c46b76cee (diff)
downloadorg.eclipse.papyrus-ebbd4078d91ac0664fd669bfad7de96a0c375a0c.tar.gz
org.eclipse.papyrus-ebbd4078d91ac0664fd669bfad7de96a0c375a0c.tar.xz
org.eclipse.papyrus-ebbd4078d91ac0664fd669bfad7de96a0c375a0c.zip
400779: [Table 2] Tabular Editor must allow to create elements with a Paste from an external speadsheet
https://bugs.eclipse.org/bugs/show_bug.cgi?id=400779
Diffstat (limited to 'sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java')
-rw-r--r--sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java111
1 files changed, 111 insertions, 0 deletions
diff --git a/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
new file mode 100644
index 00000000000..903ca5df9ea
--- /dev/null
+++ b/sandbox/pasteInNewTable/org.eclipse.papyrus.infra.nattable/src/org/eclipse/papyrus/infra/nattable/celleditor/config/AbstractCellEditorConfigurationFactory.java
@@ -0,0 +1,111 @@
+/*****************************************************************************
+ * 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.nattable.celleditor.config;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+
+/**
+ *
+ * The abstract class to used for CellEditorFactory
+ *
+ */
+public abstract class AbstractCellEditorConfigurationFactory {
+
+ /**
+ * the id of the factory
+ */
+ private String id;
+
+ /**
+ * the id of the extension point used to register contribution
+ */
+ public static final String EXTENSION_ID = "org.eclipse.papyrus.infra.nattable.celleditor.configuration"; //$NON-NLS-1$
+
+ public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$
+
+ public static final String FACTORY_ID_ATTRIBUTE = "factoryId"; //$NON-NLS-1$
+
+ public static final String ORDER_ATTRIBUTE = "order"; //$NON-NLS-1$
+
+ /**
+ *
+ * @param id
+ * the id of the factory
+ */
+ public void initFactory(String id) {
+ this.id = id;
+ }
+
+ /**
+ *
+ * @return
+ * the id of the factory
+ */
+ public final String getFactoryId() {
+ return this.id;
+ }
+
+ /**
+ *
+ * @return
+ * the registered element for this factory
+ */
+ public Collection<IConfigurationElement> getAllRegisteredCellEditorConfiguration() {
+ Collection<IConfigurationElement> elements = new ArrayList<IConfigurationElement>();
+ final IConfigurationElement[] configElements = Platform.getExtensionRegistry().getConfigurationElementsFor(EXTENSION_ID);
+ for(final IConfigurationElement iConfigurationElement : configElements) {
+ final String current = iConfigurationElement.getAttribute(FACTORY_ID_ATTRIBUTE);
+ if(current.equals(this.id)) {
+ elements.add(iConfigurationElement);
+ }
+ }
+ return elements;
+ }
+
+ /**
+ *
+ * @param editorId
+ * the editor id
+ * @return
+ * the configuration for this editor or <code>null</code> if the editor is not registered in this factory
+ */
+ public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(final String editorId);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * an eobject
+ * @return
+ * <code>true</code> if this factory allows to edit the object for this table
+ */
+ public abstract boolean handles(final Table table, final Object axisElement);
+
+ /**
+ *
+ * @param table
+ * the table
+ * @param axisElement
+ * an eobject
+ * @return
+ * the cell editor configuration for the couple table - axisElement
+ */
+ public abstract IAxisCellEditorConfiguration getCellEditorConfiguration(Table table, final Object axisElement);
+}

Back to the top