Display project tree in settings

Hello.
I am new in IDEA plugins dev. Maybe my question was discussed many of times but I can't find directly answer.
I need to display project tree at my settings panel
Tree must be thomething like tree.JPG
Is there something standart way to display project tree (I need only folders without files)? Maybe some API classes that build tree according to project object.
Or I need to get project structure and manually create JTree?

Links to examples would be great!.
Thanks.

4 comments
Comment actions Permalink

com.intellij.openapi.fileChooser.FileSystemTreeFactory#createFileSystemTree should work for this. You can limit display to folders only via FileChooserDescriptor.

0
Comment actions Permalink

Thanks Yann! It is working. But i can't understand how to display only project tree, not all my file system.     


  FileSystemTreeFactory treeFactory = new FileSystemTreeFactoryImpl();
  FileSystemTree tree = treeFactory.createFileSystemTree(settings.getProject(), new FileChooserDescriptor(false, true, false, false,false,false));
  add(tree.getTree());



Is there any approach to limit this tree to show only project structure?

0
Comment actions Permalink

I didn't try it myself, but com.intellij.openapi.fileChooser.FileChooserDescriptor#getRoots looks like it should work

0
Comment actions Permalink

Yann, thanks. It's works!

        FileSystemTreeFactory treeFactory = new FileSystemTreeFactoryImpl();         FileChooserDescriptor descriptor =  new FileChooserDescriptor(false, true, false, false,false,false);         descriptor.setIsTreeRootVisible(true);         descriptor.setRoots(settings.getProject().getBaseDir());         FileSystemTree tree = treeFactory.createFileSystemTree(settings.getProject(), descriptor);         add(tree.getTree());

0

Please sign in to leave a comment.