plugin with a tree view

I want to write a plugin which needs to do the following.

  • It has a tree view. 
  • Essentially it looks like the project tree , but only a subset of the files/folders are shown in the view. The difference is, some files may come from non project sources.
  • It scans the project files and calls a api 'shouldShow(file)' which is going to say true/false based on some custom logic.

for ex, if my project tree looks like this:

myProject
->.setting
->src
-->a
--->b
---->B.java
---->x.txt
-->c
--->asdf.png
->target
->pom.xml


my plugin view needs to show, like this

custom_view
->src
-->a
--->b
---->x.txt
-->c
--->asdf.png

How does my plugin receive file notifications (whenever a file is added/deleted/changed in project)) and how do I navigate the project tree. What apis are relevant ?

 

 

3
6 comments
Avatar
Permanently deleted user

@davidgreens

3
Avatar
Permanently deleted user

Have you seen the following documentation?

http://www.jetbrains.org/intellij/sdk/docs/tutorials/tree_structure_view.html

Is it answer to your question?

 

Regards,

Sergey

3
Avatar
Permanently deleted user

Don't think so. First thing, it is calling the code when a tree node is expanded.

I have the following needs.

1. To know the full project tree so that I can paint a custom view for the files I am interested in.

    I see that, the createToolWindowContent of the ToolWindowFactory is given a Project instance, and I can iterate over it to know the entire tree.
    So, I am ok for this requirement.

2. When a file is changed, deleted, created , I want to adjust my tree view too. For that, I am assuming there is a way I can tell Intellij platform to send me a notification whenever those things happen. Is there such an api ? some way to get that information ?

3
Avatar
Permanently deleted user
3
Avatar
Permanently deleted user

thank you. 

1

Please sign in to leave a comment.