IPath pluginPath = FindBugsWorker.getFilterPath(idOrPath, null);
URI uri = pluginPath.toFile().toURI();
customPlugins.add(uri);
ValidationStatus status = validator.validate(pluginPath.toOSString());
PathElement element = new PathElement(pluginPath, status);
Plugin plugin = Plugin.getByPluginId(status.getSummary().id);
if(plugin != null && !uri.equals(plugin.getPluginLoader().getURI())) {
// disable contribution if the plugin is already there
// but loaded from different location
element.setEnabled(false);
} else {
element.setEnabled(entry.getValue().booleanValue());
}
newPaths.add(element);
}
Map<URI, Plugin> allPlugins = Plugin.getAllPluginsMap();
// List of plugins contributed by Eclipse
SortedMap<String, String> contributedDetectors = DetectorsExtensionHelper.getContributedDetectors();
for (Entry<String, String> entry : contributedDetectors.entrySet()) {
String pluginId = entry.getKey();
URI uri = new Path(entry.getValue()).toFile().toURI();
Plugin plugin = allPlugins.get(uri);
if(plugin != null && !isEclipsePluginDisabled(pluginId, allPlugins)) {
PluginElement element = new PluginElement(plugin, true);
newPaths.add(0, element);
customPlugins.add(uri);
}
}
// Remaining plugins contributed by FB itself
for (Plugin plugin : allPlugins.values()) {
PluginElement element = new PluginElement(plugin, false);
if(!customPlugins.contains(plugin.getPluginLoader().getURI())) {
newPaths.add(0, element);
if(disabledSystemPlugins.contains(plugin.getPluginId())) {
element.setEnabled(false);
}
}
}
return newPaths;