allow kepler to use OS specific UI elements
I've implemented an extension point in kepler to allow us to build OS specific UI tweaks into kepler without breaking the build on other OS. Any module can now have a modules-info/osextension.txt file. The file has two properties: an OS that the extension runs on and a class that implements org.kepler.OSExtension. The interface OSExtension has only one method addOSExtensions() which allows the implementing class to do any tweaks necessary at startup time.
The example use case is for OSX. We want kepler to look like a native OSX application. The only way to do that is to use some OSX specific classes that do not exist on windows or linux (hence any classes that depend on those break the build for other OSs). The way this now works is there is a suite called kepler-mac which has the same modules as kepler, but adds the appleExtension module. The appleExtension module includes an implementation of OSExtension plus the osextension.txt file. The osextension.txt file looks like this:
os=Mac OS X
When Kepler starts up, it checks all modules for the osextension.txt file. It then looks at the current OS to see if the name java returns matches the OS name in osextension.txt. If it does, it attempts to load the class defined in the .txt file and run the addOSExtensions() method.
If you want to use the mac osx extensions, simply do 'ant change-to -Dsuite=kepler-mac' and re-compile. You should see the native OSX menu bar instead of the normal java one.
Additional tasks for the OSX extension is to add the about box into the Applicaiton menu and to make the apple-q ask if you want to save before terminating. Also need to fix the icon in the dock.