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


Java PsiElementPattern.Capture方法代码示例

本文整理汇总了Java中com.intellij.patterns.PsiElementPattern.Capture方法的典型用法代码示例。如果您正苦于以下问题:Java PsiElementPattern.Capture方法的具体用法?Java PsiElementPattern.Capture怎么用?Java PsiElementPattern.Capture使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.patterns.PsiElementPattern的用法示例。


在下文中一共展示了PsiElementPattern.Capture方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: tagAttributePattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
public static PsiElementPattern.Capture<PsiElement> tagAttributePattern(
    String tag,
    String attributeName,
    String fileName
) {
    return XmlPatterns
        .psiElement()
        .inside(XmlPatterns
                    .xmlAttributeValue()
                    .inside(XmlPatterns
                                .xmlAttribute()
                                .withName(attributeName)
                                .withParent(XmlPatterns
                                                .xmlTag()
                                                .withName(tag)
                                )
                    )
        ).inFile(getXmlFilePattern(fileName));
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:20,代码来源:PsiXmlUtils.java

示例2: topLevel

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
private static PsiElementPattern.Capture<PsiElement> topLevel() {
    return psiElement()
        .withLanguage(ImpexLanguage.getInstance())
        .andNot(psiElement()
                    // FIXME bad code, but working
                    .andOr(
                        psiElement(ImpexTypes.HEADER_TYPE),
                        psiElement(ImpexTypes.MACRO_NAME_DECLARATION),
                        psiElement(ImpexTypes.ROOT_MACRO_USAGE),
                        psiElement(ImpexTypes.MACRO_DECLARATION),
                        psiElement(ImpexTypes.ASSIGN_VALUE),
                        psiElement(ImpexTypes.MACRO_VALUE),
                        psiElement(ImpexTypes.ATTRIBUTE),
                        psiElement(ImpexTypes.HEADER_TYPE_NAME),
                        psiElement(ImpexTypes.HEADER_PARAMETER_NAME),
                        psiElement(ImpexTypes.ATTRIBUTE_NAME),
                        psiElement(ImpexTypes.FIELD_VALUE),
                        psiElement(ImpexTypes.ATTRIBUTE_VALUE)
                    )
        );
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:ImpexCompletionContributor.java

示例3: addStatements

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
private void addStatements() {
  PsiElementPattern.Capture<PsiElement> inStatement = psiElement()
    .withLanguage(PythonLanguage.getInstance())
    .and(IN_BEGIN_STMT)
    .andNot(IN_IMPORT_STMT)
    .andNot(IN_PARAM_LIST)
    .andNot(IN_ARG_LIST)
    .andNot(BEFORE_COND)
    .andNot(AFTER_QUALIFIER);

  extend(
    CompletionType.BASIC,
    inStatement,
    new CompletionProvider<CompletionParameters>() {
      protected void addCompletions(
        @NotNull final CompletionParameters parameters, final ProcessingContext context, @NotNull final CompletionResultSet result
      ) {
        putKeywords(result, TailType.SPACE, PyNames.ASSERT, PyNames.DEL, PyNames.EXEC, PyNames.FROM, PyNames.IMPORT, PyNames.RAISE);
        putKeywords(result, TailType.NONE, PyNames.PASS);
      }
    }
  );

  extend(CompletionType.BASIC, inStatement.andNot(PY3K), new PyKeywordCompletionProvider(TailType.SPACE, PyNames.PRINT));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:PyKeywordCompletionContributor.java

示例4: getAttributeInsideTagPattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * Not all tags are known, we need some custom syntax check
 *
 * {oxmultilang ident="FOO"}
 * { oxmultilang ident="FOO"}
 */
public static PsiElementPattern.Capture<PsiElement> getAttributeInsideTagPattern(@NotNull String attribute, @NotNull String tag) {
    return PlatformPatterns.psiElement(SmartyTokenTypes.STRING_LITERAL).afterLeafSkipping(
            PlatformPatterns.or(
                    PlatformPatterns.psiElement(SmartyTokenTypes.DOUBLE_QUOTE),
                    PlatformPatterns.psiElement(SmartyTokenTypes.SINGLE_QUOTE),
                    PlatformPatterns.psiElement(SmartyTokenTypes.EQ),
                    PlatformPatterns.psiElement(SmartyTokenTypes.WHITE_SPACE),
                    PlatformPatterns.psiElement(PsiWhiteSpace.class)
            ),
            PlatformPatterns.psiElement(SmartyTokenTypes.IDENTIFIER).withText(attribute)
    ).withParent(
            PlatformPatterns.psiElement(SmartyTag.class).withText(
                    PlatformPatterns.string().matches("\\{\\s*" + tag + ".*")
            )
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-oxid-plugin,代码行数:23,代码来源:SmartyPattern.java

示例5: getAfterPropertyAndInsideArrayObjectPattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * foo:[{"key": "<caret>"}]
 */
public PsiElementPattern.Capture<PsiElement> getAfterPropertyAndInsideArrayObjectPattern(@NotNull String key) {
    return PlatformPatterns.psiElement().inFile(getMetadataFilePattern()).withParent(
        PlatformPatterns.psiElement(JsonStringLiteral.class).with(FirstItemInTreePatternCondition.getInstance()).withParent(
            PlatformPatterns.psiElement(JsonProperty.class).withParent(
                PlatformPatterns.psiElement(JsonObject.class).withParent(
                    PlatformPatterns.psiElement(JsonArray.class).withParent(
                        PlatformPatterns.psiElement(JsonProperty.class).withFirstChild(
                            PlatformPatterns.psiElement(JsonStringLiteral.class).withText("\"" + key + "\"")
                        )
                    )
                )
            )
        )
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:19,代码来源:ToolboxJsonCompletionContributor.java

示例6: getAfterPropertyAndInsideObjectPattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * foo:{"key": "<caret>"}
 */
public PsiElementPattern.Capture<PsiElement> getAfterPropertyAndInsideObjectPattern(@NotNull String key) {
    return PlatformPatterns.psiElement().inFile(getMetadataFilePattern()).withParent(
        PlatformPatterns.psiElement(JsonStringLiteral.class).with(FirstItemInTreePatternCondition.getInstance()).withParent(
            PlatformPatterns.psiElement(JsonProperty.class).withParent(
                PlatformPatterns.psiElement(JsonObject.class).withParent(

                        PlatformPatterns.psiElement(JsonProperty.class).withFirstChild(
                            PlatformPatterns.psiElement(JsonStringLiteral.class).withText("\"" + key + "\"")
                        )

                )
            )
        )
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:19,代码来源:ToolboxJsonCompletionContributor.java

示例7: getPattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * [$this, '']
 * array($this, '')
 */
@NotNull
@Override
public PsiElementPattern.Capture<PsiElement> getPattern() {
    return PlatformPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
            PlatformPatterns.psiElement().withElementType(PhpElementTypes.ARRAY_VALUE).afterLeafSkipping(
                PlatformPatterns.psiElement(PsiWhiteSpace.class),
                PlatformPatterns.psiElement().withText(",")
            ).afterSiblingSkipping(
                PlatformPatterns.psiElement(PsiWhiteSpace.class),
                PlatformPatterns.psiElement().withElementType(PhpElementTypes.ARRAY_VALUE).withFirstNonWhitespaceChild(
                    PlatformPatterns.psiElement(Variable.class)
                ).afterLeafSkipping(
                    PlatformPatterns.psiElement(PsiWhiteSpace.class),
                    PlatformPatterns.psiElement().withText(PlatformPatterns.string().oneOf("[", "("))
                )
            )
        )
    );
}
 
开发者ID:Haehnchen,项目名称:idea-php-toolbox,代码行数:25,代码来源:PhpArrayCallbackGotoCompletion.java

示例8: literalInProperty

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
private static PsiElementPattern.Capture<JSLiteralExpression> literalInProperty(final String propertyName) {
    return PlatformPatterns.psiElement(JSLiteralExpression.class).and(new FilterPattern(new ElementFilter() {
        @Override
        public boolean isAcceptable(Object element, @Nullable PsiElement context) {
            if (element instanceof JSLiteralExpression) {
                final JSLiteralExpression literal = (JSLiteralExpression)element;
                if (literal.isQuotedLiteral()) {
                    final PsiElement parent = literal.getParent();
                    if (parent instanceof JSProperty && propertyName.equals(((JSProperty)parent).getName())) {
                        return EmberIndexUtil.hasEmberJS(literal.getProject());
                    }
                }
            }
            return false;
        }

        @Override
        public boolean isClassAcceptable(Class hintClass) {
            return true;
        }
    }));
}
 
开发者ID:kristianmandrup,项目名称:emberjs-plugin,代码行数:23,代码来源:EmberJSReferencesContributor.java

示例9: getArrayParameterDirectiveForElementType

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * "@foobar(['<caret>'])"
 *
 * whereas "foobar" is registered a directive
 */
public static PsiElementPattern.Capture<PsiElement> getArrayParameterDirectiveForElementType(@NotNull IElementType... elementType) {
    return PlatformPatterns.psiElement()
        .withParent(
            PlatformPatterns.psiElement(StringLiteralExpression.class)
                .withParent(
                    PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).withParent(
                        PlatformPatterns.psiElement(ArrayCreationExpression.class)
                            .withParent(ParameterList.class)
                    )
                )
                .with(
                    new MyDirectiveInjectionElementPatternCondition(elementType)
                )
        )
        .withLanguage(PhpLanguage.INSTANCE);
}
 
开发者ID:Haehnchen,项目名称:idea-php-laravel-plugin,代码行数:22,代码来源:BladePattern.java

示例10: getParameterListArrayValuePattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
/**
 * Provide array key pattern. we need incomplete array key support, too.
 *
 * foo(['<caret>'])
 * foo(['<caret>' => 'foobar'])
 */
@NotNull
public static PsiElementPattern.Capture<PsiElement> getParameterListArrayValuePattern() {
    return PlatformPatterns.psiElement()
        .withParent(PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
            PlatformPatterns.or(
                PlatformPatterns.psiElement().withElementType(PhpElementTypes.ARRAY_VALUE)
                    .withParent(PlatformPatterns.psiElement(ArrayCreationExpression.class)
                        .withParent(ParameterList.class)
                    ),

                PlatformPatterns.psiElement().withElementType(PhpElementTypes.ARRAY_KEY)
                    .withParent(PlatformPatterns.psiElement(ArrayHashElement.class)
                        .withParent(PlatformPatterns.psiElement(ArrayCreationExpression.class)
                            .withParent(ParameterList.class)
                        )
                    )
            ))
        );
}
 
开发者ID:Haehnchen,项目名称:idea-php-symfony2-plugin,代码行数:26,代码来源:PhpElementsUtil.java

示例11: appFieldPattern

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
public static PsiElementPattern.Capture appFieldPattern() {
    return PlatformPatterns.psiElement()
            .withParent(PlatformPatterns.psiElement().withElementType(PhpElementTypes.FIELD_REFERENCE)
                    .withChild(
                            PlatformPatterns.psiElement().withElementType(PhpElementTypes.METHOD_REFERENCE)
                                    .referencing(
                                            PhpPatterns.psiElement().withElementType(PhpElementTypes.CLASS_METHOD)
                                                    .withName("app").withParent(
                                                    PhpPatterns.psiElement()
                                                            .withElementType(PhpElementTypes.CLASS)
                                                            .withName(StandardPatterns.string().oneOf("Yii", "YiiBase"))
                                            )
                                    )
                    )
            ).withLanguage(PhpLanguage.INSTANCE);

}
 
开发者ID:cmazx,项目名称:yiistorm,代码行数:18,代码来源:YiiAppCompletionContributor.java

示例12: ApplicationNameCompletionContributor

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
public ApplicationNameCompletionContributor() {
  final PsiElementPattern.Capture<PsiElement> inAppReferenceString = psiElement().withSuperParent(1, AppleScriptApplicationReference.class);

  extend(CompletionType.BASIC,
      inAppReferenceString,
      new CompletionProvider<CompletionParameters>() {
        @Override
        protected void addCompletions(@NotNull CompletionParameters parameters,
                                      ProcessingContext context,
                                      @NotNull CompletionResultSet result) {

          AppleScriptSystemDictionaryRegistryService systemDictionaryRegistry = ServiceManager.getService
              (AppleScriptSystemDictionaryRegistryService.class);
          if (systemDictionaryRegistry != null) {
            List<String> appNameList = new ArrayList<>();
            if (SystemInfo.isMac) {
              appNameList.addAll(systemDictionaryRegistry.getDiscoveredApplicationNames());
              appNameList.removeAll(systemDictionaryRegistry.getNotScriptableApplicationList());
              appNameList.removeAll(systemDictionaryRegistry.getScriptingAdditions());
              appNameList.remove(ApplicationDictionary.SCRIPTING_ADDITIONS_LIBRARY);
              appNameList.remove(ApplicationDictionary.COCOA_STANDARD_LIBRARY);
            } else {
              appNameList.addAll(systemDictionaryRegistry.getCachedApplicationNames());
            }
            for (String appName : appNameList) {
              result.addElement(LookupElementBuilder.create(appName));
            }
          }
        }
      });

}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:33,代码来源:ApplicationNameCompletionContributor.java

示例13: isStringArrayValue

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
@NotNull
public static PsiElementPattern.Capture<PsiElement> isStringArrayValue() {

    return PhpPatterns.psiElement()
            .andOr(
                    PhpPatterns.psiElement().withParent(
                        PlatformPatterns.psiElement(StringLiteralExpression.class)
                            .withParent(PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE))
                    ),
                    PlatformPatterns.psiElement(StringLiteralExpression.class)
                                    .withParent(PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE))
            );
}
 
开发者ID:cedricziel,项目名称:idea-php-typo3-plugin,代码行数:14,代码来源:PhpElementsUtil.java

示例14: arrowedReference

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
static ElementPattern<PsiElement> arrowedReference() {
    final PsiElementPattern.Capture<PsiElement> arrowedCase = PlatformPatterns.psiElement(PhpTokenTypes.IDENTIFIER).afterLeaf("->");

    return StandardPatterns.or(
        arrowedCase.withParent(FieldReference.class),
        arrowedCase.withParent(MethodReference.class)
    );
}
 
开发者ID:rentalhost,项目名称:laravel-insight,代码行数:9,代码来源:ScopeCompletionContributor.java

示例15: getNodeTypeElementMatcher

import com.intellij.patterns.PsiElementPattern; //导入方法依赖的package包/类
protected PsiElementPattern.Capture<PsiElement> getNodeTypeElementMatcher(@NotNull String... keys) {
    return PlatformPatterns
            .psiElement()
            .with(new ParentKeysPatternCondition(keys))
            .with(new FilenamePrefixPatternCondition("NodeTypes."))
            .withLanguage(YAMLLanguage.INSTANCE);
}
 
开发者ID:cvette,项目名称:intellij-neos,代码行数:8,代码来源:YamlCompletionContributor.java


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