Monday, February 8, 2010

title pic Followup To Themes

Posted by pookzilla on August 31, 2008

As a quick followup to the helpful article on themes posted to the Eclipse Tips blog, I would like to point out that all of the values that are in the currently active theme are also in the JFace registry. Yes, it is possible to get the current ITheme from the workbench IThemeManager, but that’s only REALLY useful if you’re interested in direct theme manipulation or you have non-color/font values that you’re trying to utilize via getInt/getString/getBoolean. If all you want to do is track the current value for a given element regardless of the theme that’s currently active you’re better off obtaining it from JFaceResources.getFontRegistry and getColorRegistry. The advantage to obtaining the value from here is that if you attach a listener to these registries you’re notified of changes not only when a value within a particular theme has changed, but you’ll get notified when the user selects a new theme. The workbench will always push the values in the current active theme into these registries.

top