Class MainFrameModel
java.lang.Object
com.puppycrawl.tools.checkstyle.gui.MainFrameModel
Model for checkstyle frame.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enum
Parsing modes which available in GUI. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate File
The file which is being parsed.Lines to position map.private MainFrameModel.ParseMode
Current mode.private final ParseTreeTableModel
Parse tree model.private boolean
Whether the reload action is enabled.private String
Text for a frame's text area.private String
Title for the main frame. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionGet current file.private static FileText
getFileText
(File file) Get FileText from a file.Get the directory of the last loaded file.Get lines to position map.Get parse tree table model.getText()
Get text to display in a text area.getTitle()
Returns title for the main frame.boolean
Returns true if the reload action is enabled, false otherwise.void
Open file and load the file.void
Set current parse mode.static boolean
shouldAcceptFile
(File file) Whether a file chooser should accept the file as a source file.
-
Field Details
-
parseTreeTableModel
Parse tree model. -
linesToPosition
Lines to position map. -
parseMode
Current mode. -
currentFile
The file which is being parsed. -
text
Text for a frame's text area. -
title
Title for the main frame. -
reloadActionEnabled
Whether the reload action is enabled.
-
-
Constructor Details
-
MainFrameModel
public MainFrameModel()Instantiate the model.
-
-
Method Details
-
setParseMode
Set current parse mode.- Parameters:
mode
- ParseMode enum.
-
getParseTreeTableModel
Get parse tree table model.- Returns:
- parse tree table model.
-
getText
Get text to display in a text area.- Returns:
- text to display in a text area.
-
getTitle
Returns title for the main frame.- Returns:
- title for the main frame.
-
isReloadActionEnabled
Returns true if the reload action is enabled, false otherwise.- Returns:
- true if the reload action is enabled.
-
shouldAcceptFile
Whether a file chooser should accept the file as a source file.- Parameters:
file
- the file to check.- Returns:
- true if the file should be accepted.
-
getLastDirectory
Get the directory of the last loaded file.- Returns:
- directory of the last loaded file.
-
getCurrentFile
Get current file.- Returns:
- current file.
-
getLinesToPosition
Get lines to position map. It returns unmodifiable collection to prevent additional overhead of copying and possible state modifications.- Returns:
- lines to position map.
-
openFile
Open file and load the file.- Parameters:
file
- the file to open.- Throws:
CheckstyleException
- if the file can not be parsed.IllegalArgumentException
- if parseMode is unknown
-
getFileText
Get FileText from a file.- Parameters:
file
- the file to get the FileText from.- Returns:
- the FileText.
- Throws:
IOException
- if the file could not be read.
-