From a6e6be045795c47cbda57f995fecd101d5f4e01c Mon Sep 17 00:00:00 2001 From: Julien Dehaudt Date: Fri, 11 Jun 2021 17:19:55 +0200 Subject: [PATCH] Bug 526421: Search the icon path from provided contribution Signed-off-by: Julien Dehaudt Change-Id: I7592a5df9b297f54184f754c7e3b0f8d79a6677c --- .../META-INF/MANIFEST.MF | 2 +- .../core/ManagedBuildManager.java | 45 ++++++------------- 2 files changed, 15 insertions(+), 32 deletions(-) diff --git a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF index b1bec18d4b2..e0598f5f9fe 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF +++ b/build/org.eclipse.cdt.managedbuilder.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true -Bundle-Version: 9.3.0.qualifier +Bundle-Version: 9.3.100.qualifier Bundle-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin Bundle-Vendor: %providerName Bundle-Localization: plugin diff --git a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java index 5708e0d9904..ab494da8e7d 100644 --- a/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java +++ b/build/org.eclipse.cdt.managedbuilder.core/src/org/eclipse/cdt/managedbuilder/core/ManagedBuildManager.java @@ -126,6 +126,7 @@ import org.eclipse.core.resources.IncrementalProjectBuilder; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; +import org.eclipse.core.runtime.FileLocator; import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtensionPoint; @@ -2960,40 +2961,22 @@ public class ManagedBuildManager extends AbstractCExtension { * plugin */ public static URL getURLInBuildDefinitions(DefaultManagedConfigElement element, IPath path) { - - IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); - if (extensionPoint != null) { - IExtension[] extensions = extensionPoint.getExtensions(); - if (extensions != null) { - - // Iterate over all extensions that contribute to .buildDefinitions - for (IExtension extension : extensions) { - // Determine whether the configuration element that is - // associated with the path, is valid for the extension that - // we are currently processing. - // - // Note: If not done, icon file names would have to be unique - // across several plug-ins. - if (element.getExtension().getExtensionPointUniqueIdentifier() == extension - .getExtensionPointUniqueIdentifier()) { - // Get the path-name - Bundle bundle = Platform.getBundle(extension.getNamespace()); - URL url = Platform.find(bundle, path); - if (url != null) { - try { - return Platform.asLocalURL(url); - } catch (IOException e) { - // Ignore the exception - return null; - } - } else { - // Print a warning - outputIconError(path.toString()); - } - } + IExtension extension = element.getExtension(); + if (extension != null) { + Bundle bundle = Platform.getBundle(extension.getContributor().getName()); + URL url = FileLocator.find(bundle, path); + if (url != null) { + try { + return FileLocator.toFileURL(url); + } catch (IOException e) { + // Ignore the exception } } } + + // Print a warning + outputIconError(path.toString()); + return null; }