• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java YAMLTokenTypes类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: attachRouteActions

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * Find controller definition in yaml structor
 *
 * foo:
 *   defaults: { _controller: "Bundle:Foo:Bar" }
 *   controller: "Bundle:Foo:Bar"
 */
private void attachRouteActions(@NotNull Collection<LineMarkerInfo> lineMarkerInfos, @NotNull PsiElement psiElement) {
    if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
        return;
    }

    PsiElement yamlKeyValue = psiElement.getParent();
    if(!(yamlKeyValue instanceof YAMLKeyValue)) {
        return;
    }

    String yamlController = RouteHelper.getYamlController((YAMLKeyValue) yamlKeyValue);
    if(yamlController != null) {
        PsiElement[] methods = RouteHelper.getMethodsOnControllerShortcut(psiElement.getProject(), yamlController);
        if(methods.length > 0) {
            NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.TWIG_CONTROLLER_LINE_MARKER).
                setTargets(methods).
                setTooltipText("Navigate to action");

            lineMarkerInfos.add(builder.createLineMarkerInfo(psiElement));
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:30,代码来源:YamlLineMarkerProvider.java


示例2: annotateCallMethod

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
private void annotateCallMethod(@NotNull final PsiElement psiElement, @NotNull ProblemsHolder holder, ContainerCollectionResolver.LazyServiceCollector collector) {

        if(StandardPatterns.and(
            YamlElementPatternHelper.getInsideKeyValue("tags"),
            YamlElementPatternHelper.getSingleLineScalarKey("method")
        ).accepts(psiElement)) {
            visitYamlMethodTagKey(psiElement, holder, collector);
        }

        if((PlatformPatterns.psiElement(YAMLTokenTypes.TEXT).accepts(psiElement)
            || PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_DSTRING).accepts(psiElement)))
        {
            visitYamlMethod(psiElement, holder, collector);
        }

    }
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:17,代码来源:EventMethodCallInspection.java


示例3: collectSlowLineMarkers

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> result) {
    if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
        return;
    }

    LazyConfigTreeSignatures function = null;

    for (PsiElement psiElement : psiElements) {
        if(psiElement.getNode().getElementType() == YAMLTokenTypes.SCALAR_KEY && YamlElementPatternHelper.getRootConfigKeyPattern().accepts(psiElement)) {
            if(function == null) {
                function = new LazyConfigTreeSignatures(psiElements.get(0).getProject());
            }
            visitRootElements(result, psiElement, function);
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:18,代码来源:ConfigLineMarkerProvider.java


示例4: findEol

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * Remove TODO; moved to core
 */
@Deprecated
@NotNull
public static String findEol(@NotNull PsiElement psiElement) {

    for(PsiElement child: YamlHelper.getChildrenFix(psiElement)) {
        if(PlatformPatterns.psiElement(YAMLTokenTypes.EOL).accepts(child)) {
            return child.getText();
        }
    }

    PsiElement[] indentPsiElements = PsiTreeUtil.collectElements(psiElement.getContainingFile(), element ->
        PlatformPatterns.psiElement(YAMLTokenTypes.EOL).accepts(element)
    );

    if(indentPsiElements.length > 0) {
        return indentPsiElements[0].getText();
    }

    return "\n";
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:24,代码来源:TranslationInsertUtil.java


示例5: getWordsScanner

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@Nullable
@Override
public WordsScanner getWordsScanner() {
    return new DefaultWordsScanner(new YAMLFlexLexer(),
            TokenSet.create(YAMLTokenTypes.SCALAR_KEY),
            TokenSet.create(YAMLTokenTypes.COMMENT),
            TokenSet.create(YAMLTokenTypes.SCALAR_TEXT, YAMLTokenTypes.SCALAR_DSTRING, YAMLTokenTypes.SCALAR_STRING));
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:9,代码来源:CoffigFindUsagesProvider.java


示例6: getWithFirstRootKey

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
public static ElementPattern<PsiElement> getWithFirstRootKey() {

        return PlatformPatterns.and(PlatformPatterns.or(
                // foo:
                //   <caret>
                PlatformPatterns
                        .psiElement().with(new ParentPathPatternCondition(
                        YAMLScalar.class, YAMLMapping.class,
                        YAMLKeyValue.class, YAMLMapping.class,
                        YAMLDocument.class
                ))
                        .withLanguage(YAMLLanguage.INSTANCE),

                // foo:
                //   <caret> (on incomplete)
                PlatformPatterns
                        .psiElement().afterLeaf(
                        PlatformPatterns.psiElement(YAMLTokenTypes.INDENT).with(
                                new ParentPathPatternCondition(YAMLKeyValue.class, YAMLMapping.class, YAMLDocument.class)
                        )
                )
                        .withLanguage(YAMLLanguage.INSTANCE),

                // foo:
                //   fo<caret>:
                PlatformPatterns.psiElement().with(new ParentPathPatternCondition(
                        YAMLKeyValue.class, YAMLMapping.class,
                        YAMLKeyValue.class, YAMLMapping.class,
                        YAMLDocument.class)
                )
        ));
    }
 
开发者ID:cvette,项目名称:intellij-neos,代码行数:33,代码来源:YamlElementPatternHelper.java


示例7: getYamlFieldName

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * fields:
 *  i<caret>d: []
 *
 * embedOne:
 *  add<caret>ress: []
 */
public static PsiElementPattern.Capture<PsiElement> getYamlFieldName() {
    return PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_KEY)
        .withParent(
            PlatformPatterns.psiElement(YAMLKeyValue.class).withParent(
                PlatformPatterns.psiElement(YAMLCompoundValue.class).withParent(
                    PlatformPatterns.psiElement(YAMLKeyValue.class).withName(PlatformPatterns.string().oneOf(
                        "id", "fields", "embedOne", "embedMany", "referenceOne", "referenceMany", "oneToOne", "oneToMany", "manyToOne", "manyToMany"
                    ))
                )
            )
        );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:20,代码来源:DoctrineMetadataPattern.java


示例8: collectSlowLineMarkers

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@Override
public void collectSlowLineMarkers(@NotNull List<PsiElement> psiElements, @NotNull Collection<LineMarkerInfo> result) {
    if(psiElements.size() == 0 || !Symfony2ProjectComponent.isEnabled(psiElements.get(0))) {
        return;
    }

    LazyDecoratedParentServiceValues lazyDecoratedServices = null;


    for (PsiElement psiElement : psiElements) {
        if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
            continue;
        }

        PsiElement yamlKeyValue = psiElement.getParent();
        if(!(yamlKeyValue instanceof YAMLKeyValue) || !YamlElementPatternHelper.getServiceIdKeyValuePattern().accepts(yamlKeyValue)) {
            continue;
        }

        if(lazyDecoratedServices == null) {
            lazyDecoratedServices = new LazyDecoratedParentServiceValues(psiElement.getProject());
        }

        // services -> service_name
        visitServiceId(psiElement, (YAMLKeyValue) yamlKeyValue, result, lazyDecoratedServices);
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:28,代码来源:YamlLineMarkerProvider.java


示例9: attachEntityClass

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
private void attachEntityClass(@NotNull Collection<LineMarkerInfo> lineMarkerInfos, @NotNull PsiElement psiElement) {
    if(psiElement.getNode().getElementType() != YAMLTokenTypes.SCALAR_KEY) {
        return;
    }

    PsiElement yamlKeyValue = psiElement.getParent();
    if(!(yamlKeyValue instanceof YAMLKeyValue)) {
        return;
    }

    if(yamlKeyValue.getParent() instanceof YAMLMapping && yamlKeyValue.getParent().getParent() instanceof YAMLDocument) {
        PsiFile containingFile;
        try {
            containingFile = yamlKeyValue.getContainingFile();
        } catch (PsiInvalidElementAccessException e) {
            return;
        }

        String fileName = containingFile.getName();
        if(isMetadataFile(fileName)) {
            String keyText = ((YAMLKeyValue) yamlKeyValue).getKeyText();
            if(StringUtils.isNotBlank(keyText)) {
                Collection<PhpClass> phpClasses = PhpElementsUtil.getClassesInterface(psiElement.getProject(), keyText);
                if(phpClasses.size() > 0) {
                    NavigationGutterIconBuilder<PsiElement> builder = NavigationGutterIconBuilder.create(Symfony2Icons.DOCTRINE_LINE_MARKER).
                        setTargets(phpClasses).
                        setTooltipText("Navigate to class");

                    lineMarkerInfos.add(builder.createLineMarkerInfo(psiElement));
                }
            }
        }
    }
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:35,代码来源:YamlLineMarkerProvider.java


示例10: getSingleLineScalarKey

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
public static ElementPattern<PsiElement> getSingleLineScalarKey(String... keyName) {
    // key: | and key: "quote" is valid here
    // getKeyPattern
    return PlatformPatterns.or(
            PlatformPatterns
                    .psiElement(YAMLTokenTypes.TEXT)
                    .withParent(PlatformPatterns.psiElement(YAMLScalar.class)
                            .withParent(PlatformPatterns
                                    .psiElement(YAMLKeyValue.class)
                                    .withName(
                                            PlatformPatterns.string().oneOf(keyName)
                                    )
                            ))
                    .withLanguage(YAMLLanguage.INSTANCE)
        ,
        PlatformPatterns
            .psiElement(YAMLTokenTypes.SCALAR_DSTRING)
                .withParent(PlatformPatterns.psiElement(YAMLScalar.class)
                        .withParent(PlatformPatterns
                                .psiElement(YAMLKeyValue.class)
                                .withName(
                                        PlatformPatterns.string().oneOf(keyName)
                                )
                        ))
            .withLanguage(YAMLLanguage.INSTANCE),
        PlatformPatterns
            .psiElement(YAMLTokenTypes.SCALAR_STRING)
                .withParent(PlatformPatterns.psiElement(YAMLScalar.class)
                        .withParent(PlatformPatterns
                                .psiElement(YAMLKeyValue.class)
                                .withName(
                                        PlatformPatterns.string().oneOf(keyName)
                                )
                        ))
            .withLanguage(YAMLLanguage.INSTANCE)
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:38,代码来源:YamlElementPatternHelper.java


示例11: getServicesKeyPattern

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * services:
 *   My<caret>Class: ~
 */
public static ElementPattern<PsiElement> getServicesKeyPattern() {
    return PlatformPatterns
        .psiElement(YAMLTokenTypes.SCALAR_KEY).withParent(
            PlatformPatterns.psiElement(YAMLKeyValue.class).withParent(
                PlatformPatterns.psiElement(YAMLMapping.class).withParent(
                    PlatformPatterns.psiElement(YAMLKeyValue.class).with(YAML_KEY_SERVICES)
                )
            )
        );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:15,代码来源:YamlElementPatternHelper.java


示例12: getRootConfigKeyPattern

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * PsiFile / Document:
 *   serv<caret>ices: ~
 */
public static PsiElementPattern.Capture<PsiElement> getRootConfigKeyPattern() {
    return PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_KEY).withParent(
        PlatformPatterns.psiElement(YAMLKeyValue.class).withParent(
            PlatformPatterns.psiElement(YAMLMapping.class).withParent(
                PlatformPatterns.psiElement(YAMLDocument.class)
            )
        )
    ).inFile(getConfigFileNamePattern());
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:14,代码来源:YamlElementPatternHelper.java


示例13: getIndentSpaceForFile

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
/**
 * Try to find a valid indent value, which are spaces which we need to fill
 */
public static int getIndentSpaceForFile(@NotNull YAMLFile yamlFile) {
    List<YAMLDocument> documents = yamlFile.getDocuments();

    YAMLMapping mapping = ObjectUtils.tryCast(documents.get(0).getTopLevelValue(), YAMLMapping.class);
    if(mapping != null) {
        // first first INDENT element in mapping
        PsiElementPattern.Capture<PsiElement> pattern = PlatformPatterns
            .psiElement(YAMLTokenTypes.INDENT)
            .with(new PsiElementPatternCondition());

        for (YAMLPsiElement yamlPsiElement : mapping.getKeyValues()) {
            // get first value
            PsiElement firstChild = yamlPsiElement.getFirstChild();
            if(firstChild == null) {
                continue;
            }

            // first valid INDENT
            PsiElement nextSiblingOfType = PsiElementUtils.getNextSiblingOfType(firstChild, pattern);
            if(nextSiblingOfType != null && nextSiblingOfType.getTextLength() > 0) {
                return nextSiblingOfType.getTextLength();
            }
        }
    }

    // default value
    return 4;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:32,代码来源:YamlHelper.java


示例14: isStringValue

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
public static boolean isStringValue(@NotNull PsiElement psiElement) {
    // @TODO use new YAMLScalar element
    return PlatformPatterns.psiElement(YAMLTokenTypes.TEXT).accepts(psiElement)
        || PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_DSTRING).accepts(psiElement)
        || PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_STRING).accepts(psiElement)
        ;
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:8,代码来源:YamlHelper.java


示例15: CoffigCompletionContributor

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
public CoffigCompletionContributor() {
    extend(CompletionType.BASIC, PlatformPatterns.psiElement(YAMLTokenTypes.TEXT).withLanguage(YAMLLanguage.INSTANCE), DISPATCHING_COMPLETION_PROVIDER);
    extend(CompletionType.BASIC, PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_STRING).withLanguage(YAMLLanguage.INSTANCE), DISPATCHING_COMPLETION_PROVIDER);
    extend(CompletionType.BASIC, PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_DSTRING).withLanguage(YAMLLanguage.INSTANCE), DISPATCHING_COMPLETION_PROVIDER);
    extend(CompletionType.BASIC, PlatformPatterns.psiElement(YAMLTokenTypes.SCALAR_KEY).withLanguage(YAMLLanguage.INSTANCE), DISPATCHING_COMPLETION_PROVIDER);
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:7,代码来源:CoffigCompletionContributor.java


示例16: isKey

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
private boolean isKey(PsiElement position) {
    PsiElement parentContext = position.getParent().getContext();
    PsiElement leftContext = Optional.ofNullable(position.getContext()).map(PsiElement::getPrevSibling).orElse(null);
    return parentContext instanceof YAMLMapping || parentContext instanceof YAMLDocument || leftContext != null && ((LeafPsiElement) leftContext).getElementType() == YAMLTokenTypes.INDENT;
}
 
开发者ID:seedstack,项目名称:intellij-plugin,代码行数:6,代码来源:CoffigCompletionContributor.java


示例17: getWhitespaceTokens

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@NotNull
public TokenSet getWhitespaceTokens()
{
    return TokenSet.create(YAMLTokenTypes.WHITESPACE);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:6,代码来源:RamlParserDefinition.java


示例18: getStringLiteralElements

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@NotNull
public TokenSet getStringLiteralElements()
{
    return TokenSet.create(YAMLTokenTypes.SCALAR_STRING, YAMLTokenTypes.SCALAR_DSTRING, YAMLTokenTypes.TEXT);
}
 
开发者ID:machaval,项目名称:mule-intellij-plugins,代码行数:6,代码来源:RamlParserDefinition.java


示例19: getWhitespaceTokens

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@NotNull
public TokenSet getWhitespaceTokens() {
    return TokenSet.create(YAMLTokenTypes.WHITESPACE);
}
 
开发者ID:CloudSlang,项目名称:cs-intellij-plugin,代码行数:5,代码来源:CloudSlangParserDefinition.java


示例20: getStringLiteralElements

import org.jetbrains.yaml.YAMLTokenTypes; //导入依赖的package包/类
@NotNull
public TokenSet getStringLiteralElements() {
    return TokenSet.create(YAMLTokenTypes.SCALAR_STRING, YAMLTokenTypes.SCALAR_DSTRING, YAMLTokenTypes.TEXT);
}
 
开发者ID:CloudSlang,项目名称:cs-intellij-plugin,代码行数:5,代码来源:CloudSlangParserDefinition.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java PostInsertEventListener类代码示例发布时间:2022-05-23
下一篇:
Java DataSize类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap