To add the clock to the Eclipse 4 application, a new part will be added which has a ClockWidget
as its only content.
To use the
ClockWidget
in a different plug-in, the package needs to be exported. Open theMANIFEST.MF
from thecom.packtpub.e4.clock.ui
project, and on the Runtime tab, click on Add to add thecom.packtpub.e4.clock.ui
package to the list of Exported Packages.Create a new class called
ClockPart
in thecom.packtpub.e4.application.parts
package.Add a
create
method with a@PostConstruct
annotation that takes aComposite parent
argument.In the body of the
create
method, instantiate a newClockWidget
instance with argumentsparent
,SWT.NONE
, andnew RGB(255,0,0)
. This will require that thecom.packtpub.e4.clock.ui
package is imported into thecom.packtpub.e4.application
plug-in. A quick-fix should offer this automatically, but it can be added by opening theMANIFEST.MF
, going to the Dependencies tab, and adding thecom.packtpub.e4.clock.ui
package...