com.intellij.patterns.PsiElementPattern Java Examples

The following examples show how to use com.intellij.patterns.PsiElementPattern. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PhpArrayCallbackGotoCompletion.java    From idea-php-toolbox with MIT License 6 votes vote down vote up
/**
 * [$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("[", "("))
                )
            )
        )
    );
}
 
Example #2
Source File: YamlRouteKeyCompletion.java    From idea-php-drupal-symfony2-bridge with MIT License 6 votes vote down vote up
@Override
public void register(GotoCompletionRegistrarParameter registrar) {
    PsiElementPattern.Capture<PsiElement> filePattern = PlatformPatterns.psiElement().inFile(PlatformPatterns.psiFile().withName(PlatformPatterns.string().endsWith(".routing.yml")));

    registrar.register(PlatformPatterns.and(YamlElementPatternHelper.getParentKeyName("defaults"), filePattern), psiElement -> {
        if(!DrupalProjectComponent.isEnabled(psiElement)) {
            return null;
        }

        return new DefaultRoutes(psiElement);
    });

    registrar.register(PlatformPatterns.and(YamlElementPatternHelper.getParentKeyName("requirements"), filePattern), psiElement -> {
        if(!DrupalProjectComponent.isEnabled(psiElement)) {
            return null;
        }

        return new EntityAccessRoutes(psiElement);
    });
}
 
Example #3
Source File: PhpGlobalsNamespaceProvider.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
private PsiElementPattern.Capture<ArrayIndex> getArrayKeyPattern() {
    return PlatformPatterns.psiElement(ArrayIndex.class).withParent(
        PlatformPatterns.psiElement(ArrayAccessExpression.class).withParent(
            PlatformPatterns.psiElement(AssignmentExpression.class)
        ).withChild(
            PlatformPatterns.psiElement(ArrayAccessExpression.class)
                .withChild(
                    PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'namespaces'"))
                )
                .withChild(
                    PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'fluid'"))).withChild(
                        PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'SYS'"))).withChild(
                            PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'TYPO3_CONF_VARS'")))
                        )
                    )
                )
        )
    );
}
 
Example #4
Source File: PhpGlobalsNamespaceProvider.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
private PsiElementPattern.Capture<ArrayIndex> getEmptyArrayKeyPattern() {
    return PlatformPatterns.psiElement(ArrayIndex.class).withParent(
        PlatformPatterns.psiElement(ArrayAccessExpression.class).withParent(
            PlatformPatterns.psiElement(ArrayAccessExpression.class).withParent(
                PlatformPatterns.psiElement(AssignmentExpression.class)
            )
        ).withChild(
            PlatformPatterns.psiElement(ArrayAccessExpression.class)
                .withChild(
                    PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'namespaces'"))
                )
                .withChild(
                    PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'fluid'"))).withChild(
                        PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'SYS'"))).withChild(
                            PlatformPatterns.psiElement(ArrayAccessExpression.class).withChild(PlatformPatterns.psiElement(ArrayIndex.class).withText(PlatformPatterns.string().oneOf("'TYPO3_CONF_VARS'")))
                        )
                    )
                )
        )
    );
}
 
Example #5
Source File: YiiRefsHelper.java    From yiistorm with MIT License 6 votes vote down vote up
public static boolean isWidgetRenderView(String path, PsiElement el) {
    if (!path.contains("Controller.php")) {
        PsiElementPattern.Capture p = PlatformPatterns.psiElement().withElementType(PhpElementTypes.CLASS)
                .withSuperParent(5, PlatformPatterns.psiElement().withName("CWidget"));

        PsiElementPattern.Capture renderMethod = PlatformPatterns.psiElement().withParent(
                YiiContibutorHelper.paramListInMethodWithName("render")
        );
        PsiElementPattern.Capture renderPartialMethod = PlatformPatterns.psiElement().withParent(
                YiiContibutorHelper.paramListInMethodWithName("renderPartial")
        );
        PsiElement[] elc = el.getContainingFile().getChildren();
        if (elc.length > 0 && elc[0] != null && elc[0].getChildren().length > 0) {
            for (PsiElement element : elc[0].getChildren()) {
                if (p.accepts(element) && (renderMethod.accepts(el) || renderPartialMethod.accepts(el))) {
                    return true;
                }
            }
        }
    }
    return false;
}
 
Example #6
Source File: YamlMenuGotoCompletion.java    From idea-php-drupal-symfony2-bridge with MIT License 6 votes vote down vote up
@Override
public void register(GotoCompletionRegistrarParameter registrar) {
    PsiElementPattern.Capture<PsiElement> menuPattern = PlatformPatterns.psiElement().inFile(PlatformPatterns.psiFile().withName(PlatformPatterns.string().endsWith(".menu.yml")));

    registrar.register(PlatformPatterns.and(YamlElementPatternHelper.getSingleLineScalarKey("parent"), menuPattern), psiElement -> {
        if(!DrupalProjectComponent.isEnabled(psiElement)) {
            return null;
        }

        return new ParentMenu(psiElement);
    });


    registrar.register(PlatformPatterns.and(YamlElementPatternHelper.getWithFirstRootKey(), menuPattern), psiElement -> {
        if(!DrupalProjectComponent.isEnabled(psiElement)) {
            return null;
        }

        return new MenuKeys(psiElement);
    });
}
 
Example #7
Source File: TCAPatterns.java    From idea-php-typo3-plugin with MIT License 6 votes vote down vote up
@NotNull
public static PsiElementPattern.Capture<PsiElement> arrayAssignmentValueWithIndexPattern(@NotNull String targetIndex) {

    return PlatformPatterns.psiElement().withParent(
            PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
                    PlatformPatterns.or(
                            // ['eval' => '<caret>']
                            PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).withParent(
                                    PlatformPatterns.psiElement(ArrayHashElement.class).withChild(
                                            elementWithStringLiteral(PhpElementTypes.ARRAY_KEY, targetIndex)
                                    )
                            ),
                            // $GLOBALS['eval'] = '<caret>';
                            PlatformPatterns.psiElement(PhpElementTypes.ASSIGNMENT_EXPRESSION).withChild(
                                    PlatformPatterns.psiElement(PhpElementTypes.ARRAY_ACCESS_EXPRESSION).withChild(
                                            elementWithStringLiteral(PhpElementTypes.ARRAY_INDEX, targetIndex)
                                    )
                            )
                    )
            )
    );
}
 
Example #8
Source File: PhpElementsUtil.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
static public PsiElementPattern.Capture<StringLiteralExpression> getFunctionWithFirstStringPattern(@NotNull String... functionName) {
    return PlatformPatterns
        .psiElement(StringLiteralExpression.class)
        .withParent(
            PlatformPatterns.psiElement(ParameterList.class)
                .withFirstChild(
                    PlatformPatterns.psiElement(PhpElementTypes.STRING)
                )
                .withParent(
                    PlatformPatterns.psiElement(FunctionReference.class).with(new PatternCondition<FunctionReference>("function match") {
                        @Override
                        public boolean accepts(@NotNull FunctionReference functionReference, ProcessingContext processingContext) {
                            return ArrayUtils.contains(functionName, functionReference.getName());
                        }
                    })
                )
        )
        .withLanguage(PhpLanguage.INSTANCE);
}
 
Example #9
Source File: ToolboxJsonCompletionContributor.java    From idea-php-toolbox with MIT License 6 votes vote down vote up
/**
 * 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 + "\"")
                        )
                    )
                )
            )
        )
    );
}
 
Example #10
Source File: ToolboxJsonCompletionContributor.java    From idea-php-toolbox with MIT License 6 votes vote down vote up
/**
 * 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 + "\"")
                        )

                )
            )
        )
    );
}
 
Example #11
Source File: PhpElementsUtil.java    From idea-php-symfony2-plugin with MIT License 6 votes vote down vote up
/**
 * 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)
                        )
                    )
            ))
        );
}
 
Example #12
Source File: YiiContibutorHelper.java    From yiistorm with MIT License 6 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> methodParamsList(String methodName,
                                                                     StringPattern className) {
    return PlatformPatterns.psiElement().withElementType(PhpElementTypes.PARAMETER_LIST)
            .withParent(
                    PlatformPatterns.psiElement()
                            .withElementType(PhpElementTypes.METHOD_REFERENCE)
                            .referencing(
                                    PhpPatterns.psiElement().withElementType(
                                            PhpElementTypes.CLASS_METHOD
                                    ).withName(methodName)
                                            .withParent(
                                                    PhpPatterns.psiElement().withName(
                                                            className
                                                    ))
                            )

            );
}
 
Example #13
Source File: PhpArrayCallbackGotoCompletion.java    From idea-php-toolbox with MIT License 6 votes vote down vote up
/**
 * [$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("[", "("))
                )
            )
        )
    );
}
 
Example #14
Source File: YiiAppCompletionContributor.java    From yiistorm with MIT License 6 votes vote down vote up
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);

}
 
Example #15
Source File: BladePattern.java    From idea-php-laravel-plugin with MIT License 6 votes vote down vote up
/**
 * "@foobar"
 */
private static PsiElementPattern.Capture<BladePsiDirectiveParameter> getDirectiveNamePattern(@NotNull final String[] directives) {
    return PlatformPatterns.psiElement(BladePsiDirectiveParameter.class).withParent(
        PlatformPatterns.psiElement(BladePsiDirective.class).with(new PatternCondition<BladePsiDirective>("Directive Name") {
            @Override
            public boolean accepts(@NotNull BladePsiDirective bladePsiDirective, ProcessingContext processingContext) {
                for (String directive : directives) {
                    if(("@" + directive).equals(bladePsiDirective.getName())) {
                        return true;
                    }
                }

                return false;
            }
        })
    );
}
 
Example #16
Source File: PhpElementsUtil.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
/**
 * class Foo { function "test" {} }
 */
static public PsiElementPattern.Capture<PsiElement> getClassMethodNamePattern() {
    return PlatformPatterns
        .psiElement(PhpTokenTypes.IDENTIFIER)
        .afterLeafSkipping(
            PlatformPatterns.psiElement(PsiWhiteSpace.class),
            PlatformPatterns.psiElement(PhpTokenTypes.kwFUNCTION)
        )
        .withParent(Method.class)
        .withLanguage(PhpLanguage.INSTANCE);
}
 
Example #17
Source File: SmartyPattern.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getBlockPattern() {
    return PlatformPatterns.psiElement(SmartyTokenTypes.STRING_LITERAL).withParent(
        PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE_VALUE).withParent(
            PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE).withText(PlatformPatterns.string().contains("name=")).withParent(
                PlatformPatterns.psiElement(SmartyCompositeElementTypes.TAG).withText(PlatformPatterns.string().startsWith("{block"))
            )
        )
    );
}
 
Example #18
Source File: DoctrineMetadataPattern.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
/**
 * 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"
                    ))
                )
            )
        );
}
 
Example #19
Source File: TwigPattern.java    From idea-php-symfony2-plugin with MIT License 5 votes vote down vote up
/**
 * Only a parameter is valid "('foobar',"
 */
@NotNull
public static PsiElementPattern getFirstFunctionParameterAsStringPattern() {
    // string wrapped elements
    ElementPattern[] elementPatterns = {
        PlatformPatterns.psiElement(TwigTokenTypes.WHITE_SPACE),
        PlatformPatterns.psiElement(PsiWhiteSpace.class),
        PlatformPatterns.psiElement(TwigTokenTypes.SINGLE_QUOTE),
        PlatformPatterns.psiElement(TwigTokenTypes.DOUBLE_QUOTE)
    };

    return PlatformPatterns.psiElement(TwigTokenTypes.STRING_TEXT)
        .beforeLeafSkipping(PlatformPatterns.or(elementPatterns), PlatformPatterns.psiElement(TwigTokenTypes.COMMA))
        .afterLeafSkipping(PlatformPatterns.or(elementPatterns), PlatformPatterns.psiElement(TwigTokenTypes.LBRACE));
}
 
Example #20
Source File: PhpElementsUtil.java    From yiistorm with MIT License 5 votes vote down vote up
static public PsiElementPattern.Capture<StringLiteralExpression> methodWithFirstStringPattern() {
    return PlatformPatterns
            .psiElement(StringLiteralExpression.class)
            .withParent(
                    PlatformPatterns.psiElement(PhpElementTypes.PARAMETER_LIST)
                            .withFirstChild(
                                    PlatformPatterns.psiElement(PhpElementTypes.STRING)
                            )
                            .withParent(
                                    PlatformPatterns.psiElement(PhpElementTypes.METHOD_REFERENCE)
                            )
            )
            .withLanguage(PhpLanguage.INSTANCE);
}
 
Example #21
Source File: AnnotationPattern.java    From idea-php-annotation-plugin with MIT License 5 votes vote down vote up
/**
 * matches "@Callback(propertyName="<value>")"
 */
public static PsiElementPattern.Capture<StringLiteralExpression> getPropertyIdentifierValue(String propertyName) {
    return PlatformPatterns.psiElement(StringLiteralExpression.class)
        .afterLeafSkipping(
            PlatformPatterns.or(
                PlatformPatterns.psiElement(PsiWhiteSpace.class),
                PlatformPatterns.psiElement(PhpDocTokenTypes.DOC_TEXT).withText("=")
            ),
            PlatformPatterns.psiElement(PhpDocTokenTypes.DOC_IDENTIFIER).withText(propertyName)
        )
        .withParent(PlatformPatterns.psiElement(PhpDocElementTypes.phpDocAttributeList));
}
 
Example #22
Source File: SmartyPattern.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getFileIncludePattern() {
    return PlatformPatterns.psiElement(SmartyTokenTypes.STRING_LITERAL).withParent(
        PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE_VALUE).withParent(
            PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE).withText(PlatformPatterns.string().contains("file=")).withParent(
                PlatformPatterns.psiElement(SmartyCompositeElementTypes.INCLUDE_TAG)
            )
        )
    );
}
 
Example #23
Source File: SmartyPattern.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getFilePattern() {
    // getName dont work
    return PlatformPatterns.psiElement(SmartyTokenTypes.STRING_LITERAL).withParent(
        PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE_VALUE).withParent(
            PlatformPatterns.psiElement(SmartyCompositeElementTypes.ATTRIBUTE).withText(PlatformPatterns.string().contains("file="))
        )
    );
}
 
Example #24
Source File: ExtJsUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getStringApp() {
    return PlatformPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(JSLiteralExpressionImpl.class).withParent(
            PlatformPatterns.psiElement(JSArgumentListImpl.class)
        )
    );
}
 
Example #25
Source File: XmlPatternUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
/**
 * <action>SwagBackendExample</action>
 */
public static PsiElementPattern.Capture<PsiElement> getMenuControllerActionPattern() {
    return XmlPatterns
        .psiElement(XmlTokenType.XML_DATA_CHARACTERS)
        .withParent(XmlPatterns
            .xmlText()
            .withParent(XmlPatterns
                .xmlTag()
                .withName("action")
            )
        ).inside(XmlHelper.getInsideTagPattern("menu"));
}
 
Example #26
Source File: XmlPatternUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
/**
 * <parent identifiedBy="controller">SwagBackendExample</parent>
 */
public static PsiElementPattern.Capture<PsiElement> getMenuControllerByParentPattern() {
    return XmlPatterns
        .psiElement(XmlTokenType.XML_DATA_CHARACTERS)
        .withParent(XmlPatterns
            .xmlText()
            .withParent(XmlPatterns
                .xmlTag()
                .withName("parent").withAttributeValue("identifiedBy", "controller")
            )
        ).inside(XmlHelper.getInsideTagPattern("menu"));
}
 
Example #27
Source File: XmlPatternUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
/**
 * <controller>SwagBackendExample</controller>
 */
public static PsiElementPattern.Capture<PsiElement> getMenuControllerPattern() {
    return XmlPatterns
            .psiElement(XmlTokenType.XML_DATA_CHARACTERS)
            .withParent(XmlPatterns
                    .xmlText()
                    .withParent(XmlPatterns
                            .xmlTag()
                            .withName("controller")
                    )
            ).inside(XmlHelper.getInsideTagPattern("menu"));
}
 
Example #28
Source File: ShopwareUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getBootstrapPathPattern() {
    // @TODO add method reference filter
    return PlatformPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(StringLiteralExpression.class).afterLeafSkipping(
            PlatformPatterns.psiElement(PsiWhiteSpace.class),
            PlatformPatterns.psiElement().withText(".")
        )
    );
}
 
Example #29
Source File: ThemeUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
public static PsiElementPattern.Capture<PsiElement> getThemeExtendsPattern() {
    return PlatformPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
            PlatformPatterns.psiElement(Field.class).withName("extend")
        )
    );
}
 
Example #30
Source File: ThemeUtil.java    From idea-php-shopware-plugin with MIT License 5 votes vote down vote up
@NotNull
public static PsiElementPattern.Capture<PsiElement> getJavascriptClassFieldPattern() {
    return PlatformPatterns.psiElement().withParent(
        PlatformPatterns.psiElement(StringLiteralExpression.class).withParent(
            PlatformPatterns.psiElement(PhpElementTypes.ARRAY_VALUE).withParent(
                PlatformPatterns.psiElement(ArrayCreationExpression.class).withParent(
                    PlatformPatterns.psiElement(Field.class).withName("javascript")
                )
            )
        )
    );

}