Eclipse RCP Plugins Technical questions

N

Nuno

Hello,

I'm starting to implement a application using the Eclipse RCP
tecnology. I have some questions about some techinnal details.

My application will have resumdly three main pluggins:

------- ------- --------
| P1 | | P2 | | BP3 |
------- ------- --------

And the last pluggin is a base pluggin (BP3), i'm trying to be a base
pluggin that will have some extensions (extending the base
funcionality of the BP3 pluggin) like this:

------- ------- --------
| P1 | | P2 | | BP3 |
------- ------- --------
|
-------------------------------
| | |
------- ------- ------
| E1 | | E2 | | E3 |
------- ------- -------

My question is, this possible to be done, to have a base pluggin and
have more a set of other pluggins that extends the base pluggin
obtaining the functionality described in the base pluggin. If is
possible then how this is done? Exist any tutorial explaining this (if
yes please indicate) or if not please explain how this is acomplished.

My other problem is that i need to estabilish a comunication between
each pluggin (P1->P2 and P2->E1, P2->E2... and in the reverse order
too P2->P1...). How this is done? can i declare an interface in each
pluggin and then call it? but how i obtain a interface from the other
pluggin? how this is done? again is any tutorial explaining this? if
yes please indicate to me here it is or try to explain how this all
works.

Thanks
Nuno
 
C

Christian

Nuno said:
Hello,

I'm starting to implement a application using the Eclipse RCP
tecnology. I have some questions about some techinnal details.

My application will have resumdly three main pluggins:

------- ------- --------
| P1 | | P2 | | BP3 |
------- ------- --------

And the last pluggin is a base pluggin (BP3), i'm trying to be a base
pluggin that will have some extensions (extending the base
funcionality of the BP3 pluggin) like this:

------- ------- --------
| P1 | | P2 | | BP3 |
------- ------- --------
|
-------------------------------
| | |
------- ------- ------
| E1 | | E2 | | E3 |
------- ------- -------

My question is, this possible to be done, to have a base pluggin and
have more a set of other pluggins that extends the base pluggin
obtaining the functionality described in the base pluggin. If is
possible then how this is done? Exist any tutorial explaining this (if
yes please indicate) or if not please explain how this is acomplished.
how far you mean extend..
Plugins are more or less just bundles of ressources that may for example
include the implementation of an interface that was specified for the
extension point. So extending in a way like BP3 has somewhere lying
around an interface ICoolFunctionality E1 to E3 may imeplement this ,
then BP§ can instantiate them and call their cool functionality.

My other problem is that i need to estabilish a comunication between
each pluggin (P1->P2 and P2->E1, P2->E2... and in the reverse order
too P2->P1...). How this is done? can i declare an interface in each
pluggin and then call it? but how i obtain a interface from the other
pluggin? how this is done? again is any tutorial explaining this? if
yes please indicate to me here it is or try to explain how this all
works.

Even if you have 3 base plugins only one of them will be the one with
the main method (implementing IApplication) so when this plugin loads
the others, and it can provide them for example in an init method with
some interface for communication with the other classes. I think thats
the way to go.. just forget that those are plugins .. see the other
plugins as what they are.. a part of your program.. there is nothing
special about the plugins once they are loaded (besides them having a
different classloader)

christian
 
N

Nuno

Nuno schrieb:










how far you mean extend..
Plugins are more or less just bundles of ressources that may for example
include the implementation of an interface that was specified for the
extension point. So extending in a way like BP3 has somewhere lying
around an interface ICoolFunctionality E1 to E3 may imeplement this ,
then BP§ can instantiate them and call their cool functionality.


Even if you have 3 base plugins only one of them will be the one with
the main method (implementing IApplication) so when this plugin loads
the others, and it can provide them for example in an init method with
some interface for communication with the other classes. I think thats
the way to go.. just forget that those are plugins .. see the other
plugins as what they are.. a part of your program.. there is nothing
special about the plugins once they are loaded (besides them having a
different classloader)

christian- Ocultar texto citado -

- Mostrar texto citado -

Ok i understand that... "the other plugins as what they are.. a part
of your program.. there is nothing special about the plugins" but how
i call the functionality (interface) of that specific loaded instance
(plugin)... can you give a small example with source code? How i list
the available instance of plugins or how i know if all plugins were
loaded by the main app and are there to be accessed?

Another question, the other plugins are loaded automaticly by the main
pluggin or i have to write code to load each plugin? What i need is to
load all the E1, E2, E... plugins automaticly because these may grow
thrue time, implementing another specific functionality specified in
the BP3. That is why i need to know how many pluggins are loaded and
access the interface (declared in BP3) for each one. Again if you have
some code that explains this will be great, because i'm in the dark
and i can't get any tutorial explaining this.

Thanks for the attencion,
Nuno
 
C

Christian

Nuno said:
Ok i understand that... "the other plugins as what they are.. a part
of your program.. there is nothing special about the plugins" but how
i call the functionality (interface) of that specific loaded instance
(plugin)... can you give a small example with source code? How i list
the available instance of plugins or how i know if all plugins were
loaded by the main app and are there to be accessed?

in the main app you could use something like this:

private void loadTokenDescriptors() {
IExtensionRegistry reg = Platform.getExtensionRegistry();
IConfigurationElement[] configElements = reg
.getConfigurationElementsFor(ITokenDescriptor.ExtensionPointID);

for (IConfigurationElement element : configElements) {
try {
tokenDescriptors.put(element.getAttribute("id") ,
(ITokenDescriptor)element.createExecutableExtension("class")
);
} catch (CoreException ce) {
logger.warn("exception on initializing: "
+ element.getAttribute("name")
+ " ("+element.getAttribute("id")
+")", ce);
}
}
}

I load with this all classes that contribute to the extension point that
is specified by the String ITokenDescriptor.ExtensionPointID.
into a HashMap (tokenDescriptors).
element.getAttribute() is used to retrieve string attributes of the plugin
while createExecutableExtension() will instantiate a class with the
no-args constructor

hope this gives you a start..

Another question, the other plugins are loaded automaticly by the main
pluggin or i have to write code to load each plugin? What i need is to
load all the E1, E2, E... plugins automaticly because these may grow
thrue time, implementing another specific functionality specified in
the BP3. That is why i need to know how many pluggins are loaded and
access the interface (declared in BP3) for each one. Again if you have
some code that explains this will be great, because i'm in the dark
and i can't get any tutorial explaining this.
i think the code above covered some of this.. and as tokens are
specified by interfaces.. provide these interfaces to other plugins that
need to use the plugin.
 
C

Christian

Christian said:
please don't email me privately.. this is an open forum so everyone that
wants to read should be able to.

as you asked for examples .. I would recommend you first to look at this:

http://wiki.eclipse.org/Rich_Client_Platform

there is a lot of pointers for help..

if you want the sourcecode of an example I would recommend you to have a
look at the examples the eclipse ide can generate by itself when oyu
create a new plugin project. If you want a full program with several
plugins then I could recommend you to have a look at Azureus on
sourceforge.. its source is open.

Christian
 
N

Nuno

please don't email me privately.. this is an open forum so everyone that
wants to read should be able to.

as you asked for examples .. I would recommend you first to look at this:

http://wiki.eclipse.org/Rich_Client_Platform

there is a lot of pointers for help..

if you want the sourcecode of an example I would recommend you to have a
look at the examples the eclipse ide can generate by itself when oyu
create a new plugin project. If you want a full program with several
plugins then I could recommend you to have a look at Azureus on
sourceforge.. its source is open.

Christian

Thanks Christian i will try to look to azureues source code.
Nuno
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top