Ejemplo n.º 1
0
    @Override
    public boolean isMemberEnabled(MemberInfo member) {
      final PsiClass currentSuperClass = getSuperClass();
      if (currentSuperClass == null) return true;
      if (myMemberInfoStorage.getDuplicatedMemberInfos(currentSuperClass).contains(member))
        return false;
      if (myMemberInfoStorage.getExtending(currentSuperClass).contains(member.getMember()))
        return false;
      final boolean isInterface = currentSuperClass.isInterface();
      if (!isInterface) return true;

      PsiElement element = member.getMember();
      if (element instanceof PsiClass && ((PsiClass) element).isInterface()) return true;
      if (element instanceof PsiField) {
        return ((PsiModifierListOwner) element).hasModifierProperty(PsiModifier.STATIC);
      }
      if (element instanceof PsiMethod) {
        final PsiSubstitutor superSubstitutor =
            TypeConversionUtil.getSuperClassSubstitutor(
                currentSuperClass, myClass, PsiSubstitutor.EMPTY);
        final MethodSignature signature = ((PsiMethod) element).getSignature(superSubstitutor);
        final PsiMethod superClassMethod =
            MethodSignatureUtil.findMethodBySignature(currentSuperClass, signature, false);
        if (superClassMethod != null && !PsiUtil.isLanguageLevel8OrHigher(currentSuperClass))
          return false;
        return !((PsiModifierListOwner) element).hasModifierProperty(PsiModifier.STATIC)
            || PsiUtil.isLanguageLevel8OrHigher(currentSuperClass);
      }
      return true;
    }
Ejemplo n.º 2
0
 @Override
 public boolean isAbstractEnabled(MemberInfo member) {
   PsiClass currentSuperClass = getSuperClass();
   if (currentSuperClass == null || !currentSuperClass.isInterface()) return true;
   if (PsiUtil.isLanguageLevel8OrHigher(currentSuperClass)) {
     return true;
   }
   return false;
 }
Ejemplo n.º 3
0
 @Override
 public boolean isAbstractWhenDisabled(MemberInfo member) {
   PsiClass currentSuperClass = getSuperClass();
   if (currentSuperClass == null) return false;
   if (currentSuperClass.isInterface()) {
     final PsiMember psiMember = member.getMember();
     if (psiMember instanceof PsiMethod) {
       return !psiMember.hasModifierProperty(PsiModifier.STATIC);
     }
   }
   return false;
 }
Ejemplo n.º 4
0
 @Override
 public int checkForProblems(@NotNull MemberInfo member) {
   if (member.isChecked()) return OK;
   PsiClass currentSuperClass = getSuperClass();
   if (currentSuperClass != null && currentSuperClass.isInterface()) {
     PsiMember element = member.getMember();
     if (element.hasModifierProperty(PsiModifier.STATIC)) {
       return super.checkForProblems(member);
     }
     return OK;
   } else {
     return super.checkForProblems(member);
   }
 }
  protected void init() {
    super.init();
    final PsiClass psiClass = myMethod.getContainingClass();
    if (psiClass == null) return;
    if (psiClass.isInterface()) {
      myDelegatePanel.setVisible(false);
    }

    if (myMethod.hasModifierProperty(GrModifier.PRIVATE)) {
      myPrivateRadioButton.setSelected(true);
    } else if (myMethod.hasModifierProperty(GrModifier.PROTECTED)) {
      myProtectedRadioButton.setSelected(true);
    } else if (myMethod.hasModifierProperty(GrModifier.PUBLIC)) {
      myPublicRadioButton.setSelected(true);
    }
  }