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


Java Token.isPaintable方法代码示例

本文整理汇总了Java中org.fife.ui.rsyntaxtextarea.Token.isPaintable方法的典型用法代码示例。如果您正苦于以下问题:Java Token.isPaintable方法的具体用法?Java Token.isPaintable怎么用?Java Token.isPaintable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.fife.ui.rsyntaxtextarea.Token的用法示例。


在下文中一共展示了Token.isPaintable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testIdentifiers

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testIdentifiers() {

	String code =  "   foo bar\t\tbas\t  \tbaz ";
	PlainTextTokenMaker tm = new PlainTextTokenMaker();

	Segment segment = createSegment(code);

	Token token = tm.getTokenList(segment, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isWhitespace());
	token = token.getNextToken();

	while (token != null && token.isPaintable()) {
		Assert.assertEquals("Not an identifier: " + token, TokenTypes.IDENTIFIER, token.getType());
		token = token.getNextToken();
		Assert.assertTrue(token.isWhitespace());
		token = token.getNextToken();
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:21,代码来源:PlainTextTokenMakerTest.java

示例2: testWhitespace

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testWhitespace() {

	String code =  "   foo bar\t\tbas\t  \tbaz ";
	PlainTextTokenMaker tm = new PlainTextTokenMaker();

	Segment segment = createSegment(code);

	Token token = tm.getTokenList(segment, TokenTypes.NULL, 0);
	Assert.assertTrue(token.isWhitespace());
	token = token.getNextToken();

	while (token != null && token.isPaintable()) {
		Assert.assertEquals("Not an identifier: " + token, TokenTypes.IDENTIFIER, token.getType());
		token = token.getNextToken();
		Assert.assertTrue(token.isWhitespace());
		token = token.getNextToken();
	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:21,代码来源:PlainTextTokenMakerTest.java

示例3: parse

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
public ParseResult parse(RSyntaxDocument doc, String style) {

		Element root = doc.getDefaultRootElement();
		int lineCount = root.getElementCount();

		if (taskPattern==null ||
				style==null || SyntaxConstants.SYNTAX_STYLE_NONE.equals(style)){
			result.clearNotices();
			result.setParsedLines(0, lineCount-1);
			return result;
		}

		// TODO: Pass in parsed line range and just do that
		result.clearNotices();
		result.setParsedLines(0, lineCount-1);

		for (int line=0; line<lineCount; line++) {

			Token t = doc.getTokenListForLine(line);
			int offs = -1;
			int start = -1;
			String text = null;

			while (t!=null && t.isPaintable()) {
				if (t.isComment()) {

					offs = t.getOffset();
					text = t.getLexeme();

					Matcher m = taskPattern.matcher(text);
					if (m.find()) {
						start = m.start();
						offs += start;
						break;
					}

				}
				t = t.getNextToken();
			}

			if (start>-1) {
				text = text.substring(start);
				// TODO: Strip off end of MLC's if they're there.
				int len = text.length();
				TaskNotice pn = new TaskNotice(this, text, line+1, offs, len);
				pn.setLevel(ParserNotice.Level.INFO);
				pn.setShowInEditor(false);
				pn.setColor(COLOR);
				result.addNotice(pn);
			}

		}

		return result;

	}
 
开发者ID:curiosag,项目名称:ftc,代码行数:57,代码来源:TaskTagParser.java

示例4: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		JavaScriptTokenMaker tm = new JavaScriptTokenMaker();

		Token token = tm.getTokenList(segment, JS_PREV_TOKEN_TYPE, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:35,代码来源:JavaScriptTokenMakerTest.java

示例5: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, HTMLTokenMaker.INTERNAL_IN_JS, 0);
		Assert.assertEquals("nope - " + token, TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:35,代码来源:HTMLTokenMakerTest.java

示例6: testTS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testTS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, TS_PREV_TOKEN_TYPE, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:35,代码来源:TypeScriptTokenMakerTest.java

示例7: testJS_EolComments_URL

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
@Test
public void testJS_EolComments_URL() {

	String[] eolCommentLiterals = {
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		"// Hello world http://www.sas.com",
		"// Hello world http://www.sas.com extra",
	};

	for (String code : eolCommentLiterals) {

		Segment segment = createSegment(code);
		TokenMaker tm = createTokenMaker();

		Token token = tm.getTokenList(segment, TokenTypes.NULL, 0);
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());

		token = token.getNextToken();
		Assert.assertTrue(token.isHyperlink());
		Assert.assertEquals(TokenTypes.COMMENT_EOL, token.getType());
		Assert.assertEquals("http://www.sas.com", token.getLexeme());

		token = token.getNextToken();
		// Note: The 0-length token at the end of the first example is a
		// minor bug/performance thing
		if (token != null && token.isPaintable() && token.length() > 0) {
			Assert.assertFalse(token.isHyperlink());
			Assert.assertTrue(token.is(TokenTypes.COMMENT_EOL, " extra"));
		}

	}

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:35,代码来源:ActionScriptTokenMakerTest.java

示例8: getToolTipText

import org.fife.ui.rsyntaxtextarea.Token; //导入方法依赖的package包/类
/**
 * Overridden to show the content of a collapsed fold on mouse-overs.
 *
 * @param e The mouse location.
 */
@Override
public String getToolTipText(MouseEvent e) {

	String text = null;

	RSyntaxTextArea rsta = (RSyntaxTextArea)textArea;
	if (rsta.isCodeFoldingEnabled()) {
		FoldManager fm = rsta.getFoldManager();
		int pos = rsta.viewToModel(new Point(0, e.getY()));
		if (pos>=0) { // Not -1
			int line = 0;
			try {
				line = rsta.getLineOfOffset(pos);
			} catch (BadLocationException ble) {
				ble.printStackTrace(); // Never happens
				return null;
			}
			Fold fold = fm.getFoldForLine(line);
			if (fold!=null && fold.isCollapsed()) {

				int endLine = fold.getEndLine();
				if (fold.getLineCount()>25) { // Not too big
					endLine = fold.getStartLine() + 25;
				}

				StringBuilder sb = new StringBuilder("<html><nobr>");
				while (line<=endLine && line<rsta.getLineCount()) { // Sanity
					Token t = rsta.getTokenListForLine(line);
					while (t!=null && t.isPaintable()) {
						t.appendHTMLRepresentation(sb, rsta, true, true);
						t = t.getNextToken();
					}
					sb.append("<br>");
					line++;
				}

				text = sb.toString();

			}
		}
	}

	return text;

}
 
开发者ID:curiosag,项目名称:ftc,代码行数:51,代码来源:FoldIndicator.java


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