final static public void install() {
final File[] dirs = { LoadAcceleratorPresetsAction.getAcceleratorsUserDirectory(),
LoadAcceleratorPresetsAction.getAcceleratorsSysDirectory() };
final Controller controller = Controller.getCurrentController();
ModeController modecontroller = controller.getModeController(MModeController.MODENAME);
final MenuBuilder menuBuilder = modecontroller.getUserInputListenerFactory().getMenuBuilder(MenuBuilder.class);
//TODO RIBBONS: impl. eventually
for (final File dir : dirs) {
final File[] fileList = dir.listFiles();
if (fileList == null) {
continue;
}
for (final File prop : fileList) {
final String fileName = prop.getName();
if (prop.isDirectory()) {
continue;
}
if (!fileName.endsWith(".properties")) {
continue;
}
try {
final int propNameLength = fileName.lastIndexOf('.');
final String propName = fileName.substring(0, propNameLength);
final String key = "LoadAcceleratorPresetsAction." + propName;
if (controller.getAction(key) == null) {
final String title = TextUtils.getText(key + ".text", propName);
final LoadAcceleratorPresetsAction loadAcceleratorPresetsAction = new LoadAcceleratorPresetsAction(
prop.toURL(), key, title);
controller.addAction(loadAcceleratorPresetsAction);
menuBuilder.addAction("main_menu_new_load_accelerator_presets", key,
loadAcceleratorPresetsAction, MenuBuilder.AS_CHILD);
}
}
catch (final Exception e) {
UITools.errorMessage(TextUtils.format("accelerators_loading_error", prop.getPath()));