void () { final var actualEditor = ObjectUtils.tryCast(mainEditor, EditorImpl.class); if (actualEditor == null) { return; } final var scrollPane = actualEditor.getScrollPane(); final var helper = new PreciseVerticalScrollHelper( actualEditor, () -> ObjectUtils.tryCast(myPanel, MarkdownHtmlPanelEx.class) ); scrollPane.addMouseWheelListener(helper); Disposer.register(this, () -> scrollPane.removeMouseWheelListener(helper)); }