Followup To Themes

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.

This entry was posted in Eclipse. Bookmark the permalink. Follow any comments here with the RSS feed for this post. Both comments and trackbacks are currently closed.
  • About Me

    Hi! My name is Kimberly Horne and I have absolutely nothing interesting to say. Unfortunately for you I DO have an overpowering need to tinker with technology which is explains the presence of this journal. I mostly talk about games (video and tabletop), technology, tattoos, and my pets.

    If you're an Eclipse user you may find my Eclipse category more interesting.

    Similarly, if you're an Arduino nerd then maybe my projects might be of interest.

    Since I've discovered Twitter this journal has been neglected somewhat. If you really want to stalk me your best bet is to follow me on twitter.