use of org.controlsfx.control.action.Action in project qupath by qupath.
the class DefaultScriptEditor method createSaveAction.
Action createSaveAction(final String name, final boolean saveAs) {
Action action = new Action(name, e -> {
ScriptTab tab = getCurrentScriptObject();
if (tab == null)
return;
save(tab, saveAs);
});
if (saveAs)
action.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN, KeyCombination.SHIFT_DOWN));
else
action.setAccelerator(new KeyCodeCombination(KeyCode.S, KeyCombination.SHORTCUT_DOWN));
return action;
}
use of org.controlsfx.control.action.Action in project qupath by qupath.
the class DefaultScriptEditor method createExitAction.
Action createExitAction(final String name) {
Action action = new Action(name, e -> {
attemptToQuitScriptEditor();
e.consume();
});
action.setAccelerator(new KeyCodeCombination(KeyCode.Q, KeyCombination.SHORTCUT_DOWN));
return action;
}
use of org.controlsfx.control.action.Action in project qupath by qupath.
the class DefaultScriptEditor method createUndoAction.
Action createUndoAction(final String name, final KeyCombination accelerator) {
Action action = new Action(name, e -> {
ScriptEditorControl editor = getCurrentTextComponent();
if (editor != null && editor.isUndoable())
editor.undo();
e.consume();
});
if (accelerator != null) {
action.setAccelerator(accelerator);
accelerators.add(accelerator);
}
return action;
}
use of org.controlsfx.control.action.Action in project qupath by qupath.
the class DefaultScriptEditor method createRedoAction.
Action createRedoAction(final String name, final KeyCombination accelerator) {
Action action = new Action(name, e -> {
ScriptEditorControl editor = getCurrentTextComponent();
if (editor != null && editor.isRedoable())
editor.redo();
e.consume();
});
if (accelerator != null) {
action.setAccelerator(accelerator);
accelerators.add(accelerator);
}
return action;
}
use of org.controlsfx.control.action.Action in project qupath by qupath.
the class DefaultScriptEditor method createNewAction.
Action createNewAction(final String name) {
Action action = new Action(name, e -> addNewScript("", getDefaultLanguage(null), true));
action.setAccelerator(new KeyCodeCombination(KeyCode.N, KeyCombination.SHORTCUT_DOWN));
return action;
}
Aggregations