Class DefaultParserNotice
java.lang.Object
org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice
- All Implemented Interfaces:
Comparable<ParserNotice>
,ParserNotice
- Direct Known Subclasses:
TaskTagParser.TaskNotice
Base implementation of a parser notice. Most
Parser
implementations can return instances of this in their parse result.- Version:
- 1.0
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.fife.ui.rsyntaxtextarea.parser.ParserNotice
ParserNotice.Level
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionDefaultParserNotice
(Parser parser, String msg, int line) Constructor.DefaultParserNotice
(Parser parser, String message, int line, int offset, int length) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionint
compareTo
(ParserNotice other) Compares this parser notice to another.boolean
containsPosition
(int pos) Returns whether this parser notice contains the specified location in the document.boolean
Returns whether this parser notice is equal to another one.getColor()
Returns the color to use when painting this notice.boolean
Returns whether this parser notice has offset and length information (as opposed to just what line number to mark).int
Returns the length of the code the message is concerned with.getLevel()
Returns the level of this notice.int
getLine()
Returns the line number the notice is about.Returns the message from the parser.int
Returns the offset of the code the message is concerned with.Returns the parser that created this message.boolean
Whether a squiggle underline should be drawn in the editor for this notice.Returns the tool tip text to display for this notice.int
hashCode()
Returns the hash code for this notice.void
Sets the color to use when painting this notice.void
setLevel
(ParserNotice.Level level) Sets the level of this notice.void
setShowInEditor
(boolean show) Sets whether a squiggle underline should be drawn in the editor for this notice.void
setToolTipText
(String text) Sets the tool tip text to display for this notice.toString()
Returns a string representation of this parser notice.
-
Field Details
-
parser
-
level
-
line
private int line -
offset
private int offset -
length
private int length -
showInEditor
private boolean showInEditor -
color
-
message
-
toolTipText
-
DEFAULT_COLORS
-
-
Constructor Details
-
DefaultParserNotice
Constructor.- Parameters:
parser
- The parser that created this notice.msg
- The text of the message.line
- The line number for the message.
-
DefaultParserNotice
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-1
if unknown.length
- The length of the code the message is concerned with, or-1
if unknown.
-
-
Method Details
-
compareTo
Compares this parser notice to another.- Specified by:
compareTo
in 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) Description copied from interface:ParserNotice
Returns whether this parser notice contains the specified location in the document.- Specified by:
containsPosition
in interfaceParserNotice
- Parameters:
pos
- The position in the document.- Returns:
- Whether the position is contained. This will always return
false
ifParserNotice.getOffset()
returns-1
.
-
equals
Returns whether this parser notice is equal to another one. -
getColor
Description copied from interface:ParserNotice
Returns the color to use when painting this notice.- Specified by:
getColor
in interfaceParserNotice
- Returns:
- The color.
-
getKnowsOffsetAndLength
public boolean getKnowsOffsetAndLength()Description copied from interface:ParserNotice
Returns whether this parser notice has offset and length information (as opposed to just what line number to mark).- Specified by:
getKnowsOffsetAndLength
in interfaceParserNotice
- Returns:
- Whether the offset and length of the notice are specified.
- See Also:
-
getLength
public int getLength()Description copied from interface:ParserNotice
Returns the length of the code the message is concerned with.- Specified by:
getLength
in interfaceParserNotice
- Returns:
- The length of the code the message is concerned with, or
-1
if unknown. - See Also:
-
getLevel
Description copied from interface:ParserNotice
Returns the level of this notice.- Specified by:
getLevel
in interfaceParserNotice
- Returns:
- A value from the
ParserNotice.Level
enumeration.
-
getLine
public int getLine()Description copied from interface:ParserNotice
Returns the line number the notice is about.- Specified by:
getLine
in interfaceParserNotice
- Returns:
- The line number.
-
getMessage
Description copied from interface:ParserNotice
Returns the message from the parser.- Specified by:
getMessage
in interfaceParserNotice
- Returns:
- The message from the parser.
-
getOffset
public int getOffset()Description copied from interface:ParserNotice
Returns the offset of the code the message is concerned with.- Specified by:
getOffset
in interfaceParserNotice
- Returns:
- The offset, or
-1
if unknown. - See Also:
-
getParser
Description copied from interface:ParserNotice
Returns the parser that created this message.- Specified by:
getParser
in interfaceParserNotice
- Returns:
- The parser.
-
getShowInEditor
public boolean getShowInEditor()Description copied from interface:ParserNotice
Whether a squiggle underline should be drawn in the editor for this notice.- Specified by:
getShowInEditor
in interfaceParserNotice
- Returns:
- Whether a squiggle underline should be drawn.
-
getToolTipText
Description copied from interface:ParserNotice
Returns the tool tip text to display for this notice.- Specified by:
getToolTipText
in 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
Sets the color to use when painting this notice.- Parameters:
color
- The color to use.- See Also:
-
setLevel
Sets the level of this notice.- Parameters:
level
- The new level.- See Also:
-
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:
-
setToolTipText
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:
-
toString
Returns a string representation of this parser notice.
-