InspectionGadgetsFix (Object... infos) { return new InspectionGadgetsFix() { @Override public void doFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) { final PsiMethod element = PsiTreeUtil.getParentOfType(descriptor.getPsiElement(), PsiMethod.class); if (element != null) { JavaRefactoringFactory.getInstance(project).createMakeMethodStatic(element, m_replaceQualifier, null, PsiField.EMPTY_ARRAY, null).run(); } } @Override public @NotNull IntentionPreviewInfo generatePreview(@NotNull Project project, @NotNull ProblemDescriptor previewDescriptor) { final PsiMethod element = PsiTreeUtil.getParentOfType(previewDescriptor.getPsiElement(), PsiMethod.class); if (element != null) { element.getModifierList().setModifierProperty(PsiModifier.STATIC, true); } return IntentionPreviewInfo.DIFF; } @Override public boolean startInWriteAction() { return false; } @NotNull @Override public String getFamilyName() { return InspectionGadgetsBundle.message("change.modifier.quickfix", PsiModifier.STATIC); } }; }