当前位置: 首页>>代码示例>>Java>>正文


Java RSyntaxUtilities.getNextImportantToken方法代码示例

本文整理汇总了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;

}
 
开发者ID:pyros2097,项目名称:GdxStudio,代码行数:65,代码来源:JavaLinkGenerator.java

示例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;

}
 
开发者ID:bobbylight,项目名称:RSTALanguageSupport,代码行数:67,代码来源:JavaLinkGenerator.java


注:本文中的org.fife.ui.rsyntaxtextarea.RSyntaxUtilities.getNextImportantToken方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。