[537506] Filter the sections of a tab using the contributor id Sections were used in tabs without regard to their contributors id Bug: https://bugs.eclipse.org/bugs/show_bug.cgi?id=537506 Change-Id: I96541937b89e7799442737ef804a3164a930ab4b Signed-off-by: Axel Richard <axel.richard@obeo.fr>
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 5b68954..5df97fb 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
@@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2015 Obeo. + * Copyright (c) 2015, 2018 Obeo. * 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 @@ -13,6 +13,7 @@ import java.text.MessageFormat; import java.util.ArrayList; import java.util.List; +import java.util.Optional; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IConfigurationElement; @@ -207,4 +208,20 @@ } return inputTypes; } + + /** + * Get the contributor Id of the section. + * + * @return the contributor Id of the section, or <code>null</code> if it doesn't exist. + */ + public String getContributionId() { + // @formatter:off + return Optional.ofNullable(this.configurationElement) + .map(IConfigurationElement::getParent) + .filter(IConfigurationElement.class::isInstance) + .map(IConfigurationElement.class::cast) + .map(element -> element.getAttribute(LegacyPropertySectionsRegistryEventListener.CONTRIBUTOR_ID_ATTR)) + .orElse(null); + // @formatter:on + } }
diff --git a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionRegistry.java b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionRegistry.java index 4887934..d7d7190 100644 --- a/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionRegistry.java +++ b/plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionRegistry.java
@@ -86,9 +86,14 @@ for (IItemDescriptor itemDescriptor : values) { if (itemDescriptor instanceof IEEFSectionDescriptor) { + String legacyContributorId = null; + if (itemDescriptor instanceof LegacyPropertySectionItemDescriptor) { + legacyContributorId = ((LegacyPropertySectionItemDescriptor) itemDescriptor).getContributionId(); + } String tab = ((IEEFSectionDescriptor) itemDescriptor).getTargetTab(); String sectionTargetTabId = tab; - if (tabId.equals(sectionTargetTabId)) { + if (((legacyContributorId != null && legacyContributorId.equals(contributorId)) || legacyContributorId == null) + && tabId.equals(sectionTargetTabId)) { String key = sectionTargetTabId + itemDescriptor.getId(); eefSectionDescriptors.put(key, (IEEFSectionDescriptor) itemDescriptor); }