}
insertedUserDefinedActions = true;
}
final JMenu menu = PreviewPaneUtilities.createMenu(cat);
zoomActions.put(cat, PreviewPaneUtilities.buildMenu(menu, plugins, this));
menus.put(cat, menu);
}
final ActionCategory[] categories = (ActionCategory[])
collectedCategories.toArray(new ActionCategory[collectedCategories.size()]);
final CategoryTreeItem[] categoryTreeItems =
PreviewPaneUtilities.buildMenuTree(categories);
final ArrayList menuList = new ArrayList();
for (int i = 0; i < categoryTreeItems.length; i++)
{
final CategoryTreeItem item = categoryTreeItems[i];
final JMenu menu = (JMenu) menus.get(item.getCategory());
// now connect all menus ..
final CategoryTreeItem[] childs = item.getChilds();
Arrays.sort(childs);
for (int j = 0; j < childs.length; j++)
{
final CategoryTreeItem child = childs[j];
final JMenu childMenu = (JMenu) menus.get(child.getCategory());
if (childMenu != null)
{
menu.add(childMenu);
}
}
if (item.getParent() == null)
{
menuList.add(item);
}
}
Collections.sort(menuList);
final ArrayList retval = new ArrayList();
for (int i = 0; i < menuList.size(); i++)
{
final CategoryTreeItem item = (CategoryTreeItem) menuList.get(i);
final JMenu menu = (JMenu) menus.get(item.getCategory());
if (item.getCategory().isUserDefined() || menu.getItemCount() > 0)
{
retval.add(menu);
}
}