Getting tool window's select item event


I want to get tool window's select item event.
For example, when user select file at project tool window, the navigation changed.
I would like to create this type of plugin that triggers an action when user selects item[s] on tool windows.
The tool window can be other plugin's tool windows.

I tried SelectInTarget, but it does not do anything when I select a file on the project window or gradle tasks on gradle plugin window.

Thanks, in advance.

Comment actions Permalink

What are you trying to accomplish? There is no API that would allow you to receive notifications when any item is selected in any control of any toolwindow of any plugin.

The SelectInTarget interface is something else entirely; it's used when the user invokes the "Select In" action.

Comment actions Permalink

Thanks for the response.

For instance, when the developer selects multiple gradle tasks, there is no way to find which order the developer selected gradle tasks. I don't use the plugin to run the gradle task because I am not sure if I picked right tasks in right order.

From methods signitures, I thought SelectedInTarget is the one that trigger events. Thanks for the information.

How does IntelliJ's navigation work? I thought there is an event listener...

Comment actions Permalink

There is no event listener. Each UI control can expose data through the DataProvider interface, and one of the data items that can be exposed is an implementation of the Navigatable interface.

Also, some toolwindows do not use any shared infrastructure for navigation at all.

Comment actions Permalink

Thanks a lot. Now, it makes sense.
I will think a different way to accomplish my problem.


Please sign in to leave a comment.