本文整理汇总了Java中org.netbeans.spi.lexer.LanguageEmbedding.create方法的典型用法代码示例。如果您正苦于以下问题:Java LanguageEmbedding.create方法的具体用法?Java LanguageEmbedding.create怎么用?Java LanguageEmbedding.create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.netbeans.spi.lexer.LanguageEmbedding
的用法示例。
在下文中一共展示了LanguageEmbedding.create方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
);
}
示例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;
}
示例3: 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
}
示例4: 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);
}
示例5: 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;
}
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: 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);
}
示例10: NO_LANG_EMBEDDING
import org.netbeans.spi.lexer.LanguageEmbedding; //导入方法依赖的package包/类
private static LanguageEmbedding<TokenId> NO_LANG_EMBEDDING() {
if (NO_LANG_EMBEDDING == null) {
NO_LANG_EMBEDDING = LanguageEmbedding.create(NO_LANG(), 0, 0);
}
return NO_LANG_EMBEDDING;
}