Class DefaultParserNotice
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice
-
- All Implemented Interfaces:
Comparable<ParserNotice>,ParserNotice
- Direct Known Subclasses:
TaskTagParser.TaskNotice
public class DefaultParserNotice extends Object implements ParserNotice
Base implementation of a parser notice. MostParserimplementations can return instances of this in their parse result.- See Also:
Parser,ParseResult
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.fife.ui.rsyntaxtextarea.parser.ParserNotice
ParserNotice.Level
-
-
Constructor Summary
Constructors Constructor Description DefaultParserNotice(Parser parser, String msg, int line)Constructor.DefaultParserNotice(Parser parser, String message, int line, int offset, int length)Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompareTo(ParserNotice other)Compares this parser notice to another.booleancontainsPosition(int pos)Returns whether this parser notice contains the specified location in the document.booleanequals(Object obj)Returns whether this parser notice is equal to another one.ColorgetColor()Returns the color to use when painting this notice.booleangetKnowsOffsetAndLength()Returns whether this parser notice has offset and length information (as opposed to just what line number to mark).intgetLength()Returns the length of the code the message is concerned with.ParserNotice.LevelgetLevel()Returns the level of this notice.intgetLine()Returns the line number the notice is about.StringgetMessage()Returns the message from the parser.intgetOffset()Returns the offset of the code the message is concerned with.ParsergetParser()Returns the parser that created this message.booleangetShowInEditor()Whether a squiggle underline should be drawn in the editor for this notice.StringgetToolTipText()Returns the tool tip text to display for this notice.inthashCode()Returns the hash code for this notice.voidsetColor(Color color)Sets the color to use when painting this notice.voidsetLevel(ParserNotice.Level level)Sets the level of this notice.voidsetShowInEditor(boolean show)Sets whether a squiggle underline should be drawn in the editor for this notice.voidsetToolTipText(String text)Sets the tool tip text to display for this notice.StringtoString()Returns a string representation of this parser notice.
-
-
-
Constructor Detail
-
DefaultParserNotice
public DefaultParserNotice(Parser parser, String msg, int line)
Constructor.- Parameters:
parser- The parser that created this notice.msg- The text of the message.line- The line number for the message.
-
DefaultParserNotice
public DefaultParserNotice(Parser parser, String message, int line, int offset, int length)
Constructor.- Parameters:
parser- The parser that created this notice.message- The message.line- The line number corresponding to the message.offset- The offset in the input stream of the code the message is concerned with, or-1if unknown.length- The length of the code the message is concerned with, or-1if unknown.
-
-
Method Detail
-
compareTo
public int compareTo(ParserNotice other)
Compares this parser notice to another.- Specified by:
compareToin interfaceComparable<ParserNotice>- Parameters:
other- Another parser notice.- Returns:
- How the two parser notices should be sorted relative to one another.
-
containsPosition
public boolean containsPosition(int pos)
Returns whether this parser notice contains the specified location in the document.- Specified by:
containsPositionin interfaceParserNotice- Parameters:
pos- The position in the document.- Returns:
- Whether the position is contained. This will always return
falseifParserNotice.getOffset()returns-1.
-
equals
public boolean equals(Object obj)
Returns whether this parser notice is equal to another one.
-
getColor
public Color getColor()
Returns the color to use when painting this notice.- Specified by:
getColorin interfaceParserNotice- Returns:
- The color.
-
getKnowsOffsetAndLength
public boolean getKnowsOffsetAndLength()
Returns whether this parser notice has offset and length information (as opposed to just what line number to mark).- Specified by:
getKnowsOffsetAndLengthin interfaceParserNotice- Returns:
- Whether the offset and length of the notice are specified.
- See Also:
ParserNotice.getLine(),ParserNotice.getOffset(),ParserNotice.getLength()
-
getLength
public int getLength()
Returns the length of the code the message is concerned with.- Specified by:
getLengthin interfaceParserNotice- Returns:
- The length of the code the message is concerned with, or
-1if unknown. - See Also:
ParserNotice.getOffset(),ParserNotice.getLine()
-
getLevel
public ParserNotice.Level getLevel()
Returns the level of this notice.- Specified by:
getLevelin interfaceParserNotice- Returns:
- A value from the
ParserNotice.Levelenumeration.
-
getLine
public int getLine()
Returns the line number the notice is about.- Specified by:
getLinein interfaceParserNotice- Returns:
- The line number.
-
getMessage
public String getMessage()
Returns the message from the parser.- Specified by:
getMessagein interfaceParserNotice- Returns:
- The message from the parser.
-
getOffset
public int getOffset()
Returns the offset of the code the message is concerned with.- Specified by:
getOffsetin interfaceParserNotice- Returns:
- The offset, or
-1if unknown. - See Also:
ParserNotice.getLength(),ParserNotice.getLine()
-
getParser
public Parser getParser()
Returns the parser that created this message.- Specified by:
getParserin interfaceParserNotice- Returns:
- The parser.
-
getShowInEditor
public boolean getShowInEditor()
Whether a squiggle underline should be drawn in the editor for this notice.- Specified by:
getShowInEditorin interfaceParserNotice- Returns:
- Whether a squiggle underline should be drawn.
-
getToolTipText
public String getToolTipText()
Returns the tool tip text to display for this notice.- Specified by:
getToolTipTextin interfaceParserNotice- Returns:
- The tool tip text. If none has been explicitly set, this
method returns the same text as
ParserNotice.getMessage().
-
hashCode
public int hashCode()
Returns the hash code for this notice.
-
setColor
public void setColor(Color color)
Sets the color to use when painting this notice.- Parameters:
color- The color to use.- See Also:
getColor()
-
setLevel
public void setLevel(ParserNotice.Level level)
Sets the level of this notice.- Parameters:
level- The new level.- See Also:
getLevel()
-
setShowInEditor
public void setShowInEditor(boolean show)
Sets whether a squiggle underline should be drawn in the editor for this notice.- Parameters:
show- Whether to draw a squiggle underline.- See Also:
getShowInEditor()
-
setToolTipText
public void setToolTipText(String text)
Sets the tool tip text to display for this notice.- Parameters:
text- The new tool tip text. This can be HTML. If this isnull, then tool tips will return the same text asgetMessage().- See Also:
getToolTipText()
-
-