How to run a plugin when we click on a directory or file of the project view?
已回答
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 inten
tionally 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.
请先登录再写评论。
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) {
}
});
Thanks Aleksey i will check tomorrow and update it here