Package qupath.lib.gui.scripting
Class DefaultScriptEditor
java.lang.Object
qupath.lib.gui.scripting.DefaultScriptEditor
- All Implemented Interfaces:
ScriptEditor
- Direct Known Subclasses:
RichScriptEditor
Default multilingual script editor.
Lacks syntax highlighting and other pleasant features, unfortunately.
-
Property Summary
PropertiesTypePropertyDescriptionprotected ReadOnlyObjectProperty
<ScriptLanguage> protected ReadOnlyObjectProperty
<ScriptSyntax> protected ReadOnlyObjectProperty
<ScriptTab> Get a property representing the current selected ScriptTab.protected ObservableBooleanValue
Boolean property indicating whether the console should display the log, rather than directly-printed information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.controlsfx.control.action.Action
protected KeyCombination
protected final KeyCodeCombination
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
protected BooleanProperty
protected org.controlsfx.control.action.Action
protected org.controlsfx.control.action.Action
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addNewScript
(String script, ScriptLanguage language, boolean doSelect) Create a new script in the specified language.protected ReadOnlyObjectProperty
<ScriptLanguage> protected ReadOnlyObjectProperty
<ScriptSyntax> static String
getClipboardText
(boolean escapeCharacters) Get the text from the system clipboard, optionally escaping characters.protected ScriptEditorControl
<? extends Region> protected ScriptEditorControl
<? extends Region> protected ScriptLanguage
Gets the value of thecurrentLanguage
property.protected ScriptTab
protected ScriptSyntax
Gets the value of thecurrentSyntax
property.protected String
protected ScriptEditorControl
<?> protected ScriptEditorControl
<?> protected String
getStage()
Get the stage for this script editor.protected static boolean
pasteFromClipboard
(ScriptEditorControl<?> control, boolean escapeCharacters) protected void
Update the font size for the script editor and console.boolean
Attempt to close the editor, saving changes if requested.Observable value indicating whether a script is currently running or not.protected ReadOnlyObjectProperty
<ScriptTab> Get a property representing the current selected ScriptTab.protected ObservableBooleanValue
Boolean property indicating whether the console should display the log, rather than directly-printed information.void
Show the script editor.void
showScript
(File file) Show the script editor, opening an existing script file.void
showScript
(String name, String script) Show the script editor, including a new script with the specified name.boolean
supportsFile
(File file) Query whether a file represents a supported script.
-
Property Details
-
selectedScript
Get a property representing the current selected ScriptTab.- See Also:
-
currentLanguage
- See Also:
-
currentSyntax
- See Also:
-
sendLogToConsole
Boolean property indicating whether the console should display the log, rather than directly-printed information.- See Also:
-
-
Field Details
-
comboPasteEscape
-
completionCodeCombination
-
beautifySourceAction
protected org.controlsfx.control.action.Action beautifySourceAction -
compressSourceAction
protected org.controlsfx.control.action.Action compressSourceAction -
copyAction
protected org.controlsfx.control.action.Action copyAction -
cutAction
protected org.controlsfx.control.action.Action cutAction -
pasteAction
protected org.controlsfx.control.action.Action pasteAction -
pasteAndEscapeAction
protected org.controlsfx.control.action.Action pasteAndEscapeAction -
undoAction
protected org.controlsfx.control.action.Action undoAction -
redoAction
protected org.controlsfx.control.action.Action redoAction -
runScriptAction
protected org.controlsfx.control.action.Action runScriptAction -
runSelectedAction
protected org.controlsfx.control.action.Action runSelectedAction -
runProjectScriptAction
protected org.controlsfx.control.action.Action runProjectScriptAction -
runProjectScriptNoSaveAction
protected org.controlsfx.control.action.Action runProjectScriptNoSaveAction -
killRunningScriptAction
protected org.controlsfx.control.action.Action killRunningScriptAction -
insertMuAction
protected org.controlsfx.control.action.Action insertMuAction -
insertQPImportAction
protected org.controlsfx.control.action.Action insertQPImportAction -
insertQPExImportAction
protected org.controlsfx.control.action.Action insertQPExImportAction -
insertAllDefaultImportAction
protected org.controlsfx.control.action.Action insertAllDefaultImportAction -
insertPixelClassifiersAction
protected org.controlsfx.control.action.Action insertPixelClassifiersAction -
insertObjectClassifiersAction
protected org.controlsfx.control.action.Action insertObjectClassifiersAction -
insertDetectionMeasurementsAction
protected org.controlsfx.control.action.Action insertDetectionMeasurementsAction -
findAction
protected org.controlsfx.control.action.Action findAction -
smartEditingAction
protected org.controlsfx.control.action.Action smartEditingAction -
smartEditing
-
-
Constructor Details
-
DefaultScriptEditor
Constructor.- Parameters:
qupath
- current QuPath instance.
-
-
Method Details
-
supportsFile
Query whether a file represents a supported script. Currently, this test looks at the file extension only.- Specified by:
supportsFile
in interfaceScriptEditor
- Parameters:
file
- the file to test- Returns:
- true if the file is likely to contain a supported script, false otherwise
-
requestClose
public boolean requestClose()Description copied from interface:ScriptEditor
Attempt to close the editor, saving changes if requested.- Specified by:
requestClose
in interfaceScriptEditor
- Returns:
- True if the editor can be closed without losing changes, unless the user consents to losing changes.
-
getStage
Get the stage for this script editor.- Returns:
-
scriptRunning
Observable value indicating whether a script is currently running or not. This can be used (for example) to determine whether a user action should be blocked until the script has completed.- Returns:
-
promptToSetFontSize
protected void promptToSetFontSize()Update the font size for the script editor and console. -
addNewScript
Create a new script in the specified language.- Parameters:
script
- text of the script to addlanguage
- language of the scriptdoSelect
- if true, select the script when it is added
-
selectedScriptProperty
Get a property representing the current selected ScriptTab.- Returns:
-
getNewConsole
-
createNewEditor
-
getNewEditor
-
currentLanguageProperty
- Returns:
- the
currentLanguage
property - See Also:
-
currentSyntaxProperty
- Returns:
- the
currentSyntax
property - See Also:
-
getCurrentLanguage
Gets the value of thecurrentLanguage
property.- Property description:
- Returns:
- the value of the
currentLanguage
property - See Also:
-
getCurrentSyntax
Gets the value of thecurrentSyntax
property.- Property description:
- Returns:
- the value of the
currentSyntax
property - See Also:
-
getCurrentScriptTab
-
getCurrentEditorControl
-
getCurrentConsoleControl
-
getSelectedText
-
getCurrentText
-
sendLogToConsoleProperty
Boolean property indicating whether the console should display the log, rather than directly-printed information.- Returns:
-
getClipboardText
Get the text from the system clipboard, optionally escaping characters. This is useful when trying to avoid path trouble on Windows with unescaped characters.This command also queries the clipboard for files, using their paths where available.
- Parameters:
escapeCharacters
- if true, escape characters using Java language rules- Returns:
- the clipboard text
-
pasteFromClipboard
protected static boolean pasteFromClipboard(ScriptEditorControl<?> control, boolean escapeCharacters) -
showEditor
public void showEditor()Description copied from interface:ScriptEditor
Show the script editor.- Specified by:
showEditor
in interfaceScriptEditor
-
showScript
Description copied from interface:ScriptEditor
Show the script editor, including a new script with the specified name.- Specified by:
showScript
in interfaceScriptEditor
- Parameters:
name
- name of the script to showscript
- content of the script
-
showScript
Description copied from interface:ScriptEditor
Show the script editor, opening an existing script file.- Specified by:
showScript
in interfaceScriptEditor
- Parameters:
file
- the script file
-