O'Reilly logo

Eclipse 4 Plug-in Development by Example Beginner's Guide by Dr. Alex Blewitt

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – dealing with events

There's a more generic way of passing information between components in Eclipse 4, using the OSGi EventAdmin service. This is a message bus, like JMS, but operates in memory. There is also an Eclipse-specific EventBroker, which provides a slightly simpler API to send messages.

  1. Add the following bundles as dependencies to the com.packtpub.e4.application project, by double-clicking on the project's META-INF/MANIFEST.MF file and going to the Dependencies tab:
    • org.eclipse.osgi.services
    • org.eclipse.e4.core.services
    • org.eclipse.e4.core.di.extensions
  2. Open the Rainbow class and obtain an instance of EventBroker through injection.
  3. Modify the selectionChanged() method, so that instead of setting a selection, it uses the ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required