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/uml/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/uml/nattable')
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/META-INF/MANIFEST.MF5
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/pom.xml2
-rw-r--r--plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/src/org/eclipse/papyrus/uml/nattable/richtext/celleditor/config/RichTextCellEditorConfiguration.java44
3 files changed, 42 insertions, 9 deletions
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/META-INF/MANIFEST.MF b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/META-INF/MANIFEST.MF
index 4274e7e6426..ff6b1887226 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/META-INF/MANIFEST.MF
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/META-INF/MANIFEST.MF
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Bundle-Vendor: %Bundle-Vendor
Bundle-ActivationPolicy: lazy
-Bundle-Version: 2.0.0.qualifier
+Bundle-Version: 2.1.0.qualifier
Bundle-Name: %Bundle-Name
Bundle-Localization: plugin
Bundle-Activator: org.eclipse.papyrus.uml.nattable.richtext.Activator
@@ -14,6 +14,7 @@ Require-Bundle: org.eclipse.papyrus.infra.core.log;bundle-version="[1.2.0,2.0.0)
org.eclipse.nebula.widgets.nattable.extension.nebula;bundle-version="[1.0.0,2.0.0)",
org.eclipse.nebula.widgets.richtext;bundle-version="[1.0.0,2.0.0)",
org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.ui;bundle-version="[1.2.0,2.0.0)"
+ org.eclipse.papyrus.uml.ui;bundle-version="[1.2.0,2.0.0)",
+ org.eclipse.papyrus.uml.nattable;bundle-version="[3.0.0,4.0.0)"
Export-Package: org.eclipse.papyrus.uml.nattable.richtext.celleditor.config
Bundle-Description: %Bundle-Description
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/pom.xml b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/pom.xml
index b40c1cee5ee..687669619f7 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/pom.xml
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/pom.xml
@@ -8,6 +8,6 @@
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.papyrus.uml.nattable.richtext</artifactId>
- <version>2.0.0-SNAPSHOT</version>
+ <version>2.1.0-SNAPSHOT</version>
<packaging>eclipse-plugin</packaging>
</project> \ No newline at end of file
diff --git a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/src/org/eclipse/papyrus/uml/nattable/richtext/celleditor/config/RichTextCellEditorConfiguration.java b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/src/org/eclipse/papyrus/uml/nattable/richtext/celleditor/config/RichTextCellEditorConfiguration.java
index 186c18dd038..c632f6b2fd1 100644
--- a/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/src/org/eclipse/papyrus/uml/nattable/richtext/celleditor/config/RichTextCellEditorConfiguration.java
+++ b/plugins/uml/nattable/org.eclipse.papyrus.uml.nattable.richtext/src/org/eclipse/papyrus/uml/nattable/richtext/celleditor/config/RichTextCellEditorConfiguration.java
@@ -14,16 +14,21 @@
package org.eclipse.papyrus.uml.nattable.richtext.celleditor.config;
import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.preference.IPreferenceStore;
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.extension.nebula.richtext.RichTextCellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.BackgroundPainter;
+import org.eclipse.nebula.widgets.nattable.painter.cell.ICellPainter;
import org.eclipse.nebula.widgets.nattable.painter.cell.decorator.PaddingDecorator;
import org.eclipse.nebula.widgets.nattable.style.DisplayMode;
-import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration;
+import org.eclipse.papyrus.infra.emf.nattable.celleditor.config.SingleStringCellEditorConfiguration;
import org.eclipse.papyrus.infra.nattable.model.nattable.Table;
import org.eclipse.papyrus.infra.nattable.utils.AxisUtils;
+import org.eclipse.papyrus.infra.ui.Activator;
+import org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage;
import org.eclipse.papyrus.uml.nattable.richtext.celleditor.RichTextCellEditorWithUMLReferences;
import org.eclipse.papyrus.uml.nattable.richtext.celleditor.config.messages.Messages;
import org.eclipse.uml2.uml.UMLPackage;
@@ -31,7 +36,7 @@ import org.eclipse.uml2.uml.UMLPackage;
/**
* This class provides the configuration to use to display and edit richtext in the table.
*/
-public class RichTextCellEditorConfiguration implements ICellAxisConfiguration {
+public class RichTextCellEditorConfiguration extends SingleStringCellEditorConfiguration {
/**
* the id of this editor.
@@ -74,16 +79,43 @@ public class RichTextCellEditorConfiguration implements ICellAxisConfiguration {
return result;
}
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.SingleStringCellEditorConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
+ */
+ @Override
+ public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) {
+ configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, getCellPainter(configRegistry, axis, configLabel), DisplayMode.NORMAL, configLabel);
+ configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, getCellEditor(configRegistry, axis, configLabel), DisplayMode.EDIT, configLabel);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.SingleStringCellEditorConfiguration#getCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
+ */
+ @Override
+ protected ICellEditor getCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ if (store.getBoolean(RichtextPreferencePage.USE_CK_EDITOR)) {
+ return new RichTextCellEditorWithUMLReferences();
+ }
+ return super.getCellEditor(configRegistry, axis, configLabel);
+ }
/**
* {@inheritDoc}
*
- * @see org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration#configureCellEditor(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
+ * @see org.eclipse.papyrus.infra.emf.nattable.celleditor.config.SingleStringCellEditorConfiguration#getCellPainter(org.eclipse.nebula.widgets.nattable.config.IConfigRegistry, java.lang.Object, java.lang.String)
*/
@Override
- public void configureCellEditor(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
- configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, new BackgroundPainter(new PaddingDecorator(new RichTextCellPainter(), 2, 5, 2, 5)), DisplayMode.NORMAL, configLabel);
- configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, new RichTextCellEditorWithUMLReferences(), DisplayMode.NORMAL, configLabel);
+ protected ICellPainter getCellPainter(final IConfigRegistry configRegistry, final Object axis, final String configLabel) {
+ final IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+ if (store.getBoolean(RichtextPreferencePage.USE_HTML_RENDERER)) {
+ return new BackgroundPainter(new PaddingDecorator(new RichTextCellPainter(), 2, 5, 2, 5));
+ }
+ return super.getCellPainter(configRegistry, axis, configLabel);
}
} \ No newline at end of file

Back to the top