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

Difference between revisions of "FAQ How do I find all the plug-ins that contribute to my extension point?"

 
Line 22: Line 22:
 
an executable extension using the value of the <tt>class</tt> property.
 
an executable extension using the value of the <tt>class</tt> property.
 
We save all the executable extensions in an array list and return it.
 
We save all the executable extensions in an array list and return it.
 +
 +
<hr><font size=-2>This FAQ was originally published in [http://www.eclipsefaq.org Official Eclipse 3.0 FAQs]. Copyright 2004, Pearson Education, Inc. All rights reserved. This text is made available here under the terms of the [http://www.eclipse.org/legal/epl-v10.html Eclipse Public License v1.0].</font>

Revision as of 16:13, 14 March 2006

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.

Back to the top