How to get a list of all registered tool window IDs upon project open

I'm wondering if someone can tell me how to get a list of all registered tool window IDs when a project is opened. I know about ToolWindowManager.getToolWindowIds(), but it doesn't do me much good to call it from the projectOpened() method because all the components won't (necessarily) be registered yet.

Is there some method I can implement which gets called after a project is opened AND after all the components have been registered?

thanks!

2 comments
Comment actions Permalink

Try the new StartupManager:

STartupManager.getInstance(myProject).registerPostStartupActivity(new Runnable...)



Chris Bartley wrote:

I'm wondering if someone can tell me how to get a list of all registered tool window IDs when a project is opened. I know about ToolWindowManager.getToolWindowIds(), but it doesn't do me much good to call it from the projectOpened() method because all the components won't (necessarily) be registered yet.

Is there some method I can implement which gets called after a project is opened AND after all the components have been registered?

thanks!


--

Erb

==============================================================
"Most of you are familiar with the virtues of a programmer.
There are three, of course: laziness, impatience, and hubris."
- Larry Wall
==============================================================

0
Comment actions Permalink

Thanks Erb, that helps a bit, but it still doesn't totally fix the problem. I registered this:

<![CDATA[public static final class StartupToolWindowEnumerator implements Runnable
   {
   private final Project project;
   private final boolean isPostStartup;

   public StartupToolWindowEnumerator(final Project project, final boolean isPostStartup)
      {
      this.project = project;
      this.isPostStartup = isPostStartup;
      }

   public void run()
      {
      System.out.println("StartupToolWindowEnumerator.run() [post startup = " + isPostStartup + "]");
      final ToolWindowManager twm = ToolWindowManager.getInstance(project);
      final String[] ids = twm.getToolWindowIds();
      for (int k = 0; k < ids.length; k++)
         {
         System.out.println("   " + ids[k] + "");
         }
      }
   }]]>


...by doing this...

<![CDATA[StartupManager.getInstance(project).registerPostStartupActivity(new PostStartupToolWindowEnumerator(project));]]>


...but still only received the following output in the console:

<![CDATA[ PostStartupToolWindowEnumerator.run() Run Hierarchy Debug Jython Find Inspection Messages ]]>

It looks to me like the Project, Structure, Commander, etc. tool windows are apparently being registered after projectOpened() is called and even after the post startup activity. Any idea why?

All I really wanted to do was create a simple plugin to hide the Commander tool window button (I never use it, so I'd rather not even see it) when a project is opened. I could force the user to perform some action to do it, but that's kinda lame.

thanks,

Chris

0

Please sign in to leave a comment.