Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

FAQ How do I find all the plug-ins that contribute to my extension point?

Revision as of 12:35, 6 January 2008 by Softwitch.gmail.com (Talk | contribs) (Another way to get all IConfigurationElements)

Assuming that you used an element attribute named class to encode the name of the class that your contributors have to provide, you can obtain a list of all the plug-in classes that contribute to your extension point by using the following piece of code:

   IExtensionRegistry reg = Platform.getExtensionRegistry();
   IExtensionPoint ep = reg.getExtensionPoint(extensionID);
   IExtension[] extensions = ep.getExtensions();
   ArrayList contributors = new ArrayList();
   for (int i = 0; i < extensions.length; i++) {
      IExtension ext = extensions[i];
      IConfigurationElement[] ce = 
         ext.getConfigurationElements();
      for (int j = 0; j < ce.length; j++) {
         Object obj = ce[j].createExecutableExtension("class");
         contributors.add(obj);
      }
   }

From a given extension point, it is straightforward to get a list of extensions that contribute to it. For each extension, we create an executable extension using the value of the class property. We save all the executable extensions in an array list and return it.


This FAQ was originally published in Official Eclipse 3.0 FAQs. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the Eclipse Public License v1.0.

How to get all IConfigurationElement objects more simply?

You can also get all IConfigurationElement objects without retrieving each extension by using following code:

    IExtensionRegistry reg = Platform.getExtensionRegistry();
    IConfigurationElement[] elements = reg.getConfigurationElementsFor("Extension Point ID");

Back to the top