void (@NotNull String fileText, @NotNull Consumer<String> runnable) { JavaCodeFoldingSettings settings = JavaCodeFoldingSettings.getInstance(); JavaCodeFoldingSettingsImpl restoreSettings = new JavaCodeFoldingSettingsImpl(); restoreSettings.loadState((JavaCodeFoldingSettingsImpl) settings); try { SettingsConfigurator configurator = new SettingsConfigurator(fileText, settings); configurator.configureSettings(); runnable.accept(fileText); } finally { ((JavaCodeFoldingSettingsImpl) JavaCodeFoldingSettings.getInstance()).loadState(restoreSettings); } }