Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to get a plugin that is no dependency
How to get a plugin that is no dependency [message #1020464] Mon, 18 March 2013 08:39 Go to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Hi,
I have a problem.....I have two plugins....A and B. B knows A, which means in the manifest.mf A is entered as required bundle.

A does not know B and is not able to access plugin B....but A needs to get some translation from B using A.INSTANCE.getString("Some_localization", true);

Is there a way to get the B-Plugin-Instance during runtime ? Something like a plugin-registry or a mehtod the the the B-plugin by its String id ?

Thx
Re: How to get a plugin that is no dependency [message #1021485 is a reply to message #1020464] Wed, 20 March 2013 07:45 Go to previous messageGo to next message
Markus Jo is currently offline Markus JoFriend
Messages: 83
Registered: January 2012
Member
Hat keiner eine Idee ??? Kann mir auch kein Pro sagen "vergiss es, das geht nicht" ?
Re: Re: How to get a plugin that is no dependency [message #1022083 is a reply to message #1021485] Thu, 21 March 2013 08:57 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi Markus,

> Hat keiner eine Idee ??? Kann mir auch kein Pro sagen "vergiss es, das geht
nicht" ?
Don't get excited, we were pondering your question ;)

You want to look at OSGi services. This is an instance of an object that gets
registered in the OSGi service registry (read hashmap) with the interface
name as key.

You do it like this:

Make an interface in a model plugin: ITransalator. This plugin is known to A
and B. Then let B make an implementation of ITranslator and put it in the
service registry where A can pick it up. Simple and powerful.

You can use the OSGi class FrameworkUtil to register and get services from
the registry.

I have a little demo application that uses a different approach: dynamic
services [1].

You should study both: it is very cool.

Best regards,

Wim

[1] https://github.com/wimjongman/dynamic-services-demo
Previous Topic:Custom Search
Next Topic:How to change default double click on annotation action
Goto Forum:
  


Current Time: Thu Apr 25 06:04:31 GMT 2024

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

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

Back to the top