diff options
| author | Christian W. Damus | 2017-05-31 20:39:37 +0000 |
|---|---|---|
| committer | Christian W. Damus | 2017-05-31 20:41:02 +0000 |
| commit | 874fe058fb4d5c4a4e20e042fd94e8b4e1f9ce02 (patch) | |
| tree | 5d60ea702876176dfeed5e33476d4741d824d7fe | |
| parent | f46a35911ea168db2940d22f95f7ac40ccc49752 (diff) | |
| download | org.eclipse.papyrus-rt-874fe058fb4d5c4a4e20e042fd94e8b4e1f9ce02.tar.gz org.eclipse.papyrus-rt-874fe058fb4d5c4a4e20e042fd94e8b4e1f9ce02.tar.xz org.eclipse.papyrus-rt-874fe058fb4d5c4a4e20e042fd94e8b4e1f9ce02.zip | |
Bug 509262: [Tooling] Regression regarding the display of '*' in parameter table for untyped protocol message parameter
Override the UML cell-editor configuration registration that in
Oxygen uses the new extension API instead of the old as was
the case in Neon. And while we're at it, fix the regression
in display of '*' for untyped parameters.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=509262
Change-Id: I33c3644f0eaf1e29c45a1f5c769533e91e4c0898
2 files changed, 79 insertions, 4 deletions
diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/plugin.xml b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/plugin.xml index c1fbb8b38..a4336c005 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/plugin.xml +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/plugin.xml @@ -24,10 +24,10 @@ </extension> <extension point="org.eclipse.papyrus.infra.nattable.celleditor.configuration"> - <configuration + <cellAxisConfiguration class="org.eclipse.papyrusrt.umlrt.tooling.tables.configurations.ParameterTypeCellEditorConfiguration" order="300"> - </configuration> + </cellAxisConfiguration> <cellAxisConfiguration class="org.eclipse.papyrusrt.umlrt.tooling.tables.configurations.TriggerNameCellEditorConfiguration" order="300"> diff --git a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/src/org/eclipse/papyrusrt/umlrt/tooling/tables/configurations/ParameterTypeCellEditorConfiguration.java b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/src/org/eclipse/papyrusrt/umlrt/tooling/tables/configurations/ParameterTypeCellEditorConfiguration.java index 26c4e8539..8cbcbe787 100644 --- a/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/src/org/eclipse/papyrusrt/umlrt/tooling/tables/configurations/ParameterTypeCellEditorConfiguration.java +++ b/plugins/umlrt/tooling/org.eclipse.papyrusrt.umlrt.tooling.tables/src/org/eclipse/papyrusrt/umlrt/tooling/tables/configurations/ParameterTypeCellEditorConfiguration.java @@ -8,7 +8,7 @@ * * Contributors: * Celine JANSSENS (ALL4TEC) celine.janssens@all4tec.net - Initial API and implementation - * Christian W. Damus - bugs 476984, 495157 + * Christian W. Damus - bugs 476984, 495157, 514536 * *****************************************************************************/ @@ -21,16 +21,27 @@ import org.eclipse.emf.ecore.EClassifier; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.EStructuralFeature; import org.eclipse.jface.viewers.ILabelProvider; +import org.eclipse.nebula.widgets.nattable.config.CellConfigAttributes; import org.eclipse.nebula.widgets.nattable.config.IConfigRegistry; 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.EditConfigAttributes; import org.eclipse.nebula.widgets.nattable.edit.editor.ICellEditor; import org.eclipse.nebula.widgets.nattable.edit.gui.AbstractDialogCellEditor; import org.eclipse.nebula.widgets.nattable.layer.cell.ILayerCell; +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.AbstractOpenDialogCellEditorButtonAction; import org.eclipse.papyrus.infra.nattable.celleditor.AbstractPapyrusStyledTextCellEditor; +import org.eclipse.papyrus.infra.nattable.celleditor.config.ICellAxisConfiguration; +import org.eclipse.papyrus.infra.nattable.manager.table.INattableModelManager; 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.CustomizedCellPainter; import org.eclipse.papyrus.infra.nattable.utils.CrossAxisWrapper; +import org.eclipse.papyrus.infra.nattable.utils.NattableConfigAttributes; +import org.eclipse.papyrus.infra.ui.emf.providers.EMFLabelProvider; import org.eclipse.papyrus.infra.widgets.util.INameResolutionHelper; import org.eclipse.papyrus.infra.widgets.util.IPapyrusConverter; import org.eclipse.papyrus.infra.widgets.util.ISetPapyrusConverter; @@ -51,7 +62,50 @@ import org.eclipse.uml2.uml.util.UMLUtil; * * Cell Editor Configuration for the Parameter Type in Papyrus RT. Parameter of RTMessage. */ -public class ParameterTypeCellEditorConfiguration extends UMLSingleReferenceTextualCellEditorWithButtonConfiguration { +public class ParameterTypeCellEditorConfiguration extends UMLSingleReferenceTextualCellEditorWithButtonConfiguration implements ICellAxisConfiguration { + + protected static final INattableModelManager getModelManager(IConfigRegistry fromRegistry) { + return fromRegistry.getConfigAttribute(NattableConfigAttributes.NATTABLE_MODEL_MANAGER_CONFIG_ATTRIBUTE, DisplayMode.NORMAL, NattableConfigAttributes.NATTABLE_MODEL_MANAGER_ID); + } + + @Override + public String getConfigurationDescription() { + return getEditorDescription(); + } + + @Override + public String getConfigurationId() { + return getEditorConfigId(); + } + + @Override + public void configureCellEditor(IConfigRegistry configRegistry, Object axis, String configLabel) { + final INattableModelManager modelManager = getModelManager(configRegistry); + final Table table = modelManager.getTable(); + + final String displayMode = getDisplayMode(table, axis); + + final ICellPainter painter = getCellPainter(table, axis); + final ICellEditor editor = getICellEditor(table, axis, modelManager.getTableAxisElementProvider()); + final IDisplayConverter converter = getDisplayConvert(table, axis, new EMFLabelProvider());// TODO : label provider + final IDataValidator validator = getDataValidator(table, axis); + + if (painter != null) { + configRegistry.registerConfigAttribute(CellConfigAttributes.CELL_PAINTER, painter, DisplayMode.NORMAL, configLabel); + } + + if (editor != null) { + configRegistry.registerConfigAttribute(EditConfigAttributes.CELL_EDITOR, editor, displayMode, configLabel); + } + + if (converter != null) { + configRegistry.registerConfigAttribute(CellConfigAttributes.DISPLAY_CONVERTER, converter, displayMode, configLabel); + } + + if (validator != null) { + configRegistry.registerConfigAttribute(EditConfigAttributes.DATA_VALIDATOR, validator, displayMode, configLabel); + } + } /** * {@inheritDoc} @@ -179,4 +233,25 @@ public class ParameterTypeCellEditorConfiguration extends UMLSingleReferenceText return new TypeConverter(); } + + @Override + public ICellPainter getCellPainter(Table table, Object axisElement) { + ICellPainter base = new CustomizedCellPainter() { + @Override + protected String convertDataType(ILayerCell cell, IConfigRegistry configRegistry) { + String result; + + Object parameterType = cell.getDataValue(); + if (parameterType == null) { + result = NoTypeForTypedElement_Label; + } else { + result = super.convertDataType(cell, configRegistry); + } + + return result; + } + }; + + return new PaddingDecorator(base, 3); + } } |
