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


Java YAMLTokenTypes类代码示例

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


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


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