void (int capacityKB, Consumer<? super ConsoleViewImpl> runnable) { UISettings uiSettings = UISettings.getInstance(); boolean oldUse = uiSettings.getOverrideConsoleCycleBufferSize(); int oldSize = uiSettings.getConsoleCycleBufferSizeKb(); uiSettings.setOverrideConsoleCycleBufferSize(true); uiSettings.setConsoleCycleBufferSizeKb(capacityKB); // create new to reflect changed buffer size ConsoleViewImpl console = createConsole(true, getProject()); ExtensionPoint<ConsoleFolding> point = ConsoleFolding.EP_NAME.getPoint(); ((ExtensionPointImpl<ConsoleFolding>)point).maskAll(Collections.emptyList(), console, false); assertEmpty(point.getExtensions()); try { runnable.consume(console); } finally { Disposer.dispose(console); uiSettings.setOverrideConsoleCycleBufferSize(oldUse); uiSettings.setConsoleCycleBufferSizeKb(oldSize); } }