boolean (@NotNull MoveMembersOptions options, @NotNull MoveMembersProcessor.MoveMembersUsageInfo usage) { final PsiElement element = usage.getElement(); if (element == null || !element.isValid()) return true; if (usage.reference instanceof PsiReferenceExpression refExpr) { PsiExpression qualifier = refExpr.getQualifierExpression(); if (qualifier != null) { if (usage.qualifierClass != null && PsiTreeUtil.getParentOfType(refExpr, PsiSwitchLabelStatement.class) == null) { changeQualifier(refExpr, usage.qualifierClass, usage.member); } else { final Project project = element.getProject(); PsiClass targetClass = JavaPsiFacade.getInstance(project).findClass(options.getTargetClassName(), element.getResolveScope()); if (targetClass != null) { final PsiReferenceParameterList parameterList = refExpr.getParameterList(); if ((targetClass.isEnum() || PsiTreeUtil.isAncestor(targetClass, element, true)) && parameterList != null && parameterList.getTypeArguments().length == 0 && !(refExpr instanceof PsiMethodReferenceExpression)) { refExpr.setQualifierExpression(null); } else { changeQualifier(refExpr, targetClass, usage.member); } } } } else { // no qualifier if (usage.qualifierClass != null && (!usage.qualifierClass.isEnum() || PsiTreeUtil.getParentOfType(refExpr, PsiSwitchLabelStatement.class) == null)) { changeQualifier(refExpr, usage.qualifierClass, usage.member); } } return true; } return false; }