void (@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiParameter variable = (PsiParameter)descriptor.getPsiElement().getParent(); if (variable == null || !variable.isValid()) return; //weird. should not get here when field becomes invalid if (!IntentionPreviewUtils.prepareElementForWrite(descriptor.getPsiElement())) return; final PsiFile myFile = variable.getContainingFile(); try { final List<PsiElement> newDeclarations = moveDeclaration(project, variable); if (newDeclarations.isEmpty()) return; positionCaretToDeclaration(project, myFile, newDeclarations.get(newDeclarations.size() - 1)); newDeclarations.forEach(declaration -> inlineRedundant(declaration)); } catch (IncorrectOperationException e) { LOG.error(e); } }