diff options
| author | Laurent Redor | 2015-05-13 16:11:54 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2015-05-14 11:06:25 +0000 |
| commit | cea378bd5d97851d3decfff5250841c00e601db3 (patch) | |
| tree | 09cc55ba1d150ab7e7e8cbcfca433c7b7832d7c0 | |
| parent | 147f277443e9facfb44944b239741c5250c4af95 (diff) | |
| download | org.eclipse.sirius-cea378bd5d97851d3decfff5250841c00e601db3.tar.gz org.eclipse.sirius-cea378bd5d97851d3decfff5250841c00e601db3.tar.xz org.eclipse.sirius-cea378bd5d97851d3decfff5250841c00e601db3.zip | |
[443675] Fix regression about abusive dirty
The case of null featureObject is now correctly handled in
setLabelWithFeatureValue method.
This commit also improves the getText method:
AdapterFactoryItemDelegator or ReflectiveItemProvider is instanciated
only when needed.
Bug: 443675
Change-Id: Icd188f048dfd6f7a0c98365c0c6e6d5ba72d688a
Signed-off-by: Laurent Redor <laurent.redor@obeo.fr>
| -rw-r--r-- | plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java index b2324dd86d..e64bae123d 100644 --- a/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java +++ b/plugins/org.eclipse.sirius.table/src/org/eclipse/sirius/table/business/internal/refresh/DTableElementSynchronizerSpec.java @@ -515,6 +515,12 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl label = featureObject.toString(); } init = true; + } else if (cell.getTarget().eClass().getEStructuralFeature(featureName) != null) { + // if the featureObject is null but the feature name exists, we + // consider blank string as text. + init = true; + } + if (init) { // We change the value only if it's different if (isDifferent(cell.getLabel(), label)) { cell.setLabel(label); @@ -1136,13 +1142,13 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl private String getText(final Object element) { String text = null; ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE); - AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory); IItemLabelProvider itemLabelProvider = (IItemLabelProvider) adapterFactory.adapt(element, IItemLabelProvider.class); - ReflectiveItemProvider reflectiveItemProvider = new ReflectiveItemProvider(adapterFactory); try { if (itemLabelProvider != null) { + AdapterFactoryItemDelegator adapterFactoryItemDelegator = new AdapterFactoryItemDelegator(adapterFactory); text = adapterFactoryItemDelegator.getText(element); } else { + ReflectiveItemProvider reflectiveItemProvider = new ReflectiveItemProvider(adapterFactory); text = reflectiveItemProvider.getText(element); } } finally { @@ -1156,5 +1162,4 @@ public class DTableElementSynchronizerSpec extends DTableElementSynchronizerImpl target.eUnset(feature); } } - } |
