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 ObservableBooleanValueBoolean property indicating whether the console should display the log, rather than directly-printed information. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.controlsfx.control.action.Actionprotected KeyCombinationprotected final KeyCodeCombinationprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Actionprotected BooleanPropertyprotected org.controlsfx.control.action.Actionprotected org.controlsfx.control.action.Action -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddNewScript(String script, ScriptLanguage language, boolean doSelect) Create a new script in the specified language.protected ReadOnlyObjectProperty<ScriptLanguage> protected ReadOnlyObjectProperty<ScriptSyntax> static StringgetClipboardText(boolean escapeCharacters) Get the text from the system clipboard, optionally escaping characters.protected ScriptEditorControl<? extends Region> protected ScriptEditorControl<? extends Region> protected ScriptLanguageGets the value of thecurrentLanguageproperty.protected ScriptTabprotected ScriptSyntaxGets the value of thecurrentSyntaxproperty.protected Stringprotected ScriptEditorControl<?> protected ScriptEditorControl<?> protected StringgetStage()Get the stage for this script editor.protected static booleanpasteFromClipboard(ScriptEditorControl<?> control, boolean escapeCharacters) protected voidUpdate the font size for the script editor and console.booleanAttempt 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 ObservableBooleanValueBoolean property indicating whether the console should display the log, rather than directly-printed information.voidShow the script editor.voidshowScript(File file) Show the script editor, opening an existing script file.voidshowScript(String name, String script) Show the script editor, including a new script with the specified name.booleansupportsFile(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:
supportsFilein 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:ScriptEditorAttempt to close the editor, saving changes if requested.- Specified by:
requestClosein 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
currentLanguageproperty - See Also:
-
currentSyntaxProperty
- Returns:
- the
currentSyntaxproperty - See Also:
-
getCurrentLanguage
Gets the value of thecurrentLanguageproperty.- Property description:
- Returns:
- the value of the
currentLanguageproperty - See Also:
-
getCurrentSyntax
Gets the value of thecurrentSyntaxproperty.- Property description:
- Returns:
- the value of the
currentSyntaxproperty - 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:ScriptEditorShow the script editor.- Specified by:
showEditorin interfaceScriptEditor
-
showScript
Description copied from interface:ScriptEditorShow the script editor, including a new script with the specified name.- Specified by:
showScriptin interfaceScriptEditor- Parameters:
name- name of the script to showscript- content of the script
-
showScript
Description copied from interface:ScriptEditorShow the script editor, opening an existing script file.- Specified by:
showScriptin interfaceScriptEditor- Parameters:
file- the script file
-