void (@NotNull JComponent component) { MouseAdapter mouseListener = new ValidationMouseListener(); PropertyChangeListener propertyChangeListener = e -> { if (cellComponentProvider != null && cellComponentProvider.isEditingStarted(e)) { hidePopup(true, null); } }; component.addMouseListener(mouseListener); component.addMouseMotionListener(mouseListener); component.addPropertyChangeListener(propertyChangeListener); Disposer.register(parentDisposable, () -> { hidePopup(true, null); component.removeMouseListener(mouseListener); component.removeMouseMotionListener(mouseListener); component.removePropertyChangeListener(propertyChangeListener); cellComponentProvider = null; validationInfo = null; popupBuilder = null; }); }