How to run a plugin when we click on a directory or file of the project view?

Answered

Hi,

In a plugin I want to get path of file  or directory for  to a Directory or file selection [On left click only ] in the project view . I want to use this path in my plugin when user clicks on run which is present in my Plugin [A  Toolwindow based plugin] ,

Please note that this should intentionally happen when selecting the file (via single left click or keyboard navigation) in the project view, e.g. it is not an option to have this functionality as an action in the context-menu!

Any suggestions? Thanks.

0
2 comments

See an answer to the similar question:
https://intellij-support.jetbrains.com/hc/en-us/community/posts/360004324499-How-to-hook-into-click-select-event-of-the-project-view-

>we have no listener to notify when a pane or a tree changed.
It can be tracked with

ToolWindowManager.getInstance(myProject).getToolWindow(ToolWindowId.PROJECT_VIEW).getContentManager().addContentManagerListener(new ContentManagerAdapter() {
@Override
public void selectionChanged(@NotNull ContentManagerEvent event) {

}
});
0
Avatar
Permanently deleted user

Thanks Aleksey i will check tomorrow and update it here

0

Please sign in to leave a comment.