mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-22 06:02:11 +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:
parent
e172ddcbf1
commit
a6e6be0457
2 changed files with 15 additions and 32 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue