diff options
author | Stéphane Bégaudeau | 2016-03-29 13:58:14 +0000 |
---|---|---|
committer | Stéphane Bégaudeau | 2016-03-29 15:05:33 +0000 |
commit | 2e175ceebd200bd8ef2689f9714f6c34369dc475 (patch) | |
tree | 4f6ba345326006843dc02b385c4c4ec8ab6061e1 /plugins | |
parent | ebf6266c353bf4d43a0942932be0d07063350711 (diff) | |
download | org.eclipse.eef-2e175ceebd200bd8ef2689f9714f6c34369dc475.tar.gz org.eclipse.eef-2e175ceebd200bd8ef2689f9714f6c34369dc475.tar.xz org.eclipse.eef-2e175ceebd200bd8ef2689f9714f6c34369dc475.zip |
[489302] IllegalArgumentException when selecting the "Rulers and Grids"
legacy GMF tab
Change-Id: I8e366eb539268f39b048b1a74234ef3e170a6d26
Signed-off-by: Stéphane Bégaudeau <stephane.begaudeau@obeo.fr>
Diffstat (limited to 'plugins')
3 files changed, 30 insertions, 18 deletions
diff --git a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionItemDescriptor.java b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionItemDescriptor.java index 01a863129..3e7e65731 100644 --- a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionItemDescriptor.java +++ b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionItemDescriptor.java @@ -10,10 +10,16 @@ *******************************************************************************/ package org.eclipse.eef.properties.ui.legacy.internal.extension.impl; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.eef.properties.ui.api.AbstractEEFSectionDescriptor; import org.eclipse.eef.properties.ui.api.IEEFSection; +import org.eclipse.eef.properties.ui.legacy.internal.EEFPropertiesUiLegacyPlugin; import org.eclipse.eef.properties.ui.legacy.internal.extension.IItemDescriptor; +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; /** * The property section descriptor. @@ -38,9 +44,9 @@ public class LegacyPropertySectionItemDescriptor extends AbstractEEFSectionDescr private IFilter filter; /** - * The EEF section. + * The configuration element used to create the section. */ - private IEEFSection eefSection; + private IConfigurationElement configurationElement; /** * The enablesFor. @@ -59,8 +65,8 @@ public class LegacyPropertySectionItemDescriptor extends AbstractEEFSectionDescr * The parent tab * @param filter * The filter - * @param eefSection - * The EEF section + * @param configurationElement + * The configuration element used to create the section * @param id * The id * @param afterSection @@ -68,10 +74,11 @@ public class LegacyPropertySectionItemDescriptor extends AbstractEEFSectionDescr * @param enablesFor * The enablesFor */ - public LegacyPropertySectionItemDescriptor(String tab, IFilter filter, IEEFSection eefSection, String id, int enablesFor, String afterSection) { + public LegacyPropertySectionItemDescriptor(String tab, IFilter filter, IConfigurationElement configurationElement, String id, int enablesFor, + String afterSection) { this.tab = tab; this.filter = filter; - this.eefSection = eefSection; + this.configurationElement = configurationElement; this.id = id; this.enablesFor = enablesFor; this.afterSection = afterSection; @@ -94,7 +101,16 @@ public class LegacyPropertySectionItemDescriptor extends AbstractEEFSectionDescr */ @Override public IEEFSection getSectionClass() { - return this.eefSection; + try { + ISection sectionClass = (ISection) configurationElement.createExecutableExtension(LegacyPropertySectionsRegistryEventListener.CLASS_ATTR); + if (sectionClass instanceof AbstractPropertySection) { + EEFLegacySection legacySection = new EEFLegacySection((AbstractPropertySection) sectionClass); + return legacySection; + } + } catch (CoreException e) { + EEFPropertiesUiLegacyPlugin.getImplementation().logError(e.getMessage(), e); + } + return null; } /** 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 5d0c630e5..07eb4e62c 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 @@ -17,10 +17,7 @@ import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.eef.properties.ui.legacy.Messages; import org.eclipse.eef.properties.ui.legacy.internal.EEFPropertiesUiLegacyPlugin; import org.eclipse.eef.properties.ui.legacy.internal.extension.AbstractRegistryEventListener; -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; /** @@ -157,13 +154,9 @@ public class LegacyPropertySectionsRegistryEventListener extends AbstractRegistr if (configurationElement.getAttribute(FILTER_ATTR) != null) { filter = (IFilter) configurationElement.createExecutableExtension(FILTER_ATTR); } - 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); - } + LegacyPropertySectionItemDescriptor legacySectionDescriptor = new LegacyPropertySectionItemDescriptor(tab, filter, + configurationElement, 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/src/org/eclipse/eef/properties/ui/api/AbstractEEFTabDescriptor.java b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/AbstractEEFTabDescriptor.java index cd63725ae..48171d08b 100644 --- a/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/AbstractEEFTabDescriptor.java +++ b/plugins/org.eclipse.eef.properties.ui/src/org/eclipse/eef/properties/ui/api/AbstractEEFTabDescriptor.java @@ -59,7 +59,10 @@ public abstract class AbstractEEFTabDescriptor implements IEEFTabDescriptor, Clo public EEFTabContents createTab() { List<IEEFSection> sections = new ArrayList<IEEFSection>(getSectionDescriptors().size()); for (IEEFSectionDescriptor sectionDescriptor : this.sectionDescriptors) { - sections.add(sectionDescriptor.getSectionClass()); + IEEFSection section = sectionDescriptor.getSectionClass(); + if (section != null) { + sections.add(section); + } } EEFTabContents tab = new EEFTabContents(sections); return tab; |