Revision 212 trunk/org.gvsig.scripting/org.gvsig.scripting.swing/org.gvsig.scripting.swing.impl/src/main/java/org/gvsig/scripting/swing/impl/syntaxhighlight/styles/PythonStyledDocument.java
PythonStyledDocument.java | ||
---|---|---|
2 | 2 |
|
3 | 3 |
import java.awt.Color; |
4 | 4 |
import java.util.HashSet; |
5 |
import java.util.Set; |
|
5 | 6 |
|
6 | 7 |
import javax.swing.text.AttributeSet; |
7 | 8 |
import javax.swing.text.BadLocationException; |
... | ... | |
18 | 19 |
*/ |
19 | 20 |
private static final long serialVersionUID = 2859530660266127826L; |
20 | 21 |
|
21 |
private DefaultStyledDocument doc; |
|
22 |
private Element rootElement; |
|
22 |
private final DefaultStyledDocument doc;
|
|
23 |
private final Element rootElement;
|
|
23 | 24 |
|
24 | 25 |
private boolean multiLineComment; |
25 |
private MutableAttributeSet normal; |
|
26 |
private MutableAttributeSet keyword; |
|
27 |
private MutableAttributeSet comment; |
|
28 |
private MutableAttributeSet quote; |
|
29 |
private MutableAttributeSet identifiers; |
|
26 |
private final MutableAttributeSet normal;
|
|
27 |
private final MutableAttributeSet keyword;
|
|
28 |
private final MutableAttributeSet comment;
|
|
29 |
private final MutableAttributeSet quote;
|
|
30 |
private final MutableAttributeSet identifiers;
|
|
30 | 31 |
|
31 |
private HashSet keywords;
|
|
32 |
private final Set<String> keywords;
|
|
32 | 33 |
|
33 |
|
|
34 |
|
|
35 | 34 |
public PythonStyledDocument() { |
36 | 35 |
doc = this; |
37 | 36 |
rootElement = doc.getDefaultRootElement(); |
... | ... | |
72 | 71 |
StyleConstants.setBold(quote, true); |
73 | 72 |
StyleConstants.setFontSize(quote, fontSize); |
74 | 73 |
|
75 |
keywords = new HashSet();
|
|
74 |
keywords = new HashSet<String>();
|
|
76 | 75 |
keywords.add("except"); |
77 | 76 |
keywords.add("class"); |
78 | 77 |
keywords.add("continue"); |
... | ... | |
148 | 147 |
/* |
149 | 148 |
* Override to apply syntax highlighting after the document has been updated |
150 | 149 |
*/ |
151 |
public void insertString(int offset, String str, AttributeSet a) |
|
150 |
@Override |
|
151 |
public void insertString(int offset, String str, AttributeSet a) |
|
152 | 152 |
throws BadLocationException { |
153 | 153 |
super.insertString(offset, str, a); |
154 | 154 |
processChangedLines(offset, str.length()); |
... | ... | |
157 | 157 |
/* |
158 | 158 |
* Override to apply syntax highlighting after the document has been updated |
159 | 159 |
*/ |
160 |
public void remove(int offset, int length) throws BadLocationException { |
|
160 |
@Override |
|
161 |
public void remove(int offset, int length) throws BadLocationException { |
|
161 | 162 |
super.remove(offset, length); |
162 | 163 |
processChangedLines(offset, 0); |
163 | 164 |
} |
Also available in: Unified diff