Programmatically Adding Add-In Components

Discussion created by nieltown on Feb 2, 2012
Latest reply on Jul 12, 2012 by jhanks
I have a custom Swing component inside a DockableWindow in ArcGIS.  I am currently using the Add-In framework.  I have a toolbar that I've created using the Eclipse plug-in, and I have assigned it an ID, say "TestToolbar."  However, I'm unable to get a reference to it using CommandBars, although it does show up in my list of toolbars in ArcMap.

I've tried the following code:

doc =;
ICommandBars commandBars = doc.getCommandBars();
ICommandItem commandItem = commandBars.find("TestToolbar", false, false);

For some reason, though, the ICommandItem reference is always null.  I want to add and remove the toolbar programmatically, so how can I get a reference to a toolbar created using the Add-In framework?

Any help would be much appreciated.