Search in sources :

Example 1 with PsiMember

use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.

the class GroovyGenerationInfo method insert.

@Override
public void insert(@NotNull PsiClass aClass, @Nullable PsiElement anchor, boolean before) throws IncorrectOperationException {
    final T proto = getPsiMember();
    if (proto instanceof GrMethod) {
        GroovyChangeContextUtil.encodeContextInfo(((GrMethod) proto).getParameterList());
    }
    super.insert(aClass, anchor, before);
    final T member = getPsiMember();
    if (member == null)
        return;
    LOG.assertTrue(member instanceof GroovyPsiElement, member);
    final GroovyPsiElementFactory factory = GroovyPsiElementFactory.getInstance(member.getProject());
    final PsiElement prev = member.getPrevSibling();
    if (prev != null && GroovyTokenTypes.mNLS == prev.getNode().getElementType()) {
        prev.replace(factory.createLineTerminator(1));
    } else if (prev instanceof PsiMember) {
        member.getParent().getNode().addLeaf(GroovyTokenTypes.mNLS, "\n", member.getNode());
    }
    final PsiElement next = member.getNextSibling();
    if (next != null && GroovyTokenTypes.mNLS == next.getNode().getElementType()) {
        next.replace(factory.createLineTerminator(1));
    } else if (next instanceof PsiMember) {
        member.getParent().getNode().addLeaf(GroovyTokenTypes.mNLS, "\n", next.getNode());
    }
    if (member instanceof GrMethod) {
        GroovyChangeContextUtil.decodeContextInfo(((GrMethod) member).getParameterList(), null, null);
    }
    JavaCodeStyleManager.getInstance(member.getProject()).shortenClassReferences(member);
    adjustDocCommentIfExists(member);
}
Also used : GroovyPsiElementFactory(org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElementFactory) GroovyPsiElement(org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement) GrMethod(org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod) PsiElement(com.intellij.psi.PsiElement) GroovyPsiElement(org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement) PsiMember(com.intellij.psi.PsiMember)

Example 2 with PsiMember

use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.

the class GrMemberSelectionTable method getOverrideIcon.

@Override
protected Icon getOverrideIcon(GrMemberInfo memberInfo) {
    PsiMember member = memberInfo.getMember();
    Icon overrideIcon = EMPTY_OVERRIDE_ICON;
    if (member instanceof PsiMethod) {
        if (Boolean.TRUE.equals(memberInfo.getOverrides())) {
            overrideIcon = AllIcons.General.OverridingMethod;
        } else if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
            overrideIcon = AllIcons.General.ImplementingMethod;
        } else {
            overrideIcon = EMPTY_OVERRIDE_ICON;
        }
    }
    return overrideIcon;
}
Also used : PsiMethod(com.intellij.psi.PsiMethod) RowIcon(com.intellij.ui.RowIcon) PsiMember(com.intellij.psi.PsiMember)

Example 3 with PsiMember

use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.

the class GrMemberSelectionTable method setVisibilityIcon.

@Override
protected void setVisibilityIcon(GrMemberInfo memberInfo, RowIcon icon) {
    PsiMember member = memberInfo.getMember();
    PsiModifierList modifiers = member != null ? member.getModifierList() : null;
    if (modifiers != null) {
        VisibilityIcons.setVisibilityIcon(modifiers, icon);
    } else {
        icon.setIcon(IconUtil.getEmptyIcon(true), VISIBILITY_ICON_POSITION);
    }
}
Also used : PsiMember(com.intellij.psi.PsiMember) PsiModifierList(com.intellij.psi.PsiModifierList)

Example 4 with PsiMember

use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.

the class MissedTestsDialog method updateMethodsTable.

private void updateMethodsTable() {
    List<MemberInfo> infos = TestIntegrationUtils.extractClassMethods(mySourceClass, myIncludeInheritedCb.isSelected());
    Set<PsiMember> selectedMethods = new HashSet<>();
    for (MemberInfo each : myTable.getSelectedMemberInfos()) {
        selectedMethods.add(each.getMember());
    }
    for (MemberInfo each : infos) {
        each.setChecked(selectedMethods.contains(each.getMember()));
    }
    myTable.setMemberInfos(infos);
}
Also used : MemberInfo(com.intellij.refactoring.util.classMembers.MemberInfo) HashSet(java.util.HashSet) PsiMember(com.intellij.psi.PsiMember)

Example 5 with PsiMember

use of com.intellij.psi.PsiMember in project intellij-community by JetBrains.

the class MemberSelectionTable method getOverrideIcon.

@Override
protected Icon getOverrideIcon(MemberInfo memberInfo) {
    PsiMember member = memberInfo.getMember();
    Icon overrideIcon = MemberSelectionTable.EMPTY_OVERRIDE_ICON;
    if (member instanceof PsiMethod) {
        if (Boolean.TRUE.equals(memberInfo.getOverrides())) {
            overrideIcon = AllIcons.General.OverridingMethod;
        } else if (Boolean.FALSE.equals(memberInfo.getOverrides())) {
            overrideIcon = AllIcons.General.ImplementingMethod;
        } else {
            overrideIcon = MemberSelectionTable.EMPTY_OVERRIDE_ICON;
        }
    }
    return overrideIcon;
}
Also used : PsiMethod(com.intellij.psi.PsiMethod) RowIcon(com.intellij.ui.RowIcon) PsiMember(com.intellij.psi.PsiMember)

Aggregations

PsiMember (com.intellij.psi.PsiMember)19 PsiElement (com.intellij.psi.PsiElement)5 PsiMethod (com.intellij.psi.PsiMethod)5 PsiClass (com.intellij.psi.PsiClass)4 MemberInfo (com.intellij.refactoring.util.classMembers.MemberInfo)4 Project (com.intellij.openapi.project.Project)3 ArrayList (java.util.ArrayList)3 LookupElement (com.intellij.codeInsight.lookup.LookupElement)2 StringUtil (com.intellij.openapi.util.text.StringUtil)2 PsiModifierList (com.intellij.psi.PsiModifierList)2 MemberSelectionPanel (com.intellij.refactoring.ui.MemberSelectionPanel)2 MemberSelectionTable (com.intellij.refactoring.ui.MemberSelectionTable)2 RowIcon (com.intellij.ui.RowIcon)2 ContainerUtil (com.intellij.util.containers.ContainerUtil)2 List (java.util.List)2 AnalysisScope (com.intellij.analysis.AnalysisScope)1 CodeInsightBundle (com.intellij.codeInsight.CodeInsightBundle)1 CodeInsightSettings (com.intellij.codeInsight.CodeInsightSettings)1 CamelHumpMatcher (com.intellij.codeInsight.completion.impl.CamelHumpMatcher)1 LookupManager (com.intellij.codeInsight.lookup.LookupManager)1