void (final @NotNull Editor editor) { if (editor instanceof EditorEx) { ((EditorEx)editor).addPropertyChangeListener(this::updateEditorFont, this); } final CaretListener caretListener = new CaretListener() { @Override public void caretPositionChanged(final @NotNull CaretEvent e) { if (myUserCaretChange) { queueUpdate(); } myUserCaretChange = true; } }; editor.getCaretModel().addCaretListener(caretListener, this); EditorGutter gutter = editor.getGutter(); if (gutter instanceof EditorGutterComponentEx gutterComponent) { if (!(gutterComponent instanceof MouseListener)) { LOG.error("Can't delegate mouse events to EditorGutterComponentEx: " + gutterComponent); } MouseEventAdapter<EditorGutterComponentEx> mouseListener = new MouseEventAdapter<>(gutterComponent) { @Override protected @NotNull MouseEvent convert(@NotNull MouseEvent event) { return convert(event, gutterComponent); } @Override protected MouseListener getMouseListener(@NotNull EditorGutterComponentEx adapter) { if (adapter instanceof MouseListener && adapter.isShowing()) { return (MouseListener)adapter; } return null; } }; ComponentAdapter resizeListener = new ComponentAdapter() { @DirtyUI @Override public void componentResized(ComponentEvent event) { breadcrumbs.setFont(getNewFont(myEditor)); } }; addComponentListener(resizeListener); gutterComponent.addComponentListener(resizeListener); breadcrumbs.addMouseListener(mouseListener); Disposer.register(this, () -> { removeComponentListener(resizeListener); gutterComponent.removeComponentListener(resizeListener); breadcrumbs.removeMouseListener(mouseListener); }); } }