Search in sources :

Example 16 with Action

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;
}
Also used : Action(org.controlsfx.control.action.Action) KeyCodeCombination(javafx.scene.input.KeyCodeCombination)

Example 17 with 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;
}
Also used : Action(org.controlsfx.control.action.Action) KeyCodeCombination(javafx.scene.input.KeyCodeCombination)

Example 18 with 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;
}
Also used : Action(org.controlsfx.control.action.Action)

Example 19 with 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;
}
Also used : Action(org.controlsfx.control.action.Action)

Example 20 with 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;
}
Also used : Action(org.controlsfx.control.action.Action) KeyCodeCombination(javafx.scene.input.KeyCodeCombination)

Aggregations

Action (org.controlsfx.control.action.Action)48 BorderPane (javafx.scene.layout.BorderPane)21 ActionUtils (org.controlsfx.control.action.ActionUtils)16 KeyCodeCombination (javafx.scene.input.KeyCodeCombination)15 Arrays (java.util.Arrays)14 Dict (se.trixon.almond.util.Dict)14 MaterialIcon (se.trixon.almond.util.icons.material.MaterialIcon)14 ArrayList (java.util.ArrayList)13 MenuItem (javafx.scene.control.MenuItem)12 Mapton.getIconSizeToolBarInt (org.mapton.api.Mapton.getIconSizeToolBarInt)12 FxHelper (se.trixon.almond.util.fx.FxHelper)12 Platform (javafx.application.Platform)11 ContextMenu (javafx.scene.control.ContextMenu)11 List (java.util.List)10 File (java.io.File)9 IOException (java.io.IOException)9 Label (javafx.scene.control.Label)9 SeparatorMenuItem (javafx.scene.control.SeparatorMenuItem)9 ObservableValue (javafx.beans.value.ObservableValue)8 ActionEvent (javafx.event.ActionEvent)8