Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/build.properties16
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml18
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/Activator.java142
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/EStructuralFeatureEditorConfig.java588
-rwxr-xr-xplugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleEEnumTypeCellEditorConfiguration.java240
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/dataprovider/EEnumComboBoxDataProvider.java156
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/Messages.java64
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/messages.properties4
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/registry/EStructuralFeatureImageRegistry.java204
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/selection/EObjectSelectionExtractor.java70
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java92
11 files changed, 797 insertions, 797 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/build.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/build.properties
index feffce05748..7d9a2cfe64c 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/build.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/build.properties
@@ -1,8 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- about.html,\
- icons/
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ about.html,\
+ icons/
+src.includes = about.html
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
index 81e484a7839..3609eaf91ea 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/pom.xml
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
- <groupId>org.eclipse.papyrus</groupId>
- <version>0.0.1-SNAPSHOT</version>
- </parent>
- <artifactId>org.eclipse.papyrus.infra.emf.nattable</artifactId>
- <version>4.0.0-SNAPSHOT</version>
- <packaging>eclipse-plugin</packaging>
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>org.eclipse.papyrus.infra-nattable</artifactId>
+ <groupId>org.eclipse.papyrus</groupId>
+ <version>0.0.1-SNAPSHOT</version>
+ </parent>
+ <artifactId>org.eclipse.papyrus.infra.emf.nattable</artifactId>
+ <version>4.0.0-SNAPSHOT</version>
+ <packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/Activator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/Activator.java
index 1e9ba5fb6b4..3ada05b8a3b 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/Activator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/Activator.java
@@ -1,71 +1,71 @@
-/*****************************************************************************
- * 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.emf.nattable;
-
-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.emf.nattable"; //$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(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- log = new LogHelper(this);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- @Override
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
-}
+/*****************************************************************************
+ * 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.emf.nattable;
+
+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.emf.nattable"; //$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(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ log = new LogHelper(this);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/EStructuralFeatureEditorConfig.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/EStructuralFeatureEditorConfig.java
index b376a3843ca..16d9047871d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/EStructuralFeatureEditorConfig.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/EStructuralFeatureEditorConfig.java
@@ -1,294 +1,294 @@
-/*****************************************************************************
- * 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.emf.nattable.celleditor.config;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
-import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
-import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
-import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ComboBoxPainter;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.celleditor.MultiLineTextCellEditorEx;
-import org.eclipse.papyrus.infra.nattable.celleditor.config.AbstractCellEditorConfiguration;
-import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.painter.CustomCheckBoxPainter;
-
-/**
- * The configuration to edit EMF properties
- *
- * @author Vincent Lorenzo
- * @deprecated Used just until Papyrus Luna. Replaced by classes that are specific to each type of cell editor in the package org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration
- *
- */
-@Deprecated
-public class EStructuralFeatureEditorConfig extends AbstractCellEditorConfiguration {
-
- /**
- * the id of the editor config
- */
- public static final String EDITOR_CONFIG_ID = "EMF_EDITOR"; //$NON-NLS-1$
-
- /**
- * the int used to identify the kind of editor
- */
- public static final int UNKNOWN_TYPE = -1;
-
- public static final int SINGLE_BOOLEAN = 1;
-
- public static final int MULTI_BOOLEAN = SINGLE_BOOLEAN + 1;
-
- public static final int SINGLE_STRING = MULTI_BOOLEAN + 1;
-
- public static final int MULTI_STRING = SINGLE_STRING + 1;
-
- public static final int SINGLE_INTEGER = MULTI_STRING + 1;
-
- public static final int MULTI_INTEGER = SINGLE_INTEGER + 1;
-
- public static final int SINGLE_EENUM_TYPE = MULTI_INTEGER + 1;
-
- public static final int MULTI_EENUM_TYPE = SINGLE_EENUM_TYPE + 1;
-
- public static final int SINGLE_EMF_REFERENCE = MULTI_EENUM_TYPE + 1;
-
- public static final int MULTI_EMF_REFERENCE = SINGLE_EMF_REFERENCE + 1;
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getICellEditor(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider)
- *
- * @param table
- * @param axisElement
- * @param elementProvider
- * @return
- */
- @Override
- public ICellEditor getICellEditor(Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
- int editorKind = getFeatureIdentifier(table, axisElement);
- ICellEditor editor = null;
- switch (editorKind) {
- case SINGLE_STRING:
- editor = new MultiLineTextCellEditorEx(true);
- break;
- case SINGLE_INTEGER:
- editor = new TextCellEditor();
- break;
- case SINGLE_BOOLEAN:
- editor = new CheckBoxCellEditor();
- break;
- case SINGLE_EENUM_TYPE:
- editor = new ComboBoxCellEditor(new EEnumComboBoxDataProvider((EEnum) ((EStructuralFeature) axisElement).getEType()));
- break;
- default:
- break;
- }
- return editor;
- }
-
-
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getEditorConfigId()
- *
- * @return
- */
- @Override
- public String getEditorConfigId() {
- return EDITOR_CONFIG_ID;
- }
-
- /**
- * Return the combo data provider. This method is not in the interface, because it can't be generalized to all editors. It is used only by
- * ComboBox
- *
- * @param table
- * the edited table
- * @param axisElement
- * the axis element
- * @param elementProvider
- * the element provider
- * @return
- * the combo data provider
- */
- protected IComboBoxDataProvider getComboDataProvider(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
- return null;
- }
-
- /**
- *
- * @param table
- * @param axisElement
- * @param provider
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDisplayConvert(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object, org.eclipse.jface.viewers.ILabelProvider)
- *
- * @return
- */
- @Override
- public IDisplayConverter getDisplayConvert(final Table table, final Object axisElement, final ILabelProvider provider) {
- int editorKind = getFeatureIdentifier(table, axisElement);
- IDisplayConverter displayConverter = null;
- switch (editorKind) {
- case SINGLE_BOOLEAN:
- displayConverter = new DefaultBooleanDisplayConverter();
- break;
- case SINGLE_INTEGER:
- displayConverter = new DefaultIntegerDisplayConverter();
- break;
- case SINGLE_EENUM_TYPE:
- displayConverter = new DisplayConverter() {
-
- @Override
- public Object displayToCanonicalValue(Object displayValue) {
- return null;
- }
-
- @Override
- public Object canonicalToDisplayValue(Object canonicalValue) {
- return provider.getText(canonicalValue);
- }
- };
- break;
- default:
- break;
- }
- return displayConverter;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getCellPainter(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
- *
- * @param table
- * @param axisElement
- * @return
- */
- @Override
- public ICellPainter getCellPainter(Table table, Object axisElement) {
- int editorKind = getFeatureIdentifier(table, axisElement);
- ICellPainter cellPainter = null;
- switch (editorKind) {
- case SINGLE_BOOLEAN:
- cellPainter = new CustomCheckBoxPainter();
- break;
- case SINGLE_EENUM_TYPE:
- cellPainter = new ComboBoxPainter();
- break;
- default:
- cellPainter = new TextPainter();// TODO : seems overriden by the CustomizedCellPainter... -> the result is correct, but our code is maybe incorrect
- break;
- }
- return cellPainter;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDisplayMode(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
- *
- * @param table
- * @param axisElement
- * @return
- */
- @Override
- public String getDisplayMode(Table table, Object axisElement) {
- int editorKind = getFeatureIdentifier(table, axisElement);
- String displayMode = DisplayMode.EDIT;
- switch (editorKind) {
- case SINGLE_BOOLEAN:
- displayMode = DisplayMode.NORMAL;
- break;
- default:
- break;
- }
- return displayMode;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.AbstractCellEditorConfiguration#getDataValidator(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
- *
- * @param table
- * @param axisElement
- * @return
- */
- @Override
- public IDataValidator getDataValidator(Table table, Object axisElement) {
- return null;
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
- *
- * @param table
- * @param axisElement
- * @return
- * <code>true</code> if axisElement is a {@link EStructuralFeature}
- */
- @Override
- public boolean handles(Table table, Object axisElement) {
- return axisElement instanceof EStructuralFeature;
- }
-
- /**
- *
- * @param table
- * the edited table
- * @param axisElement
- * the edited feature
- * @return
- * an integer which identify the type of the feature or {@value #UNKNOWN_TYPE} if we can't found it
- */
- protected int getFeatureIdentifier(final Table table, final Object axisElement) {
- int editorKind = UNKNOWN_TYPE;
- assert axisElement instanceof EStructuralFeature;
- final EStructuralFeature feature = (EStructuralFeature) axisElement;
- final EClassifier eType = feature.getEType();
- boolean isMany = feature.isMany();
- if (eType instanceof EEnum) {
- if (isMany) {
- editorKind = MULTI_EENUM_TYPE;
- } else {
- editorKind = SINGLE_EENUM_TYPE;
- }
- } else if (eType instanceof EDataType) {
-
- } else if (EMFHelper.isSuperType(EcorePackage.eINSTANCE.getEObject(), eType)) {
- if (isMany) {
- editorKind = MULTI_EMF_REFERENCE;
- } else {
- editorKind = SINGLE_EMF_REFERENCE;
- }
- }
- return editorKind;
- }
-}
+/*****************************************************************************
+ * 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.emf.nattable.celleditor.config;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.nebula.widgets.nattable.data.convert.DefaultBooleanDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.convert.DefaultIntegerDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.validate.IDataValidator;
+import org.eclipse.nebula.widgets.nattable.edit.editor.CheckBoxCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
+import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ComboBoxPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.nattable.celleditor.MultiLineTextCellEditorEx;
+import org.eclipse.papyrus.infra.nattable.celleditor.config.AbstractCellEditorConfiguration;
+import org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.painter.CustomCheckBoxPainter;
+
+/**
+ * The configuration to edit EMF properties
+ *
+ * @author Vincent Lorenzo
+ * @deprecated Used just until Papyrus Luna. Replaced by classes that are specific to each type of cell editor in the package org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration
+ *
+ */
+@Deprecated
+public class EStructuralFeatureEditorConfig extends AbstractCellEditorConfiguration {
+
+ /**
+ * the id of the editor config
+ */
+ public static final String EDITOR_CONFIG_ID = "EMF_EDITOR"; //$NON-NLS-1$
+
+ /**
+ * the int used to identify the kind of editor
+ */
+ public static final int UNKNOWN_TYPE = -1;
+
+ public static final int SINGLE_BOOLEAN = 1;
+
+ public static final int MULTI_BOOLEAN = SINGLE_BOOLEAN + 1;
+
+ public static final int SINGLE_STRING = MULTI_BOOLEAN + 1;
+
+ public static final int MULTI_STRING = SINGLE_STRING + 1;
+
+ public static final int SINGLE_INTEGER = MULTI_STRING + 1;
+
+ public static final int MULTI_INTEGER = SINGLE_INTEGER + 1;
+
+ public static final int SINGLE_EENUM_TYPE = MULTI_INTEGER + 1;
+
+ public static final int MULTI_EENUM_TYPE = SINGLE_EENUM_TYPE + 1;
+
+ public static final int SINGLE_EMF_REFERENCE = MULTI_EENUM_TYPE + 1;
+
+ public static final int MULTI_EMF_REFERENCE = SINGLE_EMF_REFERENCE + 1;
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getICellEditor(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object, org.eclipse.papyrus.infra.nattable.manager.table.ITableAxisElementProvider)
+ *
+ * @param table
+ * @param axisElement
+ * @param elementProvider
+ * @return
+ */
+ @Override
+ public ICellEditor getICellEditor(Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
+ int editorKind = getFeatureIdentifier(table, axisElement);
+ ICellEditor editor = null;
+ switch (editorKind) {
+ case SINGLE_STRING:
+ editor = new MultiLineTextCellEditorEx(true);
+ break;
+ case SINGLE_INTEGER:
+ editor = new TextCellEditor();
+ break;
+ case SINGLE_BOOLEAN:
+ editor = new CheckBoxCellEditor();
+ break;
+ case SINGLE_EENUM_TYPE:
+ editor = new ComboBoxCellEditor(new EEnumComboBoxDataProvider((EEnum) ((EStructuralFeature) axisElement).getEType()));
+ break;
+ default:
+ break;
+ }
+ return editor;
+ }
+
+
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getEditorConfigId()
+ *
+ * @return
+ */
+ @Override
+ public String getEditorConfigId() {
+ return EDITOR_CONFIG_ID;
+ }
+
+ /**
+ * Return the combo data provider. This method is not in the interface, because it can't be generalized to all editors. It is used only by
+ * ComboBox
+ *
+ * @param table
+ * the edited table
+ * @param axisElement
+ * the axis element
+ * @param elementProvider
+ * the element provider
+ * @return
+ * the combo data provider
+ */
+ protected IComboBoxDataProvider getComboDataProvider(final Table table, final Object axisElement, final ITableAxisElementProvider elementProvider) {
+ return null;
+ }
+
+ /**
+ *
+ * @param table
+ * @param axisElement
+ * @param provider
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDisplayConvert(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object, org.eclipse.jface.viewers.ILabelProvider)
+ *
+ * @return
+ */
+ @Override
+ public IDisplayConverter getDisplayConvert(final Table table, final Object axisElement, final ILabelProvider provider) {
+ int editorKind = getFeatureIdentifier(table, axisElement);
+ IDisplayConverter displayConverter = null;
+ switch (editorKind) {
+ case SINGLE_BOOLEAN:
+ displayConverter = new DefaultBooleanDisplayConverter();
+ break;
+ case SINGLE_INTEGER:
+ displayConverter = new DefaultIntegerDisplayConverter();
+ break;
+ case SINGLE_EENUM_TYPE:
+ displayConverter = new DisplayConverter() {
+
+ @Override
+ public Object displayToCanonicalValue(Object displayValue) {
+ return null;
+ }
+
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ return provider.getText(canonicalValue);
+ }
+ };
+ break;
+ default:
+ break;
+ }
+ return displayConverter;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getCellPainter(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ @Override
+ public ICellPainter getCellPainter(Table table, Object axisElement) {
+ int editorKind = getFeatureIdentifier(table, axisElement);
+ ICellPainter cellPainter = null;
+ switch (editorKind) {
+ case SINGLE_BOOLEAN:
+ cellPainter = new CustomCheckBoxPainter();
+ break;
+ case SINGLE_EENUM_TYPE:
+ cellPainter = new ComboBoxPainter();
+ break;
+ default:
+ cellPainter = new TextPainter();// TODO : seems overriden by the CustomizedCellPainter... -> the result is correct, but our code is maybe incorrect
+ break;
+ }
+ return cellPainter;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#getDisplayMode(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ @Override
+ public String getDisplayMode(Table table, Object axisElement) {
+ int editorKind = getFeatureIdentifier(table, axisElement);
+ String displayMode = DisplayMode.EDIT;
+ switch (editorKind) {
+ case SINGLE_BOOLEAN:
+ displayMode = DisplayMode.NORMAL;
+ break;
+ default:
+ break;
+ }
+ return displayMode;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.AbstractCellEditorConfiguration#getDataValidator(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ */
+ @Override
+ public IDataValidator getDataValidator(Table table, Object axisElement) {
+ return null;
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.IAxisCellEditorConfiguration#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ * <code>true</code> if axisElement is a {@link EStructuralFeature}
+ */
+ @Override
+ public boolean handles(Table table, Object axisElement) {
+ return axisElement instanceof EStructuralFeature;
+ }
+
+ /**
+ *
+ * @param table
+ * the edited table
+ * @param axisElement
+ * the edited feature
+ * @return
+ * an integer which identify the type of the feature or {@value #UNKNOWN_TYPE} if we can't found it
+ */
+ protected int getFeatureIdentifier(final Table table, final Object axisElement) {
+ int editorKind = UNKNOWN_TYPE;
+ assert axisElement instanceof EStructuralFeature;
+ final EStructuralFeature feature = (EStructuralFeature) axisElement;
+ final EClassifier eType = feature.getEType();
+ boolean isMany = feature.isMany();
+ if (eType instanceof EEnum) {
+ if (isMany) {
+ editorKind = MULTI_EENUM_TYPE;
+ } else {
+ editorKind = SINGLE_EENUM_TYPE;
+ }
+ } else if (eType instanceof EDataType) {
+
+ } else if (EMFHelper.isSuperType(EcorePackage.eINSTANCE.getEObject(), eType)) {
+ if (isMany) {
+ editorKind = MULTI_EMF_REFERENCE;
+ } else {
+ editorKind = SINGLE_EMF_REFERENCE;
+ }
+ }
+ return editorKind;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleEEnumTypeCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleEEnumTypeCellEditorConfiguration.java
index 7604f5b76bc..903732e4d00 100755
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleEEnumTypeCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleEEnumTypeCellEditorConfiguration.java
@@ -1,120 +1,120 @@
-/*****************************************************************************
- * Copyright (c) 2015 CEA LIST and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.emf.nattable.celleditor.config;
-
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
-import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
-import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
-import org.eclipse.nebula.widgets.nattable.painter.cell.ComboBoxPainter;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
-import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
-import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
-
-/**
- * @author MA244259
- *
- */
-public class SingleEEnumTypeCellEditorConfiguration implements ICellAxisConfiguration {
-
- /**
- * the id of this editor
- */
- private static final String ID = "org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.SingleEEnumTypeCellEditorConfiguration.ComboBox";//$NON-NLS-1$
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationId()
- *
- * @return
- */
- @Override
- public String getConfigurationId() {
- return ID;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationDescription()
- *
- * @return
- */
- @Override
- public String getConfigurationDescription() {
- return "This configuration provides a ComboBox editor for a single EEnum type"; //$NON-NLS-1$
- }
-
- /**
- *
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
- *
- * @param table
- * @param axisElement
- * @return
- * <code>true</code> if axisElement is a {@link EEnum} {@link EStructuralFeature}
- */
- @Override
- public boolean handles(Table table, Object axisElement) {
- Object representedElement = AxisUtils.getRepresentedElement(axisElement);
- if (representedElement instanceof EStructuralFeature) {
- EStructuralFeature feature = (EStructuralFeature) representedElement;
- if (!feature.isMany()) {
- EClassifier eType = feature.getEType();
- return eType instanceof EEnum;
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.ICellAxisEditorConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
- *
- * @param configRegistry
- * @param axis
- * @param configLabel
- */
- @Override
- public void configureCellEditor(final IConfigRegistry configRegistry, Object axis, String configLabel) {
- Object representedElement = AxisUtils.getRepresentedElement(axis);
- EEnum eenum = (EEnum) ((EStructuralFeature) representedElement).getEType();
-
- IDisplayConverter displayConverter = new DisplayConverter() {
-
- @Override
- public Object displayToCanonicalValue(Object displayValue) {
- return null;
- }
-
- @Override
- public Object canonicalToDisplayValue(Object canonicalValue) {
- // for others case
- // LabelProviderService service = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
- // return service.getLabelProvider(canonicalValue).getText(canonicalValue);
- //
-
- return new EMFLabelProvider().getText(canonicalValue);
- }
- };
-
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(), DisplayMode.NORMAL, configLabel);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new ComboBoxCellEditor(new EEnumComboBoxDataProvider(eenum)), DisplayMode.EDIT, configLabel);
- configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, displayConverter, DisplayMode.EDIT, configLabel);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2015 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.emf.nattable.celleditor.config;
+
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry;
+import org.eclipse.nebula.widgets.nattable.data.convert.DisplayConverter;
+import org.eclipse.nebula.widgets.nattable.data.convert.IDisplayConverter;
+import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.edit.editor.ComboBoxCellEditor;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ComboBoxPainter;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.emf.nattable.dataprovider.EEnumComboBoxDataProvider;
+import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
+import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider;
+
+/**
+ * @author MA244259
+ *
+ */
+public class SingleEEnumTypeCellEditorConfiguration implements ICellAxisConfiguration {
+
+ /**
+ * the id of this editor
+ */
+ private static final String ID = "org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.SingleEEnumTypeCellEditorConfiguration.ComboBox";//$NON-NLS-1$
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationId()
+ *
+ * @return
+ */
+ @Override
+ public String getConfigurationId() {
+ return ID;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.configuration.IPapyrusNatTableConfiguration#getConfigurationDescription()
+ *
+ * @return
+ */
+ @Override
+ public String getConfigurationDescription() {
+ return "This configuration provides a ComboBox editor for a single EEnum type"; //$NON-NLS-1$
+ }
+
+ /**
+ *
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#handles(org.eclipse.papyrus.infra.nattable.model.nattable.Table, java.lang.Object)
+ *
+ * @param table
+ * @param axisElement
+ * @return
+ * <code>true</code> if axisElement is a {@link EEnum} {@link EStructuralFeature}
+ */
+ @Override
+ public boolean handles(Table table, Object axisElement) {
+ Object representedElement = AxisUtils.getRepresentedElement(axisElement);
+ if (representedElement instanceof EStructuralFeature) {
+ EStructuralFeature feature = (EStructuralFeature) representedElement;
+ if (!feature.isMany()) {
+ EClassifier eType = feature.getEType();
+ return eType instanceof EEnum;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.ICellAxisEditorConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
+ *
+ * @param configRegistry
+ * @param axis
+ * @param configLabel
+ */
+ @Override
+ public void configureCellEditor(final IConfigRegistry configRegistry, Object axis, String configLabel) {
+ Object representedElement = AxisUtils.getRepresentedElement(axis);
+ EEnum eenum = (EEnum) ((EStructuralFeature) representedElement).getEType();
+
+ IDisplayConverter displayConverter = new DisplayConverter() {
+
+ @Override
+ public Object displayToCanonicalValue(Object displayValue) {
+ return null;
+ }
+
+ @Override
+ public Object canonicalToDisplayValue(Object canonicalValue) {
+ // for others case
+ // LabelProviderService service = configRegistry.getConfigAttribute(NattableConfigAttributes.LABEL_PROVIDER_SERVICE_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.LABEL_PROVIDER_SERVICE_ID);
+ // return service.getLabelProvider(canonicalValue).getText(canonicalValue);
+ //
+
+ return new EMFLabelProvider().getText(canonicalValue);
+ }
+ };
+
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new ComboBoxPainter(), DisplayMode.NORMAL, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new ComboBoxCellEditor(new EEnumComboBoxDataProvider(eenum)), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, displayConverter, DisplayMode.EDIT, configLabel);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/dataprovider/EEnumComboBoxDataProvider.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/dataprovider/EEnumComboBoxDataProvider.java
index 9063d135055..d49a98ae701 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/dataprovider/EEnumComboBoxDataProvider.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/dataprovider/EEnumComboBoxDataProvider.java
@@ -1,78 +1,78 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.emf.nattable.dataprovider;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.emf.ecore.EClassifier;
-import org.eclipse.emf.ecore.EEnum;
-import org.eclipse.emf.ecore.EEnumLiteral;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
-import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class EEnumComboBoxDataProvider implements IComboBoxDataProvider {
-
- /**
- * the enumeration for which we want the literals
- */
- private final EEnum eenum;
-
- /**
- *
- * Constructor.
- *
- * @param eenum
- * the enumeration for which we want the literals
- */
- public EEnumComboBoxDataProvider(EEnum eenum) {
- this.eenum = eenum;
- }
-
- /**
- * Constructor.
- *
- */
- public EEnumComboBoxDataProvider(Object axisElement) {
- Object object = AxisUtils.getRepresentedElement(axisElement);
- Assert.isTrue(object instanceof EStructuralFeature);
- EStructuralFeature feature = (EStructuralFeature) object;
- EClassifier type = feature.getEType();
- Assert.isTrue(type instanceof EEnum);
- this.eenum = (EEnum) type;
- }
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider#getValues(int, int)
- *
- * @param columnIndex
- * @param rowIndex
- * @return
- */
- @Override
- public List<?> getValues(int columnIndex, int rowIndex) {
- final List<Object> literals = new ArrayList<Object>();
- for (final EEnumLiteral instances : this.eenum.getELiterals()) {
- literals.add(instances.getInstance());
- }
- return literals;
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.emf.nattable.dataprovider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.emf.ecore.EClassifier;
+import org.eclipse.emf.ecore.EEnum;
+import org.eclipse.emf.ecore.EEnumLiteral;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider;
+import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class EEnumComboBoxDataProvider implements IComboBoxDataProvider {
+
+ /**
+ * the enumeration for which we want the literals
+ */
+ private final EEnum eenum;
+
+ /**
+ *
+ * Constructor.
+ *
+ * @param eenum
+ * the enumeration for which we want the literals
+ */
+ public EEnumComboBoxDataProvider(EEnum eenum) {
+ this.eenum = eenum;
+ }
+
+ /**
+ * Constructor.
+ *
+ */
+ public EEnumComboBoxDataProvider(Object axisElement) {
+ Object object = AxisUtils.getRepresentedElement(axisElement);
+ Assert.isTrue(object instanceof EStructuralFeature);
+ EStructuralFeature feature = (EStructuralFeature) object;
+ EClassifier type = feature.getEType();
+ Assert.isTrue(type instanceof EEnum);
+ this.eenum = (EEnum) type;
+ }
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.edit.editor.IComboBoxDataProvider#getValues(int, int)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @return
+ */
+ @Override
+ public List<?> getValues(int columnIndex, int rowIndex) {
+ final List<Object> literals = new ArrayList<Object>();
+ for (final EEnumLiteral instances : this.eenum.getELiterals()) {
+ literals.add(instances.getInstance());
+ }
+ return literals;
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/Messages.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/Messages.java
index 585b42423e1..b729cb82bcd 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/Messages.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/Messages.java
@@ -1,32 +1,32 @@
-/*****************************************************************************
- * 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.emf.nattable.messages;
-
-import org.eclipse.osgi.util.NLS;
-
-public class Messages extends NLS {
-
- private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.nattable.messages.messages"; //$NON-NLS-1$
-
- public static String EMFFeatureCellEditorFactory_SeveralCellEditorAreDeclaredWithTheSameId;
-
- public static String EMFFeatureCellEditorFactory_TheCellEditorProvidesANullCellId;
- static {
- // initialize resource bundle
- NLS.initializeMessages(BUNDLE_NAME, Messages.class);
- }
-
- private Messages() {
- }
-}
+/*****************************************************************************
+ * 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.emf.nattable.messages;
+
+import org.eclipse.osgi.util.NLS;
+
+public class Messages extends NLS {
+
+ private static final String BUNDLE_NAME = "org.eclipse.papyrus.infra.emf.nattable.messages.messages"; //$NON-NLS-1$
+
+ public static String EMFFeatureCellEditorFactory_SeveralCellEditorAreDeclaredWithTheSameId;
+
+ public static String EMFFeatureCellEditorFactory_TheCellEditorProvidesANullCellId;
+ static {
+ // initialize resource bundle
+ NLS.initializeMessages(BUNDLE_NAME, Messages.class);
+ }
+
+ private Messages() {
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/messages.properties b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/messages.properties
index ae225fa44d5..7e06d480538 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/messages.properties
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/messages/messages.properties
@@ -1,2 +1,2 @@
-EMFFeatureCellEditorFactory_SeveralCellEditorAreDeclaredWithTheSameId=Several Cell Editor configuration are declared with the same id {0}
-EMFFeatureCellEditorFactory_TheCellEditorProvidesANullCellId=The cell editor configuration {0} provides a null cellId
+EMFFeatureCellEditorFactory_SeveralCellEditorAreDeclaredWithTheSameId=Several Cell Editor configuration are declared with the same id {0}
+EMFFeatureCellEditorFactory_TheCellEditorProvidesANullCellId=The cell editor configuration {0} provides a null cellId
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/registry/EStructuralFeatureImageRegistry.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/registry/EStructuralFeatureImageRegistry.java
index 5c0b4d38ef7..45c47ee816d 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/registry/EStructuralFeatureImageRegistry.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/registry/EStructuralFeatureImageRegistry.java
@@ -1,102 +1,102 @@
-/*****************************************************************************
- * 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.emf.nattable.registry;
-
-import org.eclipse.papyrus.infra.widgets.Activator;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Image registry to use for EStructuralFeature
- */
-public class EStructuralFeatureImageRegistry {
-
- /** paths for emf feature icons */
- private static final String LINK_ICON_PATH = "/icons/link.gif"; //$NON-NLS-1$
-
- private static final String LINK_UNIDIR_ICON_PATH = "/icons/link_unidir.gif"; //$NON-NLS-1$
-
- private static final String AGGREG_ICON_PATH = "/icons/aggreg.gif"; //$NON-NLS-1$
-
- private static final String AGGREG_UNIDIR_ICON_PATH = "/icons/aggreg_unidir.gif"; //$NON-NLS-1$
-
- private static final String INV_AGGREG_ICON_PATH = "/icons/inv_aggreg.gif"; //$NON-NLS-1$
-
- private static final String ATTRIBUTE_ICON_PATH = "/icons/attributes.gif"; //$NON-NLS-1$
-
-
- /**
- *
- * @param path
- * a path
- * @return
- * the image loaded from this path
- */
- private static final Image getImage(final String path) {
- return Activator.getDefault().getImage(org.eclipse.papyrus.infra.emf.nattable.Activator.PLUGIN_ID, path);
- }
-
- /**
- *
- * @return
- * the icon for link
- */
- public static Image getLinkIcon() {
- return EStructuralFeatureImageRegistry.getImage(LINK_ICON_PATH);
- }
-
- /**
- *
- * @return
- * the icon for unidirectional link
- */
- public static Image getUnidirectionalLinkIcon() {
- return EStructuralFeatureImageRegistry.getImage(LINK_UNIDIR_ICON_PATH);
- }
-
- /**
- *
- * @return
- * the icon for aggregation
- */
- public static Image getInvAggregIcon() {
- return EStructuralFeatureImageRegistry.getImage(INV_AGGREG_ICON_PATH);
- }
-
- /**
- *
- * @return
- * the icon for aggregation
- */
- public static Image getAggregIcon() {
- return EStructuralFeatureImageRegistry.getImage(AGGREG_ICON_PATH);
- }
-
- /**
- *
- * @return
- * the icon for unidirectional aggregation
- */
- public static Image getUnidirectionalAggregIcon() {
- return EStructuralFeatureImageRegistry.getImage(AGGREG_UNIDIR_ICON_PATH);
- }
-
- /**
- *
- * @return
- * the attribute icon
- */
- public static Image getAttributeIcon() {
- return EStructuralFeatureImageRegistry.getImage(ATTRIBUTE_ICON_PATH);
- }
-}
+/*****************************************************************************
+ * 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.emf.nattable.registry;
+
+import org.eclipse.papyrus.infra.widgets.Activator;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Image registry to use for EStructuralFeature
+ */
+public class EStructuralFeatureImageRegistry {
+
+ /** paths for emf feature icons */
+ private static final String LINK_ICON_PATH = "/icons/link.gif"; //$NON-NLS-1$
+
+ private static final String LINK_UNIDIR_ICON_PATH = "/icons/link_unidir.gif"; //$NON-NLS-1$
+
+ private static final String AGGREG_ICON_PATH = "/icons/aggreg.gif"; //$NON-NLS-1$
+
+ private static final String AGGREG_UNIDIR_ICON_PATH = "/icons/aggreg_unidir.gif"; //$NON-NLS-1$
+
+ private static final String INV_AGGREG_ICON_PATH = "/icons/inv_aggreg.gif"; //$NON-NLS-1$
+
+ private static final String ATTRIBUTE_ICON_PATH = "/icons/attributes.gif"; //$NON-NLS-1$
+
+
+ /**
+ *
+ * @param path
+ * a path
+ * @return
+ * the image loaded from this path
+ */
+ private static final Image getImage(final String path) {
+ return Activator.getDefault().getImage(org.eclipse.papyrus.infra.emf.nattable.Activator.PLUGIN_ID, path);
+ }
+
+ /**
+ *
+ * @return
+ * the icon for link
+ */
+ public static Image getLinkIcon() {
+ return EStructuralFeatureImageRegistry.getImage(LINK_ICON_PATH);
+ }
+
+ /**
+ *
+ * @return
+ * the icon for unidirectional link
+ */
+ public static Image getUnidirectionalLinkIcon() {
+ return EStructuralFeatureImageRegistry.getImage(LINK_UNIDIR_ICON_PATH);
+ }
+
+ /**
+ *
+ * @return
+ * the icon for aggregation
+ */
+ public static Image getInvAggregIcon() {
+ return EStructuralFeatureImageRegistry.getImage(INV_AGGREG_ICON_PATH);
+ }
+
+ /**
+ *
+ * @return
+ * the icon for aggregation
+ */
+ public static Image getAggregIcon() {
+ return EStructuralFeatureImageRegistry.getImage(AGGREG_ICON_PATH);
+ }
+
+ /**
+ *
+ * @return
+ * the icon for unidirectional aggregation
+ */
+ public static Image getUnidirectionalAggregIcon() {
+ return EStructuralFeatureImageRegistry.getImage(AGGREG_UNIDIR_ICON_PATH);
+ }
+
+ /**
+ *
+ * @return
+ * the attribute icon
+ */
+ public static Image getAttributeIcon() {
+ return EStructuralFeatureImageRegistry.getImage(ATTRIBUTE_ICON_PATH);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/selection/EObjectSelectionExtractor.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/selection/EObjectSelectionExtractor.java
index 7657992918a..9ae74a6ca6f 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/selection/EObjectSelectionExtractor.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/selection/EObjectSelectionExtractor.java
@@ -1,35 +1,35 @@
-/*****************************************************************************
- * Copyright (c) 2014 CEA LIST and others.
- *
- * 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:
- * CEA LIST - Initial API and implementation
- *
- *****************************************************************************/
-
-package org.eclipse.papyrus.infra.emf.nattable.selection;
-
-import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
-import org.eclipse.papyrus.infra.nattable.selection.ObjectsSelectionExtractor;
-
-/**
- * @author Vincent Lorenzo
- *
- */
-public class EObjectSelectionExtractor extends ObjectsSelectionExtractor {
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.selection.ObjectsSelectionExtractor#getRealObject(java.lang.Object)
- *
- * @param object
- * @return
- */
- @Override
- protected Object getRealObject(Object object) {
- return EMFHelper.getEObject(object);
- }
-}
+/*****************************************************************************
+ * Copyright (c) 2014 CEA LIST and others.
+ *
+ * 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:
+ * CEA LIST - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.emf.nattable.selection;
+
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
+import org.eclipse.papyrus.infra.nattable.selection.ObjectsSelectionExtractor;
+
+/**
+ * @author Vincent Lorenzo
+ *
+ */
+public class EObjectSelectionExtractor extends ObjectsSelectionExtractor {
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.selection.ObjectsSelectionExtractor#getRealObject(java.lang.Object)
+ *
+ * @param object
+ * @return
+ */
+ @Override
+ protected Object getRealObject(Object object) {
+ return EMFHelper.getEObject(object);
+ }
+}
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java
index 2ec559ad55b..03e430c8100 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/validator/IntegerDataValidator.java
@@ -1,46 +1,46 @@
-/*****************************************************************************
- * 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.emf.nattable.validator;
-
-import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
-
-/**
- *
- * The Validator for Integer
- *
- */
-public class IntegerDataValidator extends DataValidator {
-
- /**
- *
- * @see org.eclipse.nebula.widgets.nattable.data.validate.DataValidator#validate(int, int, java.lang.Object)
- *
- * @param columnIndex
- * @param rowIndex
- * @param newValue
- * @return
- */
- @Override
- public boolean validate(int columnIndex, int rowIndex, Object newValue) {
- try {
- if (newValue != null) {
- new Integer(newValue.toString());
- }
- } catch (Exception e) {
- return false;
- }
- return true;
- }
-
-}
+/*****************************************************************************
+ * 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.emf.nattable.validator;
+
+import org.eclipse.nebula.widgets.nattable.data.validate.DataValidator;
+
+/**
+ *
+ * The Validator for Integer
+ *
+ */
+public class IntegerDataValidator extends DataValidator {
+
+ /**
+ *
+ * @see org.eclipse.nebula.widgets.nattable.data.validate.DataValidator#validate(int, int, java.lang.Object)
+ *
+ * @param columnIndex
+ * @param rowIndex
+ * @param newValue
+ * @return
+ */
+ @Override
+ public boolean validate(int columnIndex, int rowIndex, Object newValue) {
+ try {
+ if (newValue != null) {
+ new Integer(newValue.toString());
+ }
+ } catch (Exception e) {
+ return false;
+ }
+ return true;
+ }
+
+}

Back to the top