void (@NotNull Disposable parentDisposable, @NotNull PropertyChangeListener listener) { KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(SWING_FOCUS_OWNER_PROPERTY, listener); Disposer.register(parentDisposable, () -> { KeyboardFocusManager.getCurrentKeyboardFocusManager().removePropertyChangeListener(SWING_FOCUS_OWNER_PROPERTY, listener); }); }