diff --git a/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java b/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java index c8205dc11647..dd88d9884735 100644 --- a/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java +++ b/platform/lang-impl/src/com/intellij/psi/codeStyle/DetectableIndentOptionsProvider.java @@ -139,18 +139,15 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { if (indentOptions instanceof TimeStampedIndentOptions) { if (((TimeStampedIndentOptions)indentOptions).isDetected()) { actions.add( - new AnAction(ApplicationBundle.message("code.style.indent.detector.reject", projectOptionsTip)) { - @Override - public void actionPerformed(AnActionEvent e) { + DumbAwareAction.create( + ApplicationBundle.message("code.style.indent.detector.reject", projectOptionsTip), + e -> { disableForFile(virtualFile, indentOptions); notifyIndentOptionsChanged(project, file); - } - } - ); + })); actions.add( - new AnAction(ApplicationBundle.message("code.style.indent.detector.reindent", projectOptionsTip)) { - @Override - public void actionPerformed(AnActionEvent e) { + DumbAwareAction.create(ApplicationBundle.message("code.style.indent.detector.reindent", projectOptionsTip), + e->{ disableForFile(virtualFile, indentOptions); notifyIndentOptionsChanged(project, file); CommandProcessor.getInstance().runUndoTransparentAction( @@ -158,19 +155,15 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { () -> CodeStyleManager.getInstance(project).adjustLineIndent(file, file.getTextRange())) ); myDiscardedOptions.remove(virtualFile); - } - } - ); + })); actions.add( - new AnAction(ApplicationBundle.message("code.style.indent.detector.disable")) { - @Override - public void actionPerformed(AnActionEvent e) { + DumbAwareAction.create( + ApplicationBundle.message("code.style.indent.detector.disable"), + e -> { CodeStyle.getSettings(project).AUTODETECT_INDENTS = false; notifyIndentOptionsChanged(project, null); showDisabledDetectionNotification(project); - } - } - ); + })); } } else if (myDiscardedOptions.containsKey(virtualFile)) { @@ -178,15 +171,13 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { final Document document = PsiDocumentManager.getInstance(project).getDocument(file); if (document != null) { actions.add( - new AnAction(ApplicationBundle.message("code.style.indent.detector.apply", getTooltip(discardedOptions))) { - @Override - public void actionPerformed(AnActionEvent e) { + DumbAwareAction.create( + ApplicationBundle.message("code.style.indent.detector.apply", getTooltip(discardedOptions)), + e -> { myDiscardedOptions.remove(virtualFile); discardedOptions.associateWithDocument(document); notifyIndentOptionsChanged(project, file); - } - } - ); + })); } } return ContainerUtil.toArray(actions, AnAction.EMPTY_ARRAY); @@ -219,7 +210,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } private static class DetectionDisabledNotification extends Notification { - public DetectionDisabledNotification(Project project) { + private DetectionDisabledNotification(Project project) { super(NOTIFICATION_GROUP.getDisplayId(), ApplicationBundle.message("code.style.indent.detector.notification.title"), ApplicationBundle.message("code.style.indent.detector.notification.content"), @@ -230,7 +221,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { } private static class ShowIndentDetectionOptionAction extends DumbAwareAction { - public ShowIndentDetectionOptionAction(@Nullable String text) { + private ShowIndentDetectionOptionAction(@Nullable String text) { super(text); } @@ -244,7 +235,7 @@ public class DetectableIndentOptionsProvider extends FileIndentOptionsProvider { private final Project myProject; private final Notification myNotification; - public ReEnableDetection(@NotNull Project project, Notification notification) { + private ReEnableDetection(@NotNull Project project, Notification notification) { super(ApplicationBundle.message("code.style.indent.detector.notification.enable")); myProject = project; myNotification = notification;