Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas FAUVERGUE2017-04-24 16:26:18 +0000
committervincent lorenzo2017-05-18 09:29:26 +0000
commit0c5113e025f33352d3a9c41d43656d3a60d5d555 (patch)
tree657f57ea8142153f3b8a374f4a032a59b0ca3489 /plugins/infra/nattable
parent87e59afcb3ab0a3419e731c33530b41fa6bc2611 (diff)
downloadorg.eclipse.papyrus-0c5113e025f33352d3a9c41d43656d3a60d5d555.tar.gz
org.eclipse.papyrus-0c5113e025f33352d3a9c41d43656d3a60d5d555.tar.xz
org.eclipse.papyrus-0c5113e025f33352d3a9c41d43656d3a60d5d555.zip
Bug 515706: [Table][RichText] The RichText editor must be in agreement
with the preferences https://bugs.eclipse.org/bugs/show_bug.cgi?id=515706 - Move the RichText preferences into infra.ui instead of uml.diagram.common to use it in table. - Use the preferences into nattable editors. - Upgrade MANIFEST versions when needed. Change-Id: Iee4505223a8e2de23c91a4d46f25ed2627fa04b1 Signed-off-by: Nicolas FAUVERGUE <nicolas.fauvergue@cea.fr>
Diffstat (limited to 'plugins/infra/nattable')
-rw-r--r--plugins/infra/nattable/org.eclipse.papyrus.infra.emf.nattable/src/org/eclipse/papyrus/infra/emf/nattable/celleditor/config/SingleStringCellEditorConfiguration.java33
1 files changed, 29 insertions, 4 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 546ce326c7d..0b44f941c68 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
@@ -19,6 +19,8 @@ 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.edit.editor.ICellEditor;
+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.utils.EMFContants;
@@ -95,6 +97,21 @@ public class SingleStringCellEditorConfiguration implements ICellAxisConfigurati
*/
@Override
public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) {
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, getCellPainter(configRegistry, axis, configLabel), DisplayMode.EDIT, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, getCellEditor(configRegistry, axis, configLabel), 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);
+ }
+
+ /**
+ * This allows to get the cell painter to use for the table.
+ *
+ * @return The cell painter.
+ *
+ * @since 3.0
+ */
+ protected ICellPainter getCellPainter(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
+
final INattableModelManager nattableManager = configRegistry.getConfigAttribute(
NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE,
DisplayMode.NORMAL,
@@ -111,9 +128,17 @@ public class SingleStringCellEditorConfiguration implements ICellAxisConfigurati
// TODO: using wordWrapping when upgrade to the new NatTable version
// textPainter.setWordWrapping(true);
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, textPainter, DisplayMode.NORMAL, 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);
+ return textPainter;
+ }
+
+ /**
+ * This allows to get the cell editor to use for the table.
+ *
+ * @return The cell editor.
+ *
+ * @since 3.0
+ */
+ protected ICellEditor getCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
+ return new MultiLineTextCellEditorEx(true);
}
}

Back to the top