1 | /*
|
---|
2 | * 09/23/2005
|
---|
3 | *
|
---|
4 | * ParserNotice.java - A notice (i.e, and error or warning) from a parser.
|
---|
5 | *
|
---|
6 | * This library is distributed under a modified BSD license. See the included
|
---|
7 | * RSyntaxTextArea.License.txt file for details.
|
---|
8 | */
|
---|
9 | package org.fife.ui.rsyntaxtextarea.parser;
|
---|
10 |
|
---|
11 | import java.awt.Color;
|
---|
12 |
|
---|
13 |
|
---|
14 | /**
|
---|
15 | * A notice (e.g., a warning or error) from a parser.
|
---|
16 | *
|
---|
17 | * @author Robert Futrell
|
---|
18 | * @version 1.0
|
---|
19 | * @see DefaultParserNotice
|
---|
20 | */
|
---|
21 | public interface ParserNotice extends Comparable {
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * Indicates an info notice.
|
---|
25 | */
|
---|
26 | public static final int INFO = 2;
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * Indicates a warning notice.
|
---|
30 | */
|
---|
31 | public static final int WARNING = 1;
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Indicates an error notice.
|
---|
35 | */
|
---|
36 | public static final int ERROR = 0;
|
---|
37 |
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * Returns whether this parser notice contains the specified location
|
---|
41 | * in the document.
|
---|
42 | *
|
---|
43 | * @param pos The position in the document.
|
---|
44 | * @return Whether the position is contained. This will always return
|
---|
45 | * <code>false</code> if {@link #getOffset()} returns
|
---|
46 | * <code>-1</code>.
|
---|
47 | */
|
---|
48 | public boolean containsPosition(int pos);
|
---|
49 |
|
---|
50 |
|
---|
51 | /**
|
---|
52 | * Returns the color to use when painting this notice.
|
---|
53 | *
|
---|
54 | * @return The color.
|
---|
55 | */
|
---|
56 | public Color getColor();
|
---|
57 |
|
---|
58 |
|
---|
59 | /**
|
---|
60 | * Returns the length of the code the message is concerned with.
|
---|
61 | *
|
---|
62 | * @return The length of the code the message is concerned with, or
|
---|
63 | * <code>-1</code> if unknown.
|
---|
64 | * @see #getOffset()
|
---|
65 | * @see #getLine()
|
---|
66 | */
|
---|
67 | public int getLength();
|
---|
68 |
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Returns the level of this notice.
|
---|
72 | *
|
---|
73 | * @return One of {@link #INFO}, {@link #WARNING} OR {@link #ERROR}.
|
---|
74 | */
|
---|
75 | public int getLevel();
|
---|
76 |
|
---|
77 |
|
---|
78 | /**
|
---|
79 | * Returns the line number the notice is about.
|
---|
80 | *
|
---|
81 | * @return The line number.
|
---|
82 | */
|
---|
83 | public int getLine();
|
---|
84 |
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Returns the message from the parser.
|
---|
88 | *
|
---|
89 | * @return The message from the parser.
|
---|
90 | */
|
---|
91 | public String getMessage();
|
---|
92 |
|
---|
93 |
|
---|
94 | /**
|
---|
95 | * Returns the offset of the code the message is concerned with.
|
---|
96 | *
|
---|
97 | * @return The offset, or <code>-1</code> if unknown.
|
---|
98 | * @see #getLength()
|
---|
99 | * @see #getLine()
|
---|
100 | */
|
---|
101 | public int getOffset();
|
---|
102 |
|
---|
103 |
|
---|
104 | /**
|
---|
105 | * Returns the parser that created this message.
|
---|
106 | *
|
---|
107 | * @return The parser.
|
---|
108 | */
|
---|
109 | public Parser getParser();
|
---|
110 |
|
---|
111 |
|
---|
112 | /**
|
---|
113 | * Whether a squiggle underline should be drawn in the editor for this
|
---|
114 | * notice.
|
---|
115 | *
|
---|
116 | * @return Whether a squiggle underline should be drawn.
|
---|
117 | */
|
---|
118 | public boolean getShowInEditor();
|
---|
119 |
|
---|
120 |
|
---|
121 | /**
|
---|
122 | * Returns the tooltip text to display for this notice.
|
---|
123 | *
|
---|
124 | * @return The tool tip text. If none has been explicitly set, this
|
---|
125 | * method returns the same text as {@link #getMessage()}.
|
---|
126 | */
|
---|
127 | public String getToolTipText();
|
---|
128 |
|
---|
129 |
|
---|
130 | } |
---|