本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.RSyntaxUtilities.getNextImportantToken方法的典型用法代码示例。如果您正苦于以下问题:Java RSyntaxUtilities.getNextImportantToken方法的具体用法?Java RSyntaxUtilities.getNextImportantToken怎么用?Java RSyntaxUtilities.getNextImportantToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.fife.ui.rsyntaxtextarea.RSyntaxUtilities
的用法示例。
在下文中一共展示了RSyntaxUtilities.getNextImportantToken方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkForLinkableToken
import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; //导入方法依赖的package包/类
/**
* Checks if the token at the specified offset is possibly a "click-able"
* region.
*
* @param textArea The text area.
* @param offs The offset, presumably at the mouse position.
* @return A result object.
*/
private IsLinkableCheckResult checkForLinkableToken(
RSyntaxTextArea textArea, int offs) {
IsLinkableCheckResult result = null;
if (offs>=0) {
try {
int line = textArea.getLineOfOffset(offs);
Token first = textArea.getTokenListForLine(line);
Token prev = null;
for (Token t=first; t!=null && t.isPaintable(); t=t.getNextToken()) {
if (t.containsPosition(offs)) {
// RSTA's tokens are pooled and re-used, so we must
// defensively make a copy of the one we want to keep!
Token token = new TokenImpl(t);
boolean isMethod = false;
if (prev==null) {
prev = RSyntaxUtilities.getPreviousImportantToken(textArea, line-1);
}
if (prev!=null && prev.isSingleChar('.')) {
// Not a field or method defined in this class.
break;
}
Token next = RSyntaxUtilities.getNextImportantToken(
t.getNextToken(), textArea, line);
if (next!=null && next.isSingleChar(Token.SEPARATOR, '(')) {
isMethod = true;
}
result = new IsLinkableCheckResult(token, isMethod);
break;
}
else if (!t.isCommentOrWhitespace()) {
prev = t;
}
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
}
}
return result;
}
示例2: checkForLinkableToken
import org.fife.ui.rsyntaxtextarea.RSyntaxUtilities; //导入方法依赖的package包/类
/**
* Checks if the token at the specified offset is possibly a "click-able"
* region.
*
* @param textArea The text area.
* @param offs The offset, presumably at the mouse position.
* @return A result object.
*/
private IsLinkableCheckResult checkForLinkableToken(
RSyntaxTextArea textArea, int offs) {
IsLinkableCheckResult result = null;
if (offs>=0) {
try {
int line = textArea.getLineOfOffset(offs);
Token first = textArea.getTokenListForLine(line);
RSyntaxDocument doc = (RSyntaxDocument)textArea.getDocument();
Token prev = null;
for (Token t=first; t!=null && t.isPaintable(); t=t.getNextToken()) {
if (t.containsPosition(offs)) {
// RSTA's tokens are pooled and re-used, so we must
// defensively make a copy of the one we want to keep!
Token token = new TokenImpl(t);
boolean isMethod = false;
if (prev==null) {
prev = RSyntaxUtilities.getPreviousImportantToken(
doc, line-1);
}
if (prev!=null && prev.isSingleChar('.')) {
// Not a field or method defined in this class.
break;
}
Token next = RSyntaxUtilities.getNextImportantToken(
t.getNextToken(), textArea, line);
if (next!=null && next.isSingleChar(Token.SEPARATOR, '(')) {
isMethod = true;
}
result = new IsLinkableCheckResult(token, isMethod);
break;
}
else if (!t.isCommentOrWhitespace()) {
prev = t;
}
}
} catch (BadLocationException ble) {
ble.printStackTrace(); // Never happens
}
}
return result;
}