void (JComponent actualComponent, LayoutActionsFloatingToolbar toolbar) { StartupUiUtil.addAwtListener(new MyMouseListener(toolbar), AWTEvent.MOUSE_MOTION_EVENT_MASK, toolbar); final var actualEditor = UIUtil.findComponentOfType(actualComponent, EditorComponentImpl.class); if (actualEditor != null) { final var editorKeyListener = new KeyAdapter() { @Override public void keyPressed(KeyEvent event) { toolbar.scheduleHide(); } }; actualEditor.getEditor().getContentComponent().addKeyListener(editorKeyListener); Disposer.register(toolbar, () -> { actualEditor.getEditor().getContentComponent().removeKeyListener(editorKeyListener); }); } }