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


Java TokenMap类代码示例

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


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

示例1: updateCompletionProvider

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
/**
 * para o editor do jifi usar:
 *
 * updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
 * updateCompletionProvider("s3f.jifi.functions.*","tokenInfo");
 *
 *
 * @param em
 * @param path
 * @param property
 */
public final void updateCompletionProvider(EntityManager em, String path, String property) {

    AbstractTokenMakerFactory atmf = (AbstractTokenMakerFactory) TokenMakerFactory.getDefaultInstance();
    TokenMaker tokenMaker = atmf.getTokenMaker(textArea.getSyntaxEditingStyle());
    TokenMap tokenMap = null;
    if (tokenMaker instanceof ExtensibleTokenMaker) {
        tokenMap = ((ExtensibleTokenMaker) tokenMaker).getTokenMap();
    }

    for (Object o : em.getAllProperties(path, property, Object.class)) {
        if (o instanceof Completion) {
            completionProvider.addCompletion((Completion) o);
            if (tokenMap != null) {
                //TODO: verificar!
                tokenMap.put(((Completion) o).getReplacementText(), Token.FUNCTION);
            }
        } else {
            completionProvider.addCompletion(
                    new BasicCompletion(completionProvider, o.toString())
            );
            if (tokenMap != null) {
                //TODO: verificar!
                tokenMap.put(o.toString(), Token.DATA_TYPE);
            }
        }
    }
}
 
开发者ID:anderson-,项目名称:S3F,代码行数:39,代码来源:CodeEditorTab.java

示例2: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
/**
 * Returns the words to highlight for the Groove control language.
 *
 * @return A <code>TokenMap</code> containing the words to highlight for the
 *         Groove control language.
 * @see org.fife.ui.rsyntaxtextarea.AbstractTokenMaker#getWordsToHighlight
 */
@Override
public TokenMap getWordsToHighlight() {

    TokenMap tokenMap = new TokenMap();

    int reservedWord = Token.RESERVED_WORD;
    tokenMap.put("alap", reservedWord);
    tokenMap.put("any", reservedWord);
    tokenMap.put("choice", reservedWord);
    tokenMap.put("do", reservedWord);
    tokenMap.put("else", reservedWord);
    tokenMap.put("function", reservedWord);
    tokenMap.put("if", reservedWord);
    tokenMap.put("import", reservedWord);
    tokenMap.put("or", reservedWord);
    tokenMap.put("other", reservedWord);
    tokenMap.put("package", reservedWord);
    tokenMap.put("priority", reservedWord);
    tokenMap.put("recipe", reservedWord);
    tokenMap.put("try", reservedWord);
    tokenMap.put("until", reservedWord);
    tokenMap.put("var", reservedWord);
    tokenMap.put("while", reservedWord);

    int literalBoolean = Token.LITERAL_BOOLEAN;
    tokenMap.put("false", literalBoolean);
    tokenMap.put("true", literalBoolean);

    int dataType = Token.DATA_TYPE;
    tokenMap.put("bool", dataType);
    tokenMap.put("float", dataType);
    tokenMap.put("int", dataType);
    tokenMap.put("node", dataType);
    tokenMap.put("string", dataType);
    tokenMap.put("out", dataType);

    return tokenMap;

}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:47,代码来源:CtrlTokenMaker.java

示例3: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
/**
 * Returns the words to highlight for UNIX shell scripts.
 *
 * @return A <code>TokenMap</code> containing the words to highlight for UNIX
 * shell scripts.
 * @see org.fife.ui.rsyntaxtextarea.AbstractTokenMaker#getWordsToHighlight
 */
@Override
public TokenMap getWordsToHighlight() {

  TokenMap tokenMap = new TokenMap();

  int reservedWord = Token.RESERVED_WORD;
  tokenMap.put("not", reservedWord);
  tokenMap.put("is", reservedWord);
  tokenMap.put(":-", reservedWord);
  tokenMap.put("?-", reservedWord);
  tokenMap.put("fail", reservedWord);
  tokenMap.put("repeat", reservedWord);
  tokenMap.put("true", reservedWord);
  tokenMap.put("false", reservedWord);
  tokenMap.put("::", reservedWord);
  tokenMap.put("div", reservedWord);
  tokenMap.put("mod", reservedWord);
  tokenMap.put("quot", reservedWord);
  tokenMap.put("rem", reservedWord);
  tokenMap.put("^", reservedWord);

  int function = Token.FUNCTION;
  tokenMap.put("op", function);

  int operator = Token.OPERATOR;
  tokenMap.put("=", operator);
  tokenMap.put("<", operator);
  tokenMap.put(">", operator);
  tokenMap.put("<>", operator);
  tokenMap.put("><", operator);
  tokenMap.put("<=", operator);
  tokenMap.put(">=", operator);
  tokenMap.put(":=", operator);
  tokenMap.put("==", operator);

  return tokenMap;

}
 
开发者ID:raydac,项目名称:jprol,代码行数:46,代码来源:JProlTokenMaker.java

示例4: createHightLightMap

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
private void createHightLightMap() {
	TokenMap myWordsToHighlight = new TokenMap();
	for (AutocompletionText word : words) {
		myWordsToHighlight.put(word.getText(), TokenTypes.RESERVED_WORD);
	}
	// use ugly static setter because OwnTokenMaker is unfortunately not instantiated by us
	OwnTokenMaker.setMyWordsToHighlight(myWordsToHighlight);
	// switch syntaxstyle to null and back to OwnTokenMaker to make sure the wordsToHighlight are reset!
	textArea.setSyntaxEditingStyle(null);
	textArea.setSyntaxEditingStyle(OwnTokenMaker.ID);
}
 
开发者ID:umlet,项目名称:umlet,代码行数:12,代码来源:OwnSyntaxPane.java

示例5: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight()
{
  TokenMap tokenMap = new TokenMap();

  tokenMap.put("%include", Token.RESERVED_WORD);

  return tokenMap;
}
 
开发者ID:WollMux,项目名称:WollMux,代码行数:10,代码来源:ConfigTokenMaker.java

示例6: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight() {
	final TokenMap tokenMap = new TokenMap();

	tokenMap.put("##", org.fife.ui.rsyntaxtextarea.Token.COMMENT_MARKUP);
	tokenMap.put("#*", Token.COMMENT_MULTILINE);
	tokenMap.put("*#", Token.COMMENT_MULTILINE);

	tokenMap.put("$", Token.VARIABLE);
	tokenMap.put("#if", Token.MARKUP_PROCESSING_INSTRUCTION);
	tokenMap.put("#end", Token.MARKUP_PROCESSING_INSTRUCTION);

	return tokenMap;
}
 
开发者ID:phon-ca,项目名称:phon-praat-plugin,代码行数:15,代码来源:VelocityTokenMaker.java

示例7: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight() {

	// add all words that should be highlighted
	TokenMap tokenMap = new TokenMap();

	// add known functions
	if (functions != null) {
		for (FunctionDescription function : functions) {
			// add the function name without the opening bracket
			// Token.RESERVED_WORD does only say in which style the function names are
			// rendered
			tokenMap.put(function.getDisplayName().split("\\(")[0], Token.RESERVED_WORD);
		}
	}
	// add regular attributes
	if (functionInputs != null) {
		for (FunctionInput input : functionInputs) {

			if (input.getCategory() == Category.DYNAMIC) {
				// add the name of the dynamic variable
				// Token.VARIABLE does only say in which style the dynamic variables are
				// rendered
				String inputName = input.getName();
				if (inputName.matches("(^[A-Za-z])([A-Za-z\\d]*)")) {
					// check whether the attribute is alphanumerical without a number at the
					// front
					tokenMap.put(inputName, Token.VARIABLE);
				} else {
					// if the attribute is not alphanumeric, add it with the brackets,
					// escape [ and ]
					inputName = inputName.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
					tokenMap.put("[" + inputName + "]", Token.VARIABLE);
				}
			} else if (input.getCategory() == Category.CONSTANT) {
				// add the constant name
				// Token.ANNOTATION does only say in which style the constants are rendered
				tokenMap.put(input.getName(), Token.ANNOTATION);
			}
			// Category.SCOPE variables are recognized with the surrounding
			// brackets
		}
	}
	tokenMap.put("[", Token.VARIABLE);
	tokenMap.put("]", Token.VARIABLE);

	// return the complete map of known words that should be highlighted
	return tokenMap;
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:50,代码来源:ExpressionTokenMaker.java

示例8: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight() {

	// add all words that should be highlighted
	TokenMap tokenMap = new TokenMap();

	// add known functions
	if (functions != null) {
		for (FunctionDescription function : functions) {
			// add the function name without the opening bracket
			// Token.RESERVED_WORD does only say in which style the function names are
			// rendered
			tokenMap.put(function.getDisplayName().split("\\(")[0], Token.RESERVED_WORD);
		}
	}
	// add regular attributes
	if (functionInputs != null) {
		for (FunctionInput input : functionInputs) {

			if (input.getCategory() == Category.DYNAMIC) {
				// add the name of the dynamic variable
				// Token.VARIABLE does only say in which style the dynamic variables are
				// rendered
				String inputName = input.getName();
				if (inputName.matches("(^[A-Za-z])([A-Z_a-z\\d]*)")) {
					// check whether the attribute is alphanumerical without a number at the
					// front
					tokenMap.put(inputName, Token.VARIABLE);
				} else {
					// if the attribute is not alphanumeric, add it with the brackets,
					// escape [ and ]
					inputName = inputName.replace("\\", "\\\\").replace("[", "\\[").replace("]", "\\]");
					tokenMap.put("[" + inputName + "]", Token.VARIABLE);
				}
			} else if (input.getCategory() == Category.CONSTANT) {
				// add the constant name
				// Token.ANNOTATION does only say in which style the constants are rendered
				tokenMap.put(input.getName(), Token.ANNOTATION);
			}
			// Category.SCOPE variables are recognized with the surrounding
			// brackets
		}
	}
	tokenMap.put("[", Token.VARIABLE);
	tokenMap.put("]", Token.VARIABLE);

	// return the complete map of known words that should be highlighted
	return tokenMap;
}
 
开发者ID:rapidminer,项目名称:rapidminer-studio,代码行数:50,代码来源:ExpressionTokenMaker.java

示例9: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight() {
 return null; // not used
}
 
开发者ID:brunonova,项目名称:drmips,代码行数:5,代码来源:CodeEditor.java

示例10: setMyWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
public static void setMyWordsToHighlight(TokenMap myWordsToHighlight) {
	OwnTokenMaker.wordsToHighlight = myWordsToHighlight;
}
 
开发者ID:umlet,项目名称:umlet,代码行数:4,代码来源:OwnTokenMaker.java

示例11: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight() {
	return wordsToHighlight;
}
 
开发者ID:umlet,项目名称:umlet,代码行数:5,代码来源:OwnTokenMaker.java

示例12: getWordsToHighlight

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
@Override
public TokenMap getWordsToHighlight()
{
    if (myMap == null) myMap = new MyNameTypeMap();

    TokenMap tokenMap = new TokenMap();

    for(Tokens.Token ktok : Language.tokens)
    {
        int type = -1;
        if (Tokens.Function.class.isAssignableFrom(ktok.getClass()))
        {
            type = Token.FUNCTION;
        }
        else if (Tokens.InnerToken.class.isAssignableFrom(ktok.getClass()))
        {
            type = Token.RESERVED_WORD;
        }
        else if (ktok == Language.comment_start || ktok == Language.comment_end)
        {
            type = Token.COMMENT_MULTILINE;
        }
        else if (ktok == Language.comment)
        {
            type = Token.COMMENT_EOL;
        }
        else if (ktok == Language.hyphen)
        {
            type = Token.LITERAL_STRING_DOUBLE_QUOTE;
        }
        else if (Tokens.Context.class.isAssignableFrom(ktok.getClass()))
        {
            type = Token.SEPARATOR;
        }
        else if (Untransformable.class.isAssignableFrom(ktok.getClass()))
        {
            type = Token.RESERVED_WORD_2;
        }
        else if (Tokens.Operator.class.isAssignableFrom(ktok.getClass())
                || Tokens.Comparator.class.isAssignableFrom(ktok.getClass()))
        {
            type = Token.OPERATOR;
        }
        else {
            type = Token.RESERVED_WORD;
        }
        tokenMap.put(ktok.name, type);
        myMap.put(ktok.name, type);
        for(String alias : ktok.aliases)
        {
            tokenMap.put(alias, type);
            myMap.put(alias, type);
        }
    }
    return tokenMap;
}
 
开发者ID:pvto,项目名称:konte-art,代码行数:57,代码来源:KonteRSTATokenMaker.java

示例13: assertTokenMapContains

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
/**
 * Checks for a token in a token map, and makes sure it is mapped to the
 * expected token type.
 *
 * @param tm The token map.
 * @param token The token.
 * @param tokenType The expected token type.
 */
private void assertTokenMapContains(TokenMap tm, String token,
		int tokenType) {
	int actualType = tm.get(token.toCharArray(), 0, token.length() - 1);
	Assert.assertEquals("Token mapped to unexpected type: " + token,
			tokenType, actualType);
}
 
开发者ID:curiosag,项目名称:ftc,代码行数:15,代码来源:UnixShellTokenMakerTest.java

示例14: getTokenMap

import org.fife.ui.rsyntaxtextarea.TokenMap; //导入依赖的package包/类
public TokenMap getTokenMap(); 
开发者ID:anderson-,项目名称:S3F,代码行数:2,代码来源:ExtensibleTokenMaker.java


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