boolean (@NotNull PsiFile file) { boolean doNotKeepLineBreaks = ReadAction.compute(() -> isDoNotKeepLineBreaks(file)); if (!doNotKeepLineBreaks || isSecondReformatDisabled()) return false; CodeInsightSettings settings = CodeInsightSettings.getInstance(); if (!settings.ENABLE_SECOND_REFORMAT) { Ref<Boolean> ref = Ref.create(true); ApplicationManager.getApplication().invokeAndWait(() -> { ref.set( MessageDialogBuilder.yesNo(CodeInsightBundle.message("second.reformat"), CodeInsightBundle.message("do.you.want.to.remove.custom.line.breaks")) .doNotAsk(new DoNotAskOption.Adapter() { @Override public void rememberChoice(boolean isSelected, int exitCode) { if (isSelected) { settings.ENABLE_SECOND_REFORMAT = exitCode == DialogWrapper.OK_EXIT_CODE; PropertiesComponent.getInstance().setValue(SECOND_REFORMAT_CONFIRMED, true); } } }).ask(myProject)); }); return ref.get(); } return true; }