void (PsiModifierList modifierList, AccessModifier modifier, boolean hasConflicts) { Project project = modifierList.getProject(); PsiElement parent = modifierList.getParent(); if (parent instanceof PsiMethod method && hasConflicts) { //no myPrepareSuccessfulSwingThreadCallback means that the conflicts when any, won't be shown again var csp = JavaRefactoringFactory.getInstance(project).createChangeSignatureProcessor( method, false, modifier.toPsiModifier(), method.getName(), method.getReturnType(), ParameterInfoImpl.fromMethod(method), JavaThrownExceptionInfo.extractExceptions(method),null, null, null); csp.run(); return; } PsiFile file = modifierList.getContainingFile(); WriteCommandAction.writeCommandAction(project, file) .withName(IntentionPowerPackBundle.message("change.modifier.intention.name")) .run(() -> { VisibilityUtil.setVisibility(modifierList, modifier.toPsiModifier()); if (modifier != AccessModifier.PACKAGE_LOCAL) { final PsiElement whitespace = PsiParserFacade.getInstance(project).createWhiteSpaceFromText(" "); final PsiElement sibling = modifierList.getNextSibling(); if (sibling instanceof PsiWhiteSpace) { sibling.replace(whitespace); CodeStyleManager.getInstance(project).reformatRange(parent, modifierList.getTextOffset(), modifierList.getNextSibling().getTextOffset()); } } SuggestedRefactoringProvider.getInstance(project).reset(); }); }