Search in sources :

Example 21 with GrMember

use of org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember in project intellij-community by JetBrains.

the class GrChangeMemberVisibilityModifierBase method processIntention.

@Override
protected void processIntention(@NotNull PsiElement element, @NotNull Project project, Editor editor) throws IncorrectOperationException {
    final PsiElement parent = element.getParent();
    if (!(parent instanceof GrMember))
        return;
    ((GrMember) parent).getModifierList().setModifierProperty(myModifier, true);
}
Also used : GrMember(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember) PsiElement(com.intellij.psi.PsiElement)

Example 22 with GrMember

use of org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember in project intellij-community by JetBrains.

the class GrClassMemberReferenceVisitor method visitReferenceExpression.

@Override
public void visitReferenceExpression(@NotNull GrReferenceExpression ref) {
    GrExpression qualifier = ref.getQualifier();
    if (qualifier != null && !(PsiUtil.isThisOrSuperRef(qualifier))) {
        qualifier.accept(this);
        if (!(qualifier instanceof GrReferenceExpression) || !(((GrReferenceExpression) qualifier).resolve() instanceof PsiClass)) {
            return;
        }
    }
    PsiElement resolved = ref.resolve();
    if (resolved instanceof GrMember) {
        PsiClass containingClass = ((GrMember) resolved).getContainingClass();
        if (isPartOf(myClass, containingClass)) {
            visitClassMemberReferenceElement((GrMember) resolved, ref);
        }
    }
}
Also used : GrMember(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember) PsiClass(com.intellij.psi.PsiClass) GrExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression) PsiElement(com.intellij.psi.PsiElement) GrReferenceExpression(org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression)

Example 23 with GrMember

use of org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember in project intellij-community by JetBrains.

the class GrMemberInfo method extractClassMembers.

public static void extractClassMembers(PsiClass subclass, List<GrMemberInfo> result, Filter<GrMember> filter, final boolean extractInterfacesDeep) {
    if (!(subclass instanceof GrTypeDefinition))
        return;
    if (extractInterfacesDeep) {
        extractSuperInterfaces(subclass, filter, result, ContainerUtil.<PsiClass>newHashSet());
    } else {
        PsiClass[] interfaces = subclass.getInterfaces();
        GrReferenceList sourceRefList = subclass.isInterface() ? ((GrTypeDefinition) subclass).getExtendsClause() : ((GrTypeDefinition) subclass).getImplementsClause();
        for (PsiClass anInterface : interfaces) {
            if (anInterface instanceof GrTypeDefinition && filter.includeMember((GrMember) anInterface)) {
                result.add(new GrMemberInfo((GrMember) anInterface, true, sourceRefList));
            }
        }
    }
    PsiClass[] innerClasses = subclass.getInnerClasses();
    for (PsiClass innerClass : innerClasses) {
        if (innerClass instanceof GrTypeDefinition && filter.includeMember((GrMember) innerClass)) {
            result.add(new GrMemberInfo((GrMember) innerClass));
        }
    }
    GrMethod[] methods = ((GrTypeDefinition) subclass).getCodeMethods();
    for (GrMethod method : methods) {
        if (!method.isConstructor() && filter.includeMember(method)) {
            result.add(new GrMemberInfo(method));
        }
    }
    GrField[] fields = ((GrTypeDefinition) subclass).getCodeFields();
    for (final GrField field : fields) {
        if (filter.includeMember(field)) {
            result.add(new GrMemberInfo(field));
        }
    }
}
Also used : GrField(org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField) GrTypeDefinition(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition) GrMember(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember) GrReferenceList(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrReferenceList) GrMethod(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod)

Aggregations

GrMember (org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMember)23 PsiElement (com.intellij.psi.PsiElement)7 GroovyPsiElement (org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement)6 GroovyFile (org.jetbrains.plugins.groovy.lang.psi.GroovyFile)5 GrMethod (org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod)5 Nullable (org.jetbrains.annotations.Nullable)4 GrReferenceExpression (org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression)4 NotNull (org.jetbrains.annotations.NotNull)3 GrVariable (org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable)3 GroovyScriptClass (org.jetbrains.plugins.groovy.lang.psi.impl.synthetic.GroovyScriptClass)3 Editor (com.intellij.openapi.editor.Editor)2 GrDocCommentOwner (org.jetbrains.plugins.groovy.lang.groovydoc.psi.api.GrDocCommentOwner)2 GrReferenceElement (org.jetbrains.plugins.groovy.lang.psi.GrReferenceElement)2 GrModifierList (org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList)2 GrClosableBlock (org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock)2 GrTypeDefinition (org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition)2 TargetElementUtil (com.intellij.codeInsight.TargetElementUtil)1 Language (com.intellij.lang.Language)1 InlineActionHandler (com.intellij.lang.refactoring.InlineActionHandler)1 AccessToken (com.intellij.openapi.application.AccessToken)1