Package qupath.lib.gui.scripting.syntax
Interface ScriptSyntax
public interface ScriptSyntax
Interface for classes that apply some syntax formatting to an
EditableText
.- Since:
- v0.4.0
- Author:
- Melvin Gelbard, Pete Bankhead
-
Method Summary
Modifier and TypeMethodDescriptiondefault String
Beautifies the specified text, according to the syntax.default boolean
default boolean
default String
Compresses the specified text by removing extra space, according to the syntax.Get a set of the scripting languages supported by this syntax.default String
Get the String that represents the start of a comment line.default String
String to insert when tab key presseddefault boolean
handleBackspace
(EditableText control, boolean smartEditing) Handle a backspace.default void
handleLeftParenthesis
(EditableText control, boolean smartEditing) Handle left parentheses(
.default void
handleLineComment
(EditableText control) Handle line comments.default void
handleNewLine
(EditableText control, boolean smartEditing) Handle a new line.default void
handleQuotes
(EditableText control, boolean isDoubleQuote, boolean smartEditing) Handle single/double quotes.default void
handleRightParenthesis
(EditableText control, boolean smartEditing) Handle right parentheses)
.default void
handleTabPress
(EditableText control, boolean shiftDown) Handle tab key.
-
Method Details
-
getLanguageNames
Get a set of the scripting languages supported by this syntax.- Returns:
-
getTabString
String to insert when tab key pressed- Returns:
-
getLineCommentString
Get the String that represents the start of a comment line.- Returns:
- comment string
-
handleLeftParenthesis
Handle left parentheses(
.- Parameters:
control
- the text/code areasmartEditing
- whether smart editing is enabled
-
handleRightParenthesis
Handle right parentheses)
.- Parameters:
control
- the text/code areasmartEditing
- whether smart editing is enabled
-
handleQuotes
Handle single/double quotes.- Parameters:
control
- the text/code areaisDoubleQuote
- whether the input is single/double quotessmartEditing
- whether smart editing is enabled
-
handleLineComment
Handle line comments.- Parameters:
control
- the text/code area
-
handleNewLine
Handle a new line.- Parameters:
control
- the text/code areasmartEditing
- whether smart editing is enabled
-
handleBackspace
Handle a backspace.- Parameters:
control
-smartEditing
- whether smart editing is enabled- Returns:
- whether the source event should be consumed; if this returns false then backspace is handled elsewhere
-
handleTabPress
Handle tab key.- Parameters:
control
- the text/code areashiftDown
-
-
beautify
Beautifies the specified text, according to the syntax.- Parameters:
text
- the text to beautify- Returns:
- beautified text
-
canBeautify
default boolean canBeautify()- Returns:
-
compress
Compresses the specified text by removing extra space, according to the syntax.- Parameters:
text
- the text to compress- Returns:
- beautified text
-
canCompress
default boolean canCompress()- Returns:
-