At present the color of the hand is set in the constructor of the ClockWidget
, and cannot be changed after creation. It would be better if the style of the widget could be controlled externally using the CSS that is used to style the application. This is handled with an ICSSPropertyHandler
subclass from the org.eclipse.e4.ui.css.swt
plug-in.
Open the
plugin.xml
file from thecom.packtpub.e4.clock.ui
plug-in and switch to the Dependencies tab. Add theorg.eclipse.e4.ui.css.swt
andorg.eclipse.e4.ui.css.core
plug-ins to the list. To ensure that the bundle will work if these are missing, mark them both as Optional dependencies.Create a new package
com.packtpub.e4.ui.internal.css
to store the classes necessary for CSS cooperation.Create a new class
CSSPropertyClockHandler
, which extendsAsbtractCSSPropertySWTHandler
. The IDE will offer to auto-create the missing methodsapplyCSSProperty
andretrieveCSSProperty
, so create these as they will be used next.In...