How to create singleton from extention [message #585719] |
Sun, 23 November 2008 22:03 |
Andrey Ilinykh Messages: 12 Registered: July 2009 |
Junior Member |
|
|
Hello, everybody!
In my plugin I define extention point which describes service I wanted to be
implemented by contributers- IService.
When I need all implementations I go to extention registry and read all
configuration elements:
IConfigurationElement[] config =
Platform.getExtensionRegistry().getConfigurationElementsFor( "myRcp.brokers");
Then I create objects by caling
for (IConfigurationElement e : config) {
try {
Object o = e.createExecutableExtension("class");
IService service = (IService)o;
....
} catch(){}
I works. The problem is - each contribution is a singlton. I don't have to
create new object every time when I need it, but rather use already created
instance.
How to do this? Is it my responsibility to create just one object? Or
eclipse has some facility for that?
Thank you,
Andrey
|
|
|
Powered by
FUDForum. Page generated in 0.04076 seconds