void (final FacetEditorValidator validator, JComponent... componentsToWatch) { if (validator instanceof SlowFacetEditorValidator) { if (myParentDisposable == null) { throw new IllegalArgumentException("SlowFacetEditorValidator could not be registered if parent disposable is null"); } mySlowValidators.add(validator); } else { myValidators.add(validator); } final UserActivityWatcher watcher = new UserActivityWatcher(); for (JComponent component : componentsToWatch) { watcher.register(component); } watcher.addUserActivityListener(new UserActivityListener() { @Override public void stateChanged() { validate(); } }); }