Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2018-08-02 09:01:59 +0000
committerSt├ęphane B├ęgaudeau2018-09-19 07:54:37 +0000
commitc4e8fd2e2b9fe293d44a5a019edda3f8dcadea88 (patch)
tree915a9e5e4d9dd9424ef5bc221fbb63e1c5c80c87
parentba60650e674ecc6cf071770cd9f59cceeb3569c2 (diff)
downloadorg.eclipse.eef-c4e8fd2e2b9fe293d44a5a019edda3f8dcadea88.tar.gz
org.eclipse.eef-c4e8fd2e2b9fe293d44a5a019edda3f8dcadea88.tar.xz
org.eclipse.eef-c4e8fd2e2b9fe293d44a5a019edda3f8dcadea88.zip
[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>
-rw-r--r--plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionItemDescriptor.java19
-rw-r--r--plugins/org.eclipse.eef.properties.ui.legacy/src/org/eclipse/eef/properties/ui/legacy/internal/extension/impl/LegacyPropertySectionRegistry.java7
2 files changed, 24 insertions, 2 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 5b68954f0..5df97fb27 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 @@ package org.eclipse.eef.properties.ui.legacy.internal.extension.impl;
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 @@ public class LegacyPropertySectionItemDescriptor extends AbstractEEFSectionDescr
}
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 488793464..d7d71903c 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 @@ public class LegacyPropertySectionRegistry implements IItemRegistry {
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);
}

Back to the top