Question

maybe it's an stupid question but me research on the net didn't give me an answer. What i want to do is Implementing my own Service in RCP to provide Data to different views.

I started to get into Eclipse 4 RCP development and worked previosly with Eclipse 3.x. I now that the Eclipse 3.x way to implement a Service is over an Extension Point (org.eclipse.ui.services). But now on Eclipse 4 i read that extension points a not as common as in the previos version.

So my question is what is best practise to implement a Service in Eclipse 4?

And by the way is there a Difference between OSGi Services in general an the Eclipse Platform Services?

Thanks.

Was it helpful?

Solution

If you are writing a 'pure' Eclipse 4 (e4) application (one which does not use the 3.x compatibility code) then you can't use most of the org.eclipse.ui.xxx code. Extension points are still used but many things are done by objects set in the Eclipse context which can be accessed by direct injection.

You can still define OSGi services, usually using the declarative style by creating a component definition file (see the File > New > Other > Plug-in Development > Component Definition wizard).

For an OSGi service you can optionally use a ContextFunction to delay creating the service instance.

Or you can simply put your service class instance in to the Eclipse context - you would often do this in the @PostContextCreate method of a LifeCycle class.

This is a rather broad subject so I have only given a brief overview.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top