Skip to content

Commit fd36ee1

Browse files
committed
Avoid accessing TokenType constants via Token instances
Signed-off-by: Johannes Schindelin <[email protected]>
1 parent aa3f8e0 commit fd36ee1

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/main/java/net/imagej/ui/swing/script/TokenFunctions.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343

4444
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
4545
import org.fife.ui.rsyntaxtextarea.Token;
46+
import org.fife.ui.rsyntaxtextarea.TokenTypes;
4647

4748
/**
4849
* TODO
@@ -57,7 +58,7 @@ public TokenFunctions(RSyntaxTextArea textArea) {
5758
}
5859

5960
public static boolean tokenEquals(Token token, char[] text) {
60-
if (token.getType() != token.RESERVED_WORD ||
61+
if (token.getType() != TokenTypes.RESERVED_WORD ||
6162
token.length() != text.length)
6263
return false;
6364
final char[] tokenText = token.getTextArray();
@@ -70,7 +71,7 @@ public static boolean tokenEquals(Token token, char[] text) {
7071
}
7172

7273
public static boolean isIdentifier(Token token) {
73-
if (token.getType() != token.IDENTIFIER)
74+
if (token.getType() != TokenTypes.IDENTIFIER)
7475
return false;
7576
final char[] tokenText = token.getTextArray();
7677
final int textOffset = token.getTextOffset();
@@ -135,7 +136,7 @@ public Iterator<Token> iterator() {
135136
}
136137

137138
public static boolean isDot(Token token) {
138-
if (token.getType() != token.IDENTIFIER) return false;
139+
if (token.getType() != TokenTypes.IDENTIFIER) return false;
139140
final char[] tokenText = token.getTextArray();
140141
return tokenText != null && token.length() == 1 && tokenText[token.getTextOffset()] == '.';
141142
}
@@ -216,7 +217,7 @@ Token skipNonCode(TokenIterator iter, Token current) {
216217
int skipToEOL(TokenIterator iter, Token current) {
217218
int end = textArea.getDocument().getLength();
218219
for (;;) {
219-
if (current.getType() == current.NULL || !iter.hasNext())
220+
if (current.getType() == TokenTypes.NULL || !iter.hasNext())
220221
return end;
221222
end = current.getEndOffset();
222223
current = iter.next();
@@ -308,7 +309,7 @@ public void addImport(String className) {
308309
boolean insertLF = false;
309310
while (iter.hasNext()) {
310311
Token token = iter.next();
311-
if (token.getType() != token.RESERVED_WORD) {
312+
if (token.getType() != TokenTypes.RESERVED_WORD) {
312313
insertLF = false;
313314
continue;
314315
}

0 commit comments

Comments
 (0)