Azhrei wrote:I'm going to start a tangent that is related to Build 48. I don't believe it: a thread re-rail!
I've been looking through the MT code and there are a few places where the code has an explicit getKeyStroke("control C") when it should have a reference to the Actions in AppActions. I've updated those in my code so everything now pulls from a single location.
My question deals with the Mac convention of using "meta C" instead of "control C" for COPY (same with CUT and PASTE). I have edited the i18n.properties in my development version of MT so that I can use the Mac keys, but what is the right way to handle that change?
The best approach seems to be to check for the platform early on in the startup process and build a "Platform" object that sits in front of the LAF (and possibly other objects). The Platform object would provide factories for the LAF and anything else that may come up down the road. The LAF factory would create the TinyLAF and then change the keystrokes on the Mac; on other platforms it would be a pass-thru.
Is that the right way to handle it?
For this (and several other UI platform differences) AWT is your friend. In this case, specifically
java.awt.Toolkit.getDefaultToolkit().getMenuShortcutKeyMask() This is sun (and apple for that matter) recommend way of doing things.
I am not sure if building a Platform abstraction is of much value unless you have other things that you want to put in there that don't already exist, and I hazard a guess that most of the things you would want to put in there already have abstractions that live in well documented and standard classes (even if they are darn hard to find some times).
Edit: for clarity