コード例 #1
0
 @Override
 protected void visitClassMemberReferenceElement(GrMember classMember, GrReferenceElement ref) {
   if (classMember != null && !willBeMoved(classMember, myMovedMembers)) {
     final PsiClass containingClass = classMember.getContainingClass();
     if (containingClass != null
         && !PsiUtil.isAccessibleFromPackage(classMember, myTargetPackage)
         && (classMember.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)
             || classMember.hasModifierProperty(PsiModifier.PROTECTED)
                 && !mySubClass.isInheritor(containingClass, true))) {
       myConflicts.putValue(
           myMember,
           RefactoringUIUtil.getDescription(classMember, true) + " won't be accessible");
     }
   }
 }
コード例 #2
0
 protected void visitClassMemberReferenceElement(
     PsiMember classMember, PsiJavaCodeReferenceElement classMemberReference) {
   if (classMember != null
       && RefactoringHierarchyUtil.isMemberBetween(mySuperClass, mySubclass, classMember)) {
     if (classMember.hasModifierProperty(PsiModifier.STATIC)
         && !willBeMoved(classMember, myMovedMembers)) {
       final boolean isAccessible;
       if (mySuperClass != null) {
         isAccessible = PsiUtil.isAccessible(classMember, mySuperClass, null);
       } else if (myTargetPackage != null) {
         isAccessible = PsiUtil.isAccessibleFromPackage(classMember, myTargetPackage);
       } else {
         isAccessible = classMember.hasModifierProperty(PsiModifier.PUBLIC);
       }
       if (!isAccessible) {
         String message =
             RefactoringBundle.message(
                 "0.uses.1.which.is.not.accessible.from.the.superclass",
                 RefactoringUIUtil.getDescription(myScope, false),
                 RefactoringUIUtil.getDescription(classMember, true));
         message = CommonRefactoringUtil.capitalize(message);
         myConflictsList.putValue(classMember, message);
       }
       return;
     }
     if (!myAbstractMethods.contains(classMember) && !willBeMoved(classMember, myMovedMembers)) {
       if (!existsInSuperClass(classMember)) {
         String message =
             RefactoringBundle.message(
                 "0.uses.1.which.is.not.moved.to.the.superclass",
                 RefactoringUIUtil.getDescription(myScope, false),
                 RefactoringUIUtil.getDescription(classMember, true));
         message = CommonRefactoringUtil.capitalize(message);
         myConflictsList.putValue(classMember, message);
       }
     }
   }
 }