Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » Extensions and Extension Points
Extensions and Extension Points [message #584291] Wed, 05 November 2008 10:57
Paul Richardson is currently offline Paul RichardsonFriend
Messages: 33
Registered: July 2009
Hi everybody,

I have recently moved from Netbeans RCP over to Eclipse RCP and was
wondering if someone could fill me in on a small but rather important
piece of information.

My application consists of several plugins each offering an additional
service to the user. The service framework offered in Netbeans allowed
for this in that I created an interface and implementation for some
functionality then offered up the implementation as a service. When the
module was loaded by Netbeans, the implementation instance was loaded
into a registry and I could get at it by looking it up.

I understand that the closest approximations to this functionality in
Eclipse is either OSGi services or extensions / extension points. I have
opted for the latter.

Plugin A offers extension point detailing a class that implements a
known interface.

Plugin B
When something happens (button pressed for example), I wish to get the
implementation conforming to the known interface. Currently, this is
what I do.

String extPointID = "skeleton.domainObject";

IExtensionPoint extPoint =
Platform.getExtensionRegistry().getExtensionPoint(extPointID );
if (extPoint == null)
return null;

IExtension[] extensions = extPoint.getExtensions();
for (int i = 0; i < extensions.length; ++i)
IConfigurationElement[] configElements =
for (int j = 0; j < configElements.length; j++)
IConfigurationElement element = configElements[j];
IDomainObject domain = (IDomainObject)
return domain.getInstance();
catch (Exception ex)
// Do something useful with this

As you see, I use "IConfigurationElement.createExecutableExtension" to
first create a class conforming to that denoted by the tag "class". Once
I have this class, I throw it away in favour of a singleton instance
that may or may not already have been created by Plugin A.

This process is very useful for creating a brand new class conforming to
the extension point. However, is there a simpler way of finding already
instantiated classes, in the vein of services. Does eclipse have a
registry of classes already instantiated by virtue of the plugins activated?

Is OSGi services the preferred way to go with this maybe?

Any help much appreciated.


Previous Topic:Stopping View from listening Key Sequence
Next Topic:headless build "forgets" native swt plugins for linux
Goto Forum:

Current Time: Sat Sep 25 16:31:25 GMT 2021

Powered by FUDForum. Page generated in 0.02057 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top