void () { myTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { final TreePath path = e.getOldLeadSelectionPath(); if (path != null) { final MyNode node = (MyNode)path.getLastPathComponent(); final NamedConfigurable namedConfigurable = node.getConfigurable(); if (namedConfigurable instanceof ScopeConfigurable) { ((ScopeConfigurable)namedConfigurable).cancelCurrentProgress(); } } } }); super.initTree(); myTree.setShowsRootHandles(false); TreeSpeedSearch.installOn(myTree, true, treePath -> ((MyNode)treePath.getLastPathComponent()).getDisplayName()); myTree.getEmptyText().setText(IdeBundle.message("scopes.no.scoped")); }