Using services and contexts

An IDE is more than a collection of its component parts, and the Eclipse 4 framework allows these to coordinate and communicate with each other.

In prior releases of Eclipse, the Platform (or PlatformUI) object would act as an oracle of all the known services in the runtime infrastructure, as well as providing hooks for accessing those services, for example:

IExtensionRegistry registry = Platform.getExtensionRegistry();
IWorkbench workbench = PlatformUI.getWorkbench();

Although this provides a programmatic way of making the services available, it has two key disadvantages:

  • The provider of the interface is tightly coupled with the bundle containing the accessor, even if they are unrelated
  • Introducing new services requires a code change to a core object, and has disadvantages in being introduced to existing systems

The goal of E4 is to decouple service providers and service consumers through the use of OSGi services. These are contributed to the runtime, and can be looked up via interface name using either standard OSGi mechanisms, or through E4 injection. Although that is the general trend, some platform services accessed by the IServiceLocator aren't backed by OSGi services.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.149.243.32