private static void encodeRef(final PsiClass aClass,
                                @Nullable final PsiElement resolved,
                                @NotNull final Set<PsiMember> movedMembers,
                                @NotNull final PsiElement toPut,
                                @Nullable final PsiElement qualifier) {

    for (PsiMember movedMember : movedMembers) {
      if (movedMember.equals(resolved)) {
        if (qualifier == null) {
          toPut.putCopyableUserData(REMOVE_QUALIFIER_KEY, Boolean.TRUE);
        } else {
          if (qualifier instanceof PsiJavaCodeReferenceElement &&
              ((PsiJavaCodeReferenceElement)qualifier).isReferenceTo(aClass)) {
            toPut.putCopyableUserData(REPLACE_QUALIFIER_KEY, aClass);
          }
        }
      } else if (movedMember instanceof PsiClass && PsiTreeUtil.getParentOfType(resolved, PsiClass.class, false) == movedMember) {
        if (qualifier instanceof PsiJavaCodeReferenceElement && ((PsiJavaCodeReferenceElement)qualifier).isReferenceTo(movedMember)) {
          toPut.putCopyableUserData(REPLACE_QUALIFIER_KEY, (PsiClass)movedMember);
        }
      } else {
        if (qualifier instanceof PsiQualifiedExpression) {
          final PsiJavaCodeReferenceElement qElement = ((PsiQualifiedExpression)qualifier).getQualifier();
          if (qElement != null && qElement.isReferenceTo(aClass)) {
            toPut.putCopyableUserData(REPLACE_QUALIFIER_KEY, aClass);
          }
        }
      }
    }
  }
private static void encodeRef(final PsiClass aClass,
                                @Nullable final PsiElement resolved,
                                @NotNull final Set<PsiMember> movedMembers,
                                @NotNull final PsiElement toPut,
                                @Nullable final PsiElement qualifier)