private FileSystemTree createFsTree(Project project) {
Ref<FileSystemTree> myFsTreeRef = new Ref<FileSystemTree>();
MyTree myTree = new MyTree(project);
// must be installed before adding tree to FileSystemTreeImpl
EditSourceOnDoubleClickHandler.install(myTree, new DisableHighlightingRunnable(project, myFsTreeRef));
FileSystemTree result = new FileSystemTreeImpl(project, createFileChooserDescriptor(), myTree, null, null, null) {
@Override
protected AbstractTreeBuilder createTreeBuilder(JTree tree, DefaultTreeModel treeModel, AbstractTreeStructure treeStructure, Comparator<NodeDescriptor> comparator, FileChooserDescriptor descriptor, @Nullable Runnable onInitialized) {
return new FileTreeBuilder(tree, treeModel, treeStructure, comparator, descriptor, onInitialized) {
@Override protected boolean isAutoExpandNode(NodeDescriptor nodeDescriptor) {
return nodeDescriptor.getElement() instanceof RootFileElement;
}
};
}
};
myFsTreeRef.set(result);
// must be installed after adding tree to FileSystemTreeImpl
EditSourceOnEnterKeyHandler.install(myTree, new DisableHighlightingRunnable(project, myFsTreeRef));
return result;
}