void (final EventsListener listener) { myEventListeners.add(listener); addTestsTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(final TreeSelectionEvent e) { //We should fire event only if it was generated by this component, //e.g. it is focused. Otherwise it is side effect of selecting proxy in //try by other component //if (myTreeView.isFocusOwner()) { @Nullable final SMTestProxy selectedProxy = (SMTestProxy)getTreeView().getSelectedTest(); listener.onSelected(selectedProxy, SMTestRunnerResultsForm.this, SMTestRunnerResultsForm.this); //} } }); }