Package org.sonar.sslr.internal.toolkit
Interface ToolkitView
-
- All Known Implementing Classes:
ToolkitViewImpl
public interface ToolkitViewContract interface for the view. Note that *none* of the methods here-under should generate *any* event back to the presenter. Only end-user interactions are supposed to generate events.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidaddConfigurationProperty(String name, String description)Add a new configuration property to the configuration tab.voidappendToConsole(String message)Append the given message to the console view.voidclearAstSelections()Clear all the selections in the abstract syntax tree view.voidclearConsole()Clear the console.voidclearSourceCodeHighlights()Clear all the highlights in the source code editor.voiddisableXPathEvaluateButton()Disable the XPath evaluate button.voiddisplayAst(AstNode astNode)Display the abstract syntax tree view starting from a given node.voiddisplayHighlightedSourceCode(String htmlHighlightedSourceCode)Display the given HTML highlighted source code in the source code editor.voiddisplayXml(String xml)Display the given string in the XML view.voidenableXPathEvaluateButton()Enable the XPath evaluate button.AstNodegetAstNodeFollowingCurrentSourceCodeTextCursorPosition()Get the AST node which follows the current source code editor text cursor position.StringgetConfigurationPropertyValue(String name)Get the value currently entered in the configuration property field identified by the given name.List<AstNode>getSelectedAstNodes()Get the list of nodes currently selected in the abstract syntax tree view.StringgetSourceCode()Get the source code currently entered in the source code editor.PointgetSourceCodeScrollbarPosition()Get the current source code editor scrollbars' position point.StringgetXPath()Get the text currently entered in the XPath field.voidhighlightSourceCode(AstNode astNode)Highlight the given AST node in the source code editor.FilepickFileToParse()Prompt the user for a file to parse and return it.voidrun()Launch the application.voidscrollAstTo(AstNode astNode)Scroll the abstract syntax tree view in order to make the given AST node visible.voidscrollSourceCodeTo(AstNode astNode)Scroll the source code editor in order to make the given AST node visible.voidscrollSourceCodeTo(Point point)Scroll the source code editor in order to make the given point visible.voidselectAstNode(AstNode astNode)Select the given AST node in the abstract syntax tree view.voidsetConfigurationPropertyErrorMessage(String name, String errorMessage)Set the error message of the configuration property identified by the given name.voidsetConfigurationPropertyValue(String name, String value)Set the current value of the configuration property field identified by the given name.voidsetFocusOnAbstractSyntaxTreeView()Set the focus on the abstract syntax tree view.voidsetFocusOnConfigurationPropertyField(String name)Set the focus on the configuration field identified by the given name.voidsetFocusOnConfigurationView()Set the focus on the configuration view.voidsetFocusOnConsoleView()Set the focus on the console view.voidsetTitle(String title)Set the title of the application.
-
-
-
Method Detail
-
run
void run()
Launch the application.
-
setTitle
void setTitle(String title)
Set the title of the application.- Parameters:
title-
-
pickFileToParse
@Nullable File pickFileToParse()
Prompt the user for a file to parse and return it.- Returns:
- The file to parse, or null if no file was picked
-
displayHighlightedSourceCode
void displayHighlightedSourceCode(String htmlHighlightedSourceCode)
Display the given HTML highlighted source code in the source code editor. Scrollbars state is undefined after a call to this method.- Parameters:
htmlHighlightedSourceCode- The HTML highlighted source code
-
displayAst
void displayAst(@Nullable AstNode astNode)
Display the abstract syntax tree view starting from a given node.- Parameters:
astNode- The root AST node or null if no abstract syntax tree must be shown
-
displayXml
void displayXml(String xml)
Display the given string in the XML view.- Parameters:
xml- The string to display
-
getSourceCodeScrollbarPosition
Point getSourceCodeScrollbarPosition()
Get the current source code editor scrollbars' position point.- Returns:
- The point
-
scrollSourceCodeTo
void scrollSourceCodeTo(Point point)
Scroll the source code editor in order to make the given point visible.- Parameters:
point- to make visible
-
getSourceCode
String getSourceCode()
Get the source code currently entered in the source code editor.- Returns:
- The source code
-
getXPath
String getXPath()
Get the text currently entered in the XPath field.- Returns:
- The XPath field text
-
selectAstNode
void selectAstNode(@Nullable AstNode astNode)
Select the given AST node in the abstract syntax tree view.- Parameters:
astNode- The AST node to select, null will lead to a no operation
-
clearAstSelections
void clearAstSelections()
Clear all the selections in the abstract syntax tree view.
-
scrollAstTo
void scrollAstTo(@Nullable AstNode astNode)
Scroll the abstract syntax tree view in order to make the given AST node visible.- Parameters:
astNode- The AST node to make visible, null will lead to a no operation
-
highlightSourceCode
void highlightSourceCode(AstNode astNode)
Highlight the given AST node in the source code editor.- Parameters:
astNode- The AST node to highlight
-
clearSourceCodeHighlights
void clearSourceCodeHighlights()
Clear all the highlights in the source code editor.
-
scrollSourceCodeTo
void scrollSourceCodeTo(@Nullable AstNode astNode)
Scroll the source code editor in order to make the given AST node visible.- Parameters:
astNode- The AST node to make visible, null will lead to a no operation
-
disableXPathEvaluateButton
void disableXPathEvaluateButton()
Disable the XPath evaluate button.
-
enableXPathEvaluateButton
void enableXPathEvaluateButton()
Enable the XPath evaluate button.
-
getAstNodeFollowingCurrentSourceCodeTextCursorPosition
@Nullable AstNode getAstNodeFollowingCurrentSourceCodeTextCursorPosition()
Get the AST node which follows the current source code editor text cursor position.- Returns:
- The following AST node, or null if there is no such node
-
getSelectedAstNodes
List<AstNode> getSelectedAstNodes()
Get the list of nodes currently selected in the abstract syntax tree view.- Returns:
- The list of selected AST nodes
-
appendToConsole
void appendToConsole(String message)
Append the given message to the console view.- Parameters:
message- The message to append
-
setFocusOnConsoleView
void setFocusOnConsoleView()
Set the focus on the console view.
-
setFocusOnAbstractSyntaxTreeView
void setFocusOnAbstractSyntaxTreeView()
Set the focus on the abstract syntax tree view.
-
clearConsole
void clearConsole()
Clear the console.
-
addConfigurationProperty
void addConfigurationProperty(String name, String description)
Add a new configuration property to the configuration tab.- Parameters:
name-description-
-
getConfigurationPropertyValue
String getConfigurationPropertyValue(String name)
Get the value currently entered in the configuration property field identified by the given name.- Parameters:
name- The name of the configuration property- Returns:
- The current value of the field
-
setConfigurationPropertyValue
void setConfigurationPropertyValue(String name, String value)
Set the current value of the configuration property field identified by the given name.- Parameters:
name- The name of the configuration propertyvalue- The value to be set
-
setConfigurationPropertyErrorMessage
void setConfigurationPropertyErrorMessage(String name, String errorMessage)
Set the error message of the configuration property identified by the given name.- Parameters:
name- The name of the configuration propertyerrorMessage- The error message
-
setFocusOnConfigurationPropertyField
void setFocusOnConfigurationPropertyField(String name)
Set the focus on the configuration field identified by the given name.- Parameters:
name-
-
setFocusOnConfigurationView
void setFocusOnConfigurationView()
Set the focus on the configuration view.
-
-