diff options
author | Pierre-Charles David | 2016-01-21 16:00:25 +0000 |
---|---|---|
committer | Stephane Begaudeau | 2016-01-28 08:44:29 +0000 |
commit | 2d5f6afc4125743eaea5ad6c2045c296b95a5a0e (patch) | |
tree | 4c263b4af119d3f62635d869c4dbec311f684da0 /plugins | |
parent | 08333be9d80edbf1bf5bc3c6f8ea6d1b033033eb (diff) | |
download | org.eclipse.eef-2d5f6afc4125743eaea5ad6c2045c296b95a5a0e.tar.gz org.eclipse.eef-2d5f6afc4125743eaea5ad6c2045c296b95a5a0e.tar.xz org.eclipse.eef-2d5f6afc4125743eaea5ad6c2045c296b95a5a0e.zip |
[482528] Avoid CCE in LPSREL.processAddition
Not all ISections are AbstractPropertySection, which could cause
ClassCastExceptions in that method.
Unfortunately, some methods like getPart() are only defined in
AbstractPropertySection, not in ISection. EEFLegacySection needs this
method, so for now simply ignore other cases and do not create
EEFLegacySection.
Change-Id: I680f4020096c9d71ed285cc2fed75249a11edb37
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
Diffstat (limited to 'plugins')
2 files changed, 9 insertions, 6 deletions
diff --git a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionsRegistryEventListener.java b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionsRegistryEventListener.java index 37ac8541f..5d0c630e5 100644 --- a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionsRegistryEventListener.java +++ b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionsRegistryEventListener.java @@ -20,6 +20,7 @@ import org.eclipse.eef.properties.ui.legacy.internal.extension.AbstractRegistryE import org.eclipse.eef.properties.ui.legacy.internal.legacy2eef.EEFLegacySection; import org.eclipse.jface.viewers.IFilter; import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection; +import org.eclipse.ui.views.properties.tabbed.ISection; import org.eclipse.ui.views.properties.tabbed.ISectionDescriptor; /** @@ -156,11 +157,13 @@ public class LegacyPropertySectionsRegistryEventListener extends AbstractRegistr if (configurationElement.getAttribute(FILTER_ATTR) != null) { filter = (IFilter) configurationElement.createExecutableExtension(FILTER_ATTR); } - AbstractPropertySection sectionClass = (AbstractPropertySection) configurationElement.createExecutableExtension(CLASS_ATTR); - EEFLegacySection legacySection = new EEFLegacySection(sectionClass); - LegacyPropertySectionItemDescriptor legacySectionDescriptor = new LegacyPropertySectionItemDescriptor(tab, filter, legacySection, id, - enablesFor, afterSection); - this.propertySectionRegistry.add(legacySectionDescriptor); + ISection sectionClass = (ISection) configurationElement.createExecutableExtension(CLASS_ATTR); + if (sectionClass instanceof AbstractPropertySection) { + EEFLegacySection legacySection = new EEFLegacySection((AbstractPropertySection) sectionClass); + LegacyPropertySectionItemDescriptor legacySectionDescriptor = new LegacyPropertySectionItemDescriptor(tab, filter, legacySection, id, + enablesFor, afterSection); + this.propertySectionRegistry.add(legacySectionDescriptor); + } } catch (CoreException e) { String message = MessageFormat.format(Messages.RegistryEventListener_cannotInstantiateExtension, id); EEFPropertiesUiLegacyPlugin.getImplementation().logError(message, e); diff --git a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/legacy2eef/EEFLegacySection.java b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/legacy2eef/EEFLegacySection.java index 4997a8fb5..e3570a652 100644 --- a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/legacy2eef/EEFLegacySection.java +++ b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/legacy2eef/EEFLegacySection.java @@ -29,7 +29,7 @@ public class EEFLegacySection extends AbstractEEFPropertySection { /** * The legacy section. */ - AbstractPropertySection legacySection; + private AbstractPropertySection legacySection; /** * The constructor. |