void (TreeSelectionEvent e) { TreePath[] paths = e.getPaths(); boolean enabled = true; for (TreePath treePath : paths) { if (e.isAddedPath(treePath)) { VirtualFile file = FileSystemTreeImpl.getVirtualFile(treePath); if (file == null || !myChooserDescriptor.isFileSelectable(file)) enabled = false; } } setOKActionEnabled(enabled); }