Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2016-02-09 10:06:02 +0000
committerGerrit Code Review @ Eclipse.org2016-02-09 15:06:13 +0000
commitadd5530b1037779fe0c8a40ba2db902dfe4ad670 (patch)
tree9fe04ef34661dd3f0d44214058af3354e62e1ec7
parent9830c9ff67cd1f20b22a7fb634a3540737d07fc5 (diff)
downloadorg.eclipse.papyrus-add5530b1037779fe0c8a40ba2db902dfe4ad670.tar.gz
org.eclipse.papyrus-add5530b1037779fe0c8a40ba2db902dfe4ad670.tar.xz
org.eclipse.papyrus-add5530b1037779fe0c8a40ba2db902dfe4ad670.zip
Bug 487346: [Table] Cannot insert new lines in text cells
https://bugs.eclipse.org/bugs/show_bug.cgi?id=487346 Manage the single string as multi line editor -> The ALT + ENTER key allows to insert new line and ENTER allows to commit value Change-Id: I8b0e1452570ba7e55b3047e845e3fb7c0c43e336 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@all4tec.net>
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java197
1 files changed, 98 insertions, 99 deletions
diff --git a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
index 9086799d37d..c8063c28ff2 100644
--- a/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
+++ b/plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java
@@ -1,99 +1,98 @@
-/*****************************************************************************
- * 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.EDataType;
-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.DefaultIntegerDisplayConverter;
-import org.eclipse.nebula.widgets.nattable.edit.EditConfigAttributes;
-import org.eclipse.nebula.widgets.nattable.edit.editor.TextCellEditor;
-import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
-import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-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.tools.util.TypesConstants;
-
-/**
- * @author MA244259
- *
- */
-public class SingleStringCellEditorConfiguration implements ICellAxisConfiguration {
-
- /**
- * the id of this editor
- */
- private static final String ID = "org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.SingleStringCellEditorConfiguration.MultiLineText";//$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 multi-line text editor for a single String"; //$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
- */
- @Override
- public boolean handles(Table table, Object axisElement) {
- Object object = AxisUtils.getRepresentedElement(axisElement);
- if (object instanceof EStructuralFeature) {
- EStructuralFeature feature = (EStructuralFeature) object;
- if (!feature.isMany()) {
- EClassifier etype = feature.getEType();
- if (etype instanceof EDataType) {
- EDataType datatype = (EDataType) etype;
- return TypesConstants.STRING.equals(datatype.getName());
- }
- }
- }
- return false;
- }
-
- /**
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
- *
- * @param configRegistry
- * @param axis
- * @param configLabel
- */
- @Override
- public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.EDIT, configLabel);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new TextCellEditor(), DisplayMode.EDIT, configLabel);
- // I believe that we don't need converters because we are working with the standard type --String.
- // configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, null, 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.EDataType;
+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.edit.EditConfigAttributes;
+import org.eclipse.nebula.widgets.nattable.painter.cell.TextPainter;
+import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
+import org.eclipse.papyrus.infra.nattable.celleditor.MultiLineTextCellEditorEx;
+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.tools.util.TypesConstants;
+
+/**
+ * @author MA244259
+ *
+ */
+public class SingleStringCellEditorConfiguration implements ICellAxisConfiguration {
+
+ /**
+ * the id of this editor
+ */
+ private static final String ID = "org.eclipse.papyrus.infra.emf.nattable.celleditor.configuration.SingleStringCellEditorConfiguration.MultiLineText";//$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 multi-line text editor for a single String"; //$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
+ */
+ @Override
+ public boolean handles(Table table, Object axisElement) {
+ Object object = AxisUtils.getRepresentedElement(axisElement);
+ if (object instanceof EStructuralFeature) {
+ EStructuralFeature feature = (EStructuralFeature) object;
+ if (!feature.isMany()) {
+ EClassifier etype = feature.getEType();
+ if (etype instanceof EDataType) {
+ EDataType datatype = (EDataType) etype;
+ return TypesConstants.STRING.equals(datatype.getName());
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
+ *
+ * @param configRegistry
+ * @param axis
+ * @param configLabel
+ */
+ @Override
+ public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) {
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new TextPainter(), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new MultiLineTextCellEditorEx(true), DisplayMode.EDIT, configLabel);
+ // I believe that we don't need converters because we are working with the standard type --String.
+ // configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, null, DisplayMode.EDIT, configLabel);
+ }
+}

Back to the top