Tool window Tab : Can I handle tool window tab click

Hello ,

I want to do a custom action when clicking the tool window tab. Is it possible to register such a listener?

 

Best Raegrds

Manoj K Nair

0
4 comments
Avatar
Permanently deleted user

What does "tab" mean in your case? Are "Project/Structure/Find/Run/Debug" tabs?

0
Avatar
Permanently deleted user

I am creating a tool window named 'Cloud" and each time when I click the window tab named "Cloud" , it should refresh the item inside it.

 

0
Avatar
Permanently deleted user

This code snippet may help you:

        ToolWindowManagerEx instanceEx = ToolWindowManagerEx.getInstanceEx(project);
        instanceEx.addToolWindowManagerListener(new ToolWindowManagerListener() {
          String lastActiveId = null;

          @Override
          public void toolWindowRegistered(@NotNull String s) {}

          @Override
          public void stateChanged() {
            String id = instanceEx.getActiveToolWindowId();
            if (!Comparing.equal(lastActiveId, id)) {
              lastActiveId = id;
              if ("Cloud".equals(id)) {
                //todo refresh the item
              }
            }
          }
        });
0
Avatar
Permanently deleted user

@Vassiliy Kudryashov Thanks a lot !

0

Please sign in to leave a comment.