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


Java LanguageEmbedding.create方法代码示例

本文整理汇总了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
    );
}
 
开发者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: 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

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:CustomEmbeddingTest.java

示例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;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:SimpleLanguageProvider.java

示例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;
}
 
开发者ID:jdemeschew,项目名称:stpnb,代码行数:14,代码来源:EmbeddingLanguageProvider.java

示例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;
}
 
开发者ID:rostanek,项目名称:freemarker-support-for-netbeans,代码行数:16,代码来源:HTMLEmbeddingLanguageProvider.java

示例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;
    }
 
开发者ID:daimor,项目名称:NBStudio,代码行数:13,代码来源:LangProvider.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:LessLanguage.java

示例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;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:LanguageManager.java


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