diff options
author | Nicolas FAUVERGUE | 2017-04-24 16:26:18 +0000 |
---|---|---|
committer | vincent lorenzo | 2017-05-18 09:29:26 +0000 |
commit | 0c5113e025f33352d3a9c41d43656d3a60d5d555 (patch) | |
tree | 657f57ea8142153f3b8a374f4a032a59b0ca3489 /plugins | |
parent | 87e59afcb3ab0a3419e731c33530b41fa6bc2611 (diff) | |
download | org.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')
17 files changed, 205 insertions, 36 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); } } diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/plugin.xml b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/plugin.xml index ff9af9bae91..63a17356b45 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/plugin.xml +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/plugin.xml @@ -543,6 +543,9 @@ <initializer class="org.eclipse.papyrus.infra.ui.internal.preferences.EditorPreferences$Initializer"> </initializer> + <initializer + class="org.eclipse.papyrus.infra.ui.preferences.RichtextPreferenceInitializer"> + </initializer> </extension> <extension point="org.eclipse.ui.preferencePages"> @@ -552,6 +555,12 @@ id="org.eclipse.papyrus.infra.core.editorPrefs" name="Editor"> </page> + <page + category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" + class="org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage" + id="org.eclipse.papyrus.infra.ui.RichtextPreferencePage" + name="Rich text"> + </page> </extension> <extension diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java index 1a5703ed215..fbab3fc2dbd 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/Messages.java @@ -38,6 +38,12 @@ public class Messages extends NLS { public static String AbstractStringValueConverter_TheStringValueXCantBeResolved; public static String AbstractStringValueConverter_TheStringXIsNotValidToCreateY; + + public static String RichtextPreferencePage_Description; + + public static String RichtextPreferencePage_FirstBooleanEditorName; + + public static String RichtextPreferencePage_SecondBooleanEditorName; static { // initialize resource bundle NLS.initializeMessages(BUNDLE_NAME, Messages.class); diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties index 845a45e10ab..315ef860135 100644 --- a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/messages/messages.properties @@ -8,3 +8,6 @@ AbstractStringValueConverter_SomeStringsCantBeResolvedToFindY=Some Strings can't AbstractStringValueConverter_TheFeatureXCantBeResolved=The feature {0} can't be resolved AbstractStringValueConverter_TheStringValueXCantBeResolved=The string value {0} can't be resolved AbstractStringValueConverter_TheStringXIsNotValidToCreateY=The String {0} is not valid to create {1} +RichtextPreferencePage_Description=Rich Text Preferences +RichtextPreferencePage_FirstBooleanEditorName=Use advanced rich text renderer (needs a reload of opened diagrams). Warning: may raise stability issues. +RichtextPreferencePage_SecondBooleanEditorName=Use advanced rich text editor diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferenceInitializer.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferenceInitializer.java new file mode 100644 index 00000000000..7a2f34a40ae --- /dev/null +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferenceInitializer.java @@ -0,0 +1,42 @@ +/***************************************************************************** + * Copyright (c) 2016 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: + * Shuai Li (CEA LIST) shuai.li@cea.fr - Initial API and implementation + *****************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences; + +import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; +import org.eclipse.jface.preference.IPreferenceStore; +import org.eclipse.papyrus.infra.ui.Activator; + + +/** + * This preference initializer initializes Stereotype strategy preferences + * + * @since 2.0 + */ +public class RichtextPreferenceInitializer extends AbstractPreferenceInitializer { + + /** + * Initialize default preferences + */ + @Override + public void initializeDefaultPreferences() { + IPreferenceStore store = getPreferenceStore(); + store.setDefault(RichtextPreferencePage.USE_HTML_RENDERER, false); + store.setDefault(RichtextPreferencePage.USE_CK_EDITOR, false); + } + + /** + * Get the preference store + */ + protected IPreferenceStore getPreferenceStore() { + return Activator.getDefault().getPreferenceStore(); + } +} diff --git a/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferencePage.java b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferencePage.java new file mode 100644 index 00000000000..10702ac9f12 --- /dev/null +++ b/plugins/infra/ui/org.eclipse.papyrus.infra.ui/src/org/eclipse/papyrus/infra/ui/preferences/RichtextPreferencePage.java @@ -0,0 +1,55 @@ +/******************************************************************************* + * Copyright (c) 2010 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: + * Shuai Li (CEA List) <shuai.li@cea.fr> - initial API and implementation + *******************************************************************************/ +package org.eclipse.papyrus.infra.ui.preferences; + +import org.eclipse.jface.preference.BooleanFieldEditor; +import org.eclipse.jface.preference.FieldEditorPreferencePage; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.messages.Messages; +import org.eclipse.ui.IWorkbench; +import org.eclipse.ui.IWorkbenchPreferencePage; + +/** + * Rich text preferences page to choose basic or advanced renderer + * + * @since 2.0 + */ +public class RichtextPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { + + public static final String USE_HTML_RENDERER = "useHtmlRenderer"; //$NON-NLS-1$ + public static final String USE_CK_EDITOR = "useCkEditor"; //$NON-NLS-1$ + + public RichtextPreferencePage() { + super(GRID); + setPreferenceStore(Activator.getDefault().getPreferenceStore()); + setDescription(Messages.RichtextPreferencePage_Description); + } + + /** + * Creates the field editors. + */ + @Override + public void createFieldEditors() { + addField(new BooleanFieldEditor(USE_HTML_RENDERER, Messages.RichtextPreferencePage_FirstBooleanEditorName, getFieldEditorParent())); + addField(new BooleanFieldEditor(USE_CK_EDITOR, Messages.RichtextPreferencePage_SecondBooleanEditorName, getFieldEditorParent())); + } + + /** + * Init. + * + * @param workbench + * the workbench + */ + @Override + public void init(IWorkbench workbench) { + } + +} diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml index a2c5a31a360..f8e452634cc 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/plugin.xml @@ -437,21 +437,12 @@ id="org.eclipse.papyrus.uml.diagram.common.StereotypePasteStrategyPreferencePage" name="Stereotype Strategy"> </page> - <page - category="org.eclipse.papyrus.infra.core.sasheditor.preferences.generalcategory" - class="org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferencePage" - id="org.eclipse.papyrus.uml.diagram.common.RichtextPreferencePage" - name="Rich text"> - </page> </extension> <extension point="org.eclipse.core.runtime.preferences"> <initializer class="org.eclipse.papyrus.uml.diagram.common.preferences.StereotypePasteStrategyPreferenceInitializer"> </initializer> - <initializer - class="org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferenceInitializer"> - </initializer> </extension> <extension point="org.eclipse.papyrus.infra.gmfdiag.canonical.strategies"> diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/HTMLCornerBentFigure.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/HTMLCornerBentFigure.java index 4c088b01269..08f75a0c771 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/HTMLCornerBentFigure.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/figure/node/HTMLCornerBentFigure.java @@ -37,9 +37,9 @@ import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.FontDescriptor; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.nebula.widgets.richtext.painter.ResourceHelper; +import org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage; import org.eclipse.papyrus.uml.diagram.common.Activator; import org.eclipse.papyrus.uml.diagram.common.parser.HTMLCleaner; -import org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferencePage; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; @@ -1127,7 +1127,7 @@ public class HTMLCornerBentFigure extends CornerBentFigure implements ILabelFigu private boolean useHtmlRenderer() { if (useHtmlRenderer == null) { useHtmlRenderer = false; - IPreferenceStore store = Activator.getDefault().getPreferenceStore(); + IPreferenceStore store = org.eclipse.papyrus.infra.ui.Activator.getDefault().getPreferenceStore(); if (store != null) { useHtmlRenderer = store.getBoolean(RichtextPreferencePage.USE_HTML_RENDERER); } diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferenceInitializer.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferenceInitializer.java index 7336eb29190..4884420983c 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferenceInitializer.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferenceInitializer.java @@ -18,7 +18,11 @@ import org.eclipse.papyrus.uml.diagram.common.Activator; /** * This preference initializer initializes Stereotype strategy preferences + * + * @deprecated since 3.0. Use {@link org.eclipse.papyrus.infra.ui.preferences.RichtextPreferenceInitializer} instead. + * */ +@Deprecated public class RichtextPreferenceInitializer extends AbstractPreferenceInitializer { /** diff --git a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferencePage.java b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferencePage.java index a833c30806b..108b182e177 100644 --- a/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferencePage.java +++ b/plugins/uml/diagram/org.eclipse.papyrus.uml.diagram.common/src/org/eclipse/papyrus/uml/diagram/common/preferences/RichtextPreferencePage.java @@ -18,8 +18,10 @@ import org.eclipse.ui.IWorkbenchPreferencePage; /** * Rich text preferences page to choose basic or advanced renderer + * + * @deprecated since 3.0. Use {@link org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage} instead. */ - +@Deprecated public class RichtextPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage { public static final String USE_HTML_RENDERER = "useHtmlRenderer"; 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 diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/CommentBodyWrapperEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/CommentBodyWrapperEditor.java index 2000d979b70..df6e1349a69 100644 --- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/CommentBodyWrapperEditor.java +++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties/src/org/eclipse/papyrus/uml/properties/widgets/CommentBodyWrapperEditor.java @@ -15,12 +15,11 @@ package org.eclipse.papyrus.uml.properties.widgets; import org.eclipse.core.databinding.validation.IValidator; import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.papyrus.infra.properties.ui.modelelement.DataSource; import org.eclipse.papyrus.infra.properties.ui.widgets.AbstractPropertyEditor; +import org.eclipse.papyrus.infra.ui.Activator; +import org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage; import org.eclipse.papyrus.infra.widgets.editors.AbstractEditor; -import org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferencePage; -import org.eclipse.papyrus.uml.properties.Activator; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; @@ -41,7 +40,7 @@ public class CommentBodyWrapperEditor extends AbstractPropertyEditor { * the style */ public CommentBodyWrapperEditor(Composite parent, int style) { - if (Platform.getPreferencesService().getBoolean("org.eclipse.papyrus.uml.diagram.common", RichtextPreferencePage.USE_CK_EDITOR, false, null)) { + if (Platform.getPreferencesService().getBoolean(Activator.PLUGIN_ID, RichtextPreferencePage.USE_CK_EDITOR, false, null)) { richTextEditor = new CommentBodyRichTextEditor(parent, style); normalEditor = null; } else { diff --git a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF index 3a0300b4d51..ce97c3f8870 100644 --- a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF +++ b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/META-INF/MANIFEST.MF @@ -17,7 +17,7 @@ Require-Bundle: org.eclipse.papyrus.infra.services.navigation;bundle-version="[3 org.eclipse.papyrus.uml.tools;bundle-version="[3.0.0,4.0.0)",
org.eclipse.papyrus.uml.documentation.profile;bundle-version="[1.2.0,2.0.0)",
org.eclipse.papyrus.uml.types.core;bundle-version="[3.0.0,4.0.0)",
- org.eclipse.papyrus.uml.diagram.common;bundle-version="[3.0.0,4.0.0)"
+ org.eclipse.papyrus.infra.ui;bundle-version="[2.0.0,3.0.0)"
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor
diff --git a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java index 33ebdfb4b0a..e4ad4d9fe9c 100644 --- a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java +++ b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/Activator.java @@ -17,8 +17,8 @@ import org.eclipse.core.runtime.Status; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.IPropertyChangeListener; +import org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage; import org.eclipse.papyrus.infra.ui.util.EditorHelper; -import org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferencePage; import org.eclipse.papyrus.views.documentation.preferences.DocumentationViewPreferences; import org.eclipse.papyrus.views.documentation.views.DocumentationView; import org.eclipse.ui.IViewPart; @@ -195,7 +195,7 @@ public class Activator extends AbstractUIPlugin { * Returns the 'UseRichText' preferences from uml.common */ public boolean getUseRichTextSetting() { - return org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getPreferenceStore().getBoolean(RichtextPreferencePage.USE_CK_EDITOR); + return org.eclipse.papyrus.infra.ui.Activator.getDefault().getPreferenceStore().getBoolean(RichtextPreferencePage.USE_CK_EDITOR); } /** diff --git a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/views/DocumentationView.java b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/views/DocumentationView.java index eac9db3f69b..79a5e859b17 100644 --- a/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/views/DocumentationView.java +++ b/plugins/views/documentation/org.eclipse.papyrus.views.documentation/src/org/eclipse/papyrus/views/documentation/views/DocumentationView.java @@ -43,8 +43,8 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.papyrus.infra.emf.gmf.command.GMFtoEMFCommandWrapper; import org.eclipse.papyrus.infra.properties.ui.widgets.TabbedPropertyTitle; import org.eclipse.papyrus.infra.services.labelprovider.service.impl.LabelProviderServiceImpl; +import org.eclipse.papyrus.infra.ui.preferences.RichtextPreferencePage; import org.eclipse.papyrus.infra.widgets.util.PapyrusSelectionService; -import org.eclipse.papyrus.uml.diagram.common.preferences.RichtextPreferencePage; import org.eclipse.papyrus.uml.tools.commands.ApplyStereotypeCommand; import org.eclipse.papyrus.uml.tools.utils.UMLUtil; import org.eclipse.papyrus.uml.types.core.commands.SetStereotypeValueCommand; @@ -195,7 +195,7 @@ public class DocumentationView extends ViewPart { */ IPropertyChangeListener richTextPreferenceListener = event -> { if (RichtextPreferencePage.USE_CK_EDITOR == event.getProperty()) { - useRichText = org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getPreferenceStore().getBoolean(RichtextPreferencePage.USE_CK_EDITOR); + useRichText = org.eclipse.papyrus.infra.ui.Activator.getDefault().getPreferenceStore().getBoolean(RichtextPreferencePage.USE_CK_EDITOR); if (useRichText) { if (null != richtextEditor && !richtextEditor.isDisposed()) { richtextEditor.setText(text); @@ -465,7 +465,7 @@ public class DocumentationView extends ViewPart { getViewSite().getPage().addPartListener(new SaveAtPartFocusLostListener()); // Add listener on richtext preference - org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getPreferenceStore().addPropertyChangeListener(richTextPreferenceListener); + org.eclipse.papyrus.infra.ui.Activator.getDefault().getPreferenceStore().addPropertyChangeListener(richTextPreferenceListener); } /** @@ -781,7 +781,7 @@ public class DocumentationView extends ViewPart { PapyrusSelectionService.getInstance().removeSelectionChangedListener(selectionChangeListener); } if (null != richTextPreferenceListener) { - org.eclipse.papyrus.uml.diagram.common.Activator.getDefault().getPreferenceStore().removePropertyChangeListener(richTextPreferenceListener); + org.eclipse.papyrus.infra.ui.Activator.getDefault().getPreferenceStore().removePropertyChangeListener(richTextPreferenceListener); } super.dispose(); } |