Semi Automated 2 Key > & Mnemonic Converter
Author:
Adam Sotona
Conversion from 2-keys mnemonic concept (one key for text and one for menmonics) to single key (text contains & before the character that should be used as mnemonic) requires a lot of manual work.
To save some days of work I've implemented semi-automated converter.
The converter looks for all .form files in the given source root, looks for components with text and mnemonic or displyedMnemonic, locates correct bundle, finds the keys, modifies the text key, removes mnemonic key and finally removes mnemonic attribute from the form. However it has several limitations so the converter logs a lot of information, warning and even errors. In case of error there shouldn't be any data lost, only some parts are skipped. The converter is able to handle duplicate keys with the same value in the bundle, cross-references and some other common mess in the bundles. Everything is logged so please read the result and look for warnings and errors.
The usage is simple:
- download and compile attached source Main.java
- run Main with a single project source root as an argument (it is better to catch error output for later analysis: java Main c:\myproject\src 2>log.txt
- open the project in NetBeans and check for CVS changes (for refresh of modified forms)
- add UI Utilities API module as a library if necessary
- open each modified form in Matisse, select root form node in Inspector and check Generate Mnemonics Code in Properties (Matisse some times does not generate correct code for all components).
- save the form and try to re-open it for verification that mnemonics work
- manually convert all error cases
- rebuild project and optionally diff all CVS changes
That's all folks.
Feel free to contact me with question about the converter or the logged messages.
Adam