Time for action – adding the clock

To add the clock to the Eclipse 4 application, a new part will be added which has a ClockWidget as its only content.

  1. To use the ClockWidget in a different plug-in, the package needs to be exported. Open the MANIFEST.MF from the com.packtpub.e4.clock.ui project, and on the Runtime tab, click on Add to add the com.packtpub.e4.clock.ui package to the list of Exported Packages.
  2. Create a new class called ClockPart in the com.packtpub.e4.application.parts package.
  3. Add a create method with a @PostConstruct annotation that takes a Composite parent argument.
  4. In the body of the create method, instantiate a new ClockWidget instance with arguments parent, SWT.NONE, and new RGB(255,0,0). This will require that the com.packtpub.e4.clock.ui ...

Get Eclipse Plug-in Development Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.