本文整理汇总了Java中org.netbeans.spi.lexer.LanguageEmbedding类的典型用法代码示例。如果您正苦于以下问题:Java LanguageEmbedding类的具体用法?Java LanguageEmbedding怎么用?Java LanguageEmbedding使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LanguageEmbedding类属于org.netbeans.spi.lexer包,在下文中一共展示了LanguageEmbedding类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public LanguageEmbedding<?> findLanguageEmbedding (
Token token,
LanguagePath languagePath,
InputAttributes inputAttributes
) {
String mimeType = languagePath.innerLanguage ().mimeType ();
if (!LanguagesManager.getDefault ().isSupported (mimeType)) return null;
Language<STokenId> language = getTokenImport (mimeType, token);
if (language == null)
language = getPreprocessorImport (languagePath, token);
if (language == null) return null;
Integer i = (Integer) token.getProperty ("startSkipLength");
int startSkipLength = i == null ? 0 : i.intValue ();
i = (Integer) token.getProperty ("endSkipLength");
int endSkipLength = i == null ? 0 : i.intValue ();
return LanguageEmbedding.create (
language,
startSkipLength,
endSkipLength
);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:SLanguageProvider.java
示例2: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding (
Token token,
LanguagePath arg1,
InputAttributes arg2
) {
if (token.id() == OQLTokenId.JSBLOCK) {
Language lang = Language.find("text/javascript");
if(lang == null) {
return null; //no language found
} else {
return LanguageEmbedding.create(lang, 0, 0, true);
}
}
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:OQLLanguageProvider.java
示例3: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public LanguageEmbedding<?> findLanguageEmbedding(
Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
synchronized(LOCK) {
LanguageEmbedding<?> lang = tokenLangCache.get(token);
if (lang == null) {
for(LanguageProvider p : providers) {
if (null != (lang = p.findLanguageEmbedding(token, languagePath, inputAttributes))) {
break;
}
}
if (lang == null) {
lang = NO_LANG_EMBEDDING();
}
tokenLangCache.put(token, lang);
}
return lang == NO_LANG_EMBEDDING() ? null : lang;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:LanguageManager.java
示例4: findEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
/**
* Find the language embedding for the given parameters.
* <br/>
* First the <code>LanguageHierarchy.embedding()</code> method is queried
* and if no embedding is found then the <code>LanguageProvider.findLanguageEmbedding()</code>.
*/
public static <T extends TokenId> LanguageEmbedding<?>
findEmbedding(LanguageHierarchy<T> languageHierarchy, AbstractToken<T> token,
LanguagePath languagePath, InputAttributes inputAttributes) {
LanguageEmbedding<?> embedding =
LexerSpiPackageAccessor.get().embedding(
languageHierarchy, token, languagePath, inputAttributes);
if (embedding == null) {
// try language embeddings registered in Lookup
embedding = LanguageManager.getInstance().findLanguageEmbedding(
token, languagePath, inputAttributes);
}
return embedding;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:LexerUtilsConstants.java
示例5: embedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> embedding(
Token<TestJoinTextTokenId> token, LanguagePath languagePath, InputAttributes inputAttributes) {
// Test language embedding in the block comment
switch (token.id()) {
// case PARENS: - explicit custom embedding
// return LanguageEmbedding.create(TestPlainTokenId.inParensLanguage, 1, 1, true);
case BRACKETS:
return LanguageEmbedding.create(TestPlainTokenId.inBracketsLanguage, 1, 1, true);
case APOSTROPHES:
return LanguageEmbedding.create(TestPlainTokenId.inApostrophesLanguage, 1, 1, false);
// case TEXT:
// return LanguageEmbedding.create(TestStringTokenId.language(), 1, 1);
}
return null; // No embedding
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:TestJoinTextTokenId.java
示例6: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding (
Token arg0,
LanguagePath arg1,
InputAttributes arg2
) {
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:DiffLanguageProvider.java
示例7: findLanguagePaths
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
/**
* Find the language paths either for this language only
* or from TokenHierarchyOperation when adding a new default or custom embedding
* to the token hierarchy.
* <br/>
* As a language may finally be embedded in itself (e.g. someone might
* want to syntax color java code snippet embedded in javadoc)
* this method must prevent creation of infinite language paths
* by using exploredLanguages parameter.
*
* @param existingLanguagePaths set of language paths that are already known.
* This set is not modified by the method.
* @param newLanguagePaths newly discovered language paths will be added to this set.
* @param exploredLanguages used for checking whether the subpaths containing
* this language were already discovered.
* @param lp language path that will be checked. Its innermost language
* will be checked for embeddings automatically.
*/
public static <T extends TokenId> void findLanguagePaths(
Set<LanguagePath> existingLanguagePaths, Set<LanguagePath> newLanguagePaths,
Set<Language<?>> exploredLanguages, LanguagePath lp) {
// Get the complete language path
if (!existingLanguagePaths.contains(lp)) {
newLanguagePaths.add(lp);
}
Language<T> language = (Language<T>)LexerUtilsConstants.<T>innerLanguage(lp);
if (!exploredLanguages.contains(language)) {
exploredLanguages.add(language);
Set<T> ids = language.tokenIds();
for (T id : ids) {
// Create a fake empty token
DefaultToken<T> emptyToken = new DefaultToken<T>(new WrapTokenId<T>(id));
// Find embedding for non-flyweight token
LanguageHierarchy<T> languageHierarchy = LexerUtilsConstants.innerLanguageHierarchy(lp);
LanguageEmbedding<?> embedding = LexerUtilsConstants.findEmbedding(
languageHierarchy, emptyToken, lp, null);
if (embedding != null) {
LanguagePath elp = LanguagePath.get(lp, embedding.language());
findLanguagePaths(existingLanguagePaths, newLanguagePaths,
exploredLanguages, elp);
}
}
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:45,代码来源:LanguageOperation.java
示例8: EmbeddedTokenList
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public EmbeddedTokenList(TokenList<?> rootTokenList,
LanguagePath languagePath, LanguageEmbedding<ET> embedding
) {
super(1); // Suitable for adding join-token parts
this.rootTokenList = rootTokenList;
this.languagePath = languagePath;
this.embedding = embedding;
initLAState();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:EmbeddedTokenList.java
示例9: embedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> embedding(
Token<TestJoinMixTextTokenId> token, LanguagePath languagePath, InputAttributes inputAttributes) {
// Test language embedding in the block comment
switch (token.id()) {
case WORD:
return null;
case WHITESPACE:
return null;
}
return null; // No embedding
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TestJoinMixTextTokenId.java
示例10: registerEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public static void registerEmbedding(String mimePath, TokenId id, LanguageEmbedding<?> embedding) {
// checkInstanceExists();
synchronized (LOCK) {
Map<TokenId,LanguageEmbedding<?>> id2embedding = mime2embeddings.get(mimePath);
if (id2embedding == null) {
id2embedding = new HashMap<TokenId,LanguageEmbedding<?>>();
mime2embeddings.put(mimePath, id2embedding);
}
id2embedding.put(id, embedding);
}
fireChange();
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TestLanguageProvider.java
示例11: testEmbeddingCaching
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public void testEmbeddingCaching() throws Exception {
LanguageEmbedding<?> e = LanguageEmbedding.create(TestTokenId.language(), 2, 1);
assertSame(TestTokenId.language(), e.language());
assertSame(2, e.startSkipLength());
assertSame(1, e.endSkipLength());
LanguageEmbedding<?> e2 = LanguageEmbedding.create(TestTokenId.language(), 2, 1);
assertSame(e, e2);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CustomEmbeddingTest.java
示例12: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public LanguageEmbedding<?> findLanguageEmbedding(
Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
if ("text/x-simple-plain".equals(languagePath.mimePath()) && token.id().name().equals("WORD")) {
return LanguageEmbedding.create(TestCharTokenId.language(), 0, 0);
} else {
return null;
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SimpleLanguageProvider.java
示例13: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
if(embeddedLanguage == null) {
initLanguage();
}
if(token.id() instanceof SilverstripeTokenId && token.text() != null) {
SilverstripeTokenId silverstripeToken = (SilverstripeTokenId)token.id();
if(silverstripeToken == SilverstripeTokenId.TEXT) {
return LanguageEmbedding.create(embeddedLanguage, 0, 0, true);
}
}
return null;
}
开发者ID:jdemeschew,项目名称:stpnb,代码行数:14,代码来源:EmbeddingLanguageProvider.java
示例14: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token,
LanguagePath languagePath, InputAttributes inputAttributes) {
String embeddedMime = NbPreferences.forModule(FTLPanel.class).get("embeddedMime", "text/html");
Language<?> embeddedLanguage = MimeLookup.getLookup(embeddedMime).lookup(Language.class);
if (embeddedLanguage != null && languagePath.mimePath().equals("text/x-ftl")) {
if (token.id().name().startsWith("STATIC_TEXT")) {
return LanguageEmbedding.create(embeddedLanguage, 0, 0, true);
}
}
return null;
}
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:16,代码来源:HTMLEmbeddingLanguageProvider.java
示例15: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
// Logger.Log("findEmbedding: " + languagePath.mimePath() + " - " + token.id().name());
if (languagePath.mimePath().equals("text/isc-cls")) {
if (CLSLanguageHierarchy.getToken(clsLexer.MethodDeclaration) == token.id()) {
return LanguageEmbedding.create(new macLanguageHierarchy().language(), 1, 1);
} else if (CLSLanguageHierarchy.getToken(clsLexer.XDataDeclaration) == token.id()) {
return LanguageEmbedding.create(new xdataLanguageHierarchy().language(), 1, 1);
}
}
return null;
}
开发者ID:daimor,项目名称:NBStudio,代码行数:13,代码来源:LangProvider.java
示例16: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
public LanguageEmbedding<?> findLanguageEmbedding(Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
return null;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:EmbeddingProviderImplTest.java
示例17: findLanguageEmbedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public LanguageEmbedding<?> findLanguageEmbedding(
Token<?> token, LanguagePath languagePath, InputAttributes inputAttributes) {
Lookup lookup = MimeLookup.getLookup(MimePath.parse(languagePath.mimePath()));
LanguagesEmbeddingMap map = lookup.lookup(LanguagesEmbeddingMap.class);
return map == null ? null : map.getLanguageEmbeddingForTokenName(token.id().name());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:MimeLookupLanguageProvider.java
示例18: LanguagesEmbeddingMap
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
/** Creates a new instance of LanguagesEmbeddingMap */
public LanguagesEmbeddingMap(Map<String, LanguageEmbedding<?>> map) {
this.map = map;
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:LanguagesEmbeddingMap.java
示例19: getLanguageEmbeddingForTokenName
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
public synchronized LanguageEmbedding<?> getLanguageEmbeddingForTokenName(String tokenName) {
return map.get(tokenName);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:LanguagesEmbeddingMap.java
示例20: embedding
import org.netbeans.spi.lexer.LanguageEmbedding; //导入依赖的package包/类
@Override
protected LanguageEmbedding embedding(
Token<CPTokenId> token, LanguagePath languagePath, InputAttributes inputAttributes) {
//there can be just one token with CssTokenId.CSS type - always create core css language embedding
return LanguageEmbedding.create(getCoreCssLanguage(), 0, 0);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:LessLanguage.java
注:本文中的org.netbeans.spi.lexer.LanguageEmbedding类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论