For example, I want to get all id's value of menus that contribute to the extension point: org.eclipse.ui.menus
I can retrieve it by using the API IExtensionRegistry
, IExtension
, but I need to iterate over the tree of IConfigurationElement
to get the id's value for each menu, which is not a pleasant thing to do.
Is there a better API in eclipse for doing this task?
The IExtensionRegistry
is the correct API for this.
The simplest call to get a simple array of all the extension point declarations is:
IExtensionRegistry registry = Platform.getExtensionRegistry();
IConfigurationElement[] elements = registry.getConfigurationElementsFor("org.eclipse.ui.menus");
The structure of the children of the main IConfigurationElement
depends on the individual extension point. You have to deal with that in your code.