Create custom Tree View in a Tool Window Michael Wölk 创建于 2017年05月26日 10:02 Hi! is it easy possible to create a tree view for a custom set of Files and Directories? At least i want to append this to a Jpanel in a Tool Window
Yes, it is easy.
You can try to use JTree with a custom TreeModel.
You can use our Tree with TreeStructure for complex cases.
To show a custom set of files on the Project View you could define your own scope in File | Settings | Appearance & Behavior | Scopes
Yes, Exactly as a custom scope. but i need it in a Plugin, because unfortunatelly there is no possibility to filter by GIT/VCS. Anyway....
I tried what u said, but its not easy. not easy for me haha. here is what i have.
private void createUIComponents() {
Tree defaultTree = new Tree();
FileChooserDescriptor fileChooserDescriptor = FileChooserDescriptorFactory.createMultipleFoldersDescriptor();
MyFileCellRenderer myFileCellRenderer = new ui.MyFileCellRenderer();
FileSystemTreeImpl FileSystemTreeImpl = new FileSystemTreeImpl(
this.project,
fileChooserDescriptor,
defaultTree,
myFileCellRenderer,
null,
null
);
this.tree = FileSystemTreeImpl.getTree();
}
What i get is a FileTree but only with Directories and No Files in it. The Color Scheme works!
How is it possible to see the Files too?
How can i Filter this list? With a CellRenderer?
Can you give me an Example?
Better: Actually i want a Diff-View-File-Tree. I want to show all affected files between two Revisions, but in a own Pane.
Got it
I do not need checkboxes, but no matter.
FileChooserDescriptor is responsible for the content. You cannot see files, because you use createMultiple*Folders*Descriptor. Choose another one. Also you can modify it for your needs