void () { if (!CodeStyle.isFormattingEnabled(myFile)) { if (!isInHeadlessMode() && !myEditor.isDisposed() && myEditor.getComponent().isShowing()) { showHint(myEditor, new DisabledFormattingMessageBuilder()); } return; } if (myOptions.isOptimizeImports() && myOptions.getTextRangeType() == VCS_CHANGED_TEXT) { myProcessor = new OptimizeImportsProcessor(myProject, myFile); } if (myProcessChangesTextOnly && !VcsFacade.getInstance().hasChanges(myFile)) { myNoChangesDetected = true; } myProcessor = mixWithReformatProcessor(myProcessor); if (myOptions.isRearrangeCode()) { myProcessor = mixWithRearrangeProcessor(myProcessor); } if (myOptions.isCodeCleanup()) { myProcessor = mixWithCleanupProcessor(myProcessor); } if (shouldNotify()) { myProcessor.setCollectInfo(true); myProcessor.setPostRunnable(() -> { if (myEditor.isDisposed() || !myEditor.getComponent().isShowing()) { return; } if ((!myProcessSelectedText || Objects.requireNonNull(myProcessor.getInfoCollector()).getSecondFormatNotification() != null) && !isExternalFormatterInUse()) { showHint(myEditor, new FormattedMessageBuilder()); } }); } myProcessor.run(); if (myOptions.getTextRangeType() == TextRangeType.WHOLE_FILE) { CodeStyleSettingsManager.getInstance(myProject).notifyCodeStyleSettingsChanged(); if (myOptions.isOptimizeImports()) { CodeStyleCachingService.getInstance(myProject).scheduleWhenSettingsComputed(myFile, () -> { new OptimizeImportsProcessor(myProject, myFile).run(); }); } } }