private void createActions(EditorController controller,
UserPreferences preferences) {
ActionMap actionMap = getActionMap();
try {
actionMap.put(ActionType.NEW_LIBRARY, new ControllerAction(
preferences, EditorPane.class, ActionType.NEW_LIBRARY.name(), true,
controller, "newLibrary"));
actionMap.put(ActionType.OPEN, new ControllerAction(
preferences, EditorPane.class, ActionType.OPEN.name(), true,
controller, "open"));
actionMap.put(ActionType.SAVE, new ControllerAction(
preferences, EditorPane.class, ActionType.SAVE.name(), true,
controller, "save"));
actionMap.put(ActionType.SAVE_AS, new ControllerAction(
preferences, EditorPane.class, ActionType.SAVE_AS.name(), true,
controller, "saveAs"));
actionMap.put(ActionType.PREFERENCES, new ControllerAction(
preferences, EditorPane.class, ActionType.PREFERENCES.name(), true,
controller, "editPreferences"));
actionMap.put(ActionType.EXIT, new ControllerAction(
preferences, EditorPane.class, ActionType.EXIT.name(), true,
controller, "exit"));
FurnitureLibraryController furnitureLibraryController = controller.getFurnitureLibraryController();
actionMap.put(ActionType.IMPORT_FURNITURE, new ControllerAction(
preferences, EditorPane.class, ActionType.IMPORT_FURNITURE.name(), true,
furnitureLibraryController, "importFurniture"));
boolean selectionEmpty = furnitureLibraryController.getSelectedFurniture().isEmpty();
actionMap.put(ActionType.MODIFY_FURNITURE, new ControllerAction(
preferences, EditorPane.class, ActionType.MODIFY_FURNITURE.name(), !selectionEmpty,
furnitureLibraryController, "modifySelectedFurniture"));
actionMap.put(ActionType.DELETE, new ControllerAction(
preferences, EditorPane.class, ActionType.DELETE.name(), !selectionEmpty,
furnitureLibraryController, "deleteSelectedFurniture"));
actionMap.put(ActionType.SELECT_ALL, new ControllerAction(
preferences, EditorPane.class, ActionType.SELECT_ALL.name(), true,
furnitureLibraryController, "selectAll"));
actionMap.put(ActionType.ABOUT, new ControllerAction(
preferences, EditorPane.class, ActionType.ABOUT.name(), true,
controller, "about"));
} catch (NoSuchMethodException ex) {
throw new IllegalArgumentException(ex);
}