May
26
2005

Hacking my first JFace Preferences code

I’m up to the stage in my PasswordSafe port where I need to add an options dialog. In the original app it’s a five-tabbed dialog with quite a few options, so I thought I might have a crack at using JFace Preferences. Wow!

Thanks to some great help from this example I was up and running in no time. SWT Designer supports a wizard for whipping up the GUI of a Preferences Page, so I could hack the example to add just the controls I need to support.


JFace Preferences Example



This is one very cool API. It makes it easy to do the common things that you want to do (ie. read settings, reset settings to defaults, and update your users’ persistent settings). Big tick to the Eclipse guys! The more I use JFace the more I love it. It’s just got this “real worldiness” about it that makes developing very productive.

This options dialog is the only area of the port so far where I’ve deviated from a complete emulation of the original, but JFace Preferences are just too convenient to pass up (and they look just great). The code ends up being very clean as each page is its own class and is just responsible for those few settings that relate to it. Good stuff.

About the Author: Glen Smith

3 Comments + Add Comment

  • When/where are you going to release the port of PasswordSafe?

  • Neil, definitely within the week. I’ve got targets going for mac & win32, and I just need to finish the linux bundle and I’ve got a 0.1 ready to go for some early review.

    As for where, I want to eventually commit it to the pwsafe project back on sourceforge, but the pre-1.0 stuff will probably just get put up on this site somewhere till I’m happy for a more broad distribution.

  • Hi
    you said that swt designer has a wizard to build a JFace Preference dialog… I’ve installed the last version, but I’m not able to find this wizard.. could you help me? Or do you have some useful guide/link to start using JFace Preferences (the above link doesn’t work)? I’m writing a tool but now I’m blocked because of preference dialog
    Thanks, Dario

Leave a comment

Glen Smith

About Glen

Co-author Grails in Action