public class MainFrameModel
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
MainFrameModel.ParseMode
Parsing modes which available in GUI.
|
Modifier and Type | Field and Description |
---|---|
private java.io.File |
currentFile
The file which is being parsed.
|
private java.util.List<java.lang.Integer> |
linesToPosition
Lines to position map.
|
private MainFrameModel.ParseMode |
parseMode
Current mode.
|
private ParseTreeTableModel |
parseTreeTableModel
Parse tree model.
|
private boolean |
reloadActionEnabled
Whether the reload action is enabled.
|
private java.lang.String |
text
Text for a frame's text area.
|
private java.lang.String |
title
Title for the main frame.
|
Constructor and Description |
---|
MainFrameModel()
Instantiate the model.
|
Modifier and Type | Method and Description |
---|---|
java.io.File |
getCurrentFile()
Get current file.
|
FileText |
getFileText(java.io.File file)
Get FileText from a file.
|
java.io.File |
getLastDirectory()
Get the directory of the last loaded file.
|
java.util.List<java.lang.Integer> |
getLinesToPosition()
Get lines to position map.
|
ParseTreeTableModel |
getParseTreeTableModel()
Get parse tree table model.
|
java.lang.String |
getText()
Get text to display in a text area.
|
java.lang.String |
getTitle()
Returns title for the main frame.
|
boolean |
isReloadActionEnabled()
Returns true if the reload action is enabled, false otherwise.
|
void |
openFile(java.io.File file)
Open file and load the file.
|
DetailAST |
parseFile(java.io.File file)
Parse a file and return the parse tree.
|
DetailAST |
parseFileWithComments(java.io.File file)
Parse a file and return the parse tree with comment nodes.
|
void |
setParseMode(MainFrameModel.ParseMode mode)
Set current parse mode.
|
static boolean |
shouldAcceptFile(java.io.File file)
Whether a file chooser should accept the file as a source file.
|
private final java.util.List<java.lang.Integer> linesToPosition
private final ParseTreeTableModel parseTreeTableModel
private MainFrameModel.ParseMode parseMode
private java.io.File currentFile
private java.lang.String text
private java.lang.String title
private boolean reloadActionEnabled
public void setParseMode(MainFrameModel.ParseMode mode)
mode
- ParseMode enum.public ParseTreeTableModel getParseTreeTableModel()
public java.lang.String getText()
public java.lang.String getTitle()
public boolean isReloadActionEnabled()
public static boolean shouldAcceptFile(java.io.File file)
file
- the file to check.public java.io.File getLastDirectory()
public java.io.File getCurrentFile()
public java.util.List<java.lang.Integer> getLinesToPosition()
public void openFile(java.io.File file) throws CheckstyleException
file
- the file to open.CheckstyleException
- if the file can not be parsed.public DetailAST parseFile(java.io.File file) throws java.io.IOException, antlr.ANTLRException
file
- the file to parse.java.io.IOException
- if the file could not be read.antlr.ANTLRException
- if the file is not a Java source.public DetailAST parseFileWithComments(java.io.File file) throws java.io.IOException, antlr.ANTLRException
file
- the file to parse.java.io.IOException
- if the file could not be read.antlr.ANTLRException
- if the file is not a Java source.public FileText getFileText(java.io.File file) throws java.io.IOException
file
- the file to get the FileText from.java.io.IOException
- if the file could not be read.