1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-22 14:12:10 +02:00

Bug 526421: Search the icon path from provided contribution

Signed-off-by: Julien Dehaudt <julien.dehaudt@st.com>
Change-Id: I7592a5df9b297f54184f754c7e3b0f8d79a6677c
This commit is contained in:
Julien Dehaudt 2021-06-11 17:19:55 +02:00 committed by Jonah Graham
parent e172ddcbf1
commit a6e6be0457
2 changed files with 15 additions and 32 deletions

View file

@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2 Bundle-ManifestVersion: 2
Bundle-Name: %pluginName Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.cdt.managedbuilder.core; singleton:=true 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-Activator: org.eclipse.cdt.managedbuilder.core.ManagedBuilderCorePlugin
Bundle-Vendor: %providerName Bundle-Vendor: %providerName
Bundle-Localization: plugin Bundle-Localization: plugin

View file

@ -126,6 +126,7 @@ import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IConfigurationElement; import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension; import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint; import org.eclipse.core.runtime.IExtensionPoint;
@ -2960,40 +2961,22 @@ public class ManagedBuildManager extends AbstractCExtension {
* plugin * plugin
*/ */
public static URL getURLInBuildDefinitions(DefaultManagedConfigElement element, IPath path) { public static URL getURLInBuildDefinitions(DefaultManagedConfigElement element, IPath path) {
IExtension extension = element.getExtension();
IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(EXTENSION_POINT_ID); if (extension != null) {
if (extensionPoint != null) { Bundle bundle = Platform.getBundle(extension.getContributor().getName());
IExtension[] extensions = extensionPoint.getExtensions(); URL url = FileLocator.find(bundle, path);
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) { if (url != null) {
try { try {
return Platform.asLocalURL(url); return FileLocator.toFileURL(url);
} catch (IOException e) { } catch (IOException e) {
// Ignore the exception // Ignore the exception
return null;
} }
} else { }
}
// Print a warning // Print a warning
outputIconError(path.toString()); outputIconError(path.toString());
}
}
}
}
}
return null; return null;
} }