Reputation: 170745
I want to find all extensions of org.example.extension.point
declared in com.example.plugin
. Is there a more efficient way to do so than doing
List<IConfigurationElement> result = new ArrayList<IConfigurationElement>();
IConfigurationElement[] allConfigElements =
Platform.getExtensionRegistry.getConfigurationElementsFor("org.example.extension.point");
for (IConfigurationElement ice : allConfigElements) {
if (ice.getDeclaringExtension().getNamespaceIdentifier() == "com.example.plugin")
result.add(ice);
}
return result;
?
Upvotes: 0
Views: 747
Reputation: 9535
No there are no other (more efficient) ways (is this not simple enough?;). In addition I'd use ice.getContributor().getName()
instead of ice.getDeclaringExtension().getNamespaceIdentifier()
I really would like to know why you want to filter by a specific contributor. - I mean if you have to "know" the contributor why are you using the extension point? The main purpose of an extension point is using inversion of control; the main characteristic of using extension points is not knowing the contributor. No offense, but probably you are using extension points in a way they are not intended for...
Upvotes: 2