}
}
private void createInsertElementsMenu()
{
final XulMenupopup insertElementsMenu = context.getView().getXulComponent("insert-elements-popup", XulMenupopup.class);// NON-NLS
if (insertElementsMenu != null)
{
final ElementMetaData[] datas = ElementTypeRegistry.getInstance().getAllElementTypes();
Arrays.sort(datas, new GroupedMetaDataComparator());
Object grouping = null;
boolean firstElement = true;
for (int i = 0; i < datas.length; i++)
{
final ElementMetaData data = datas[i];
if (data.isHidden())
{
continue;
}
final String currentGrouping = data.getGrouping(Locale.getDefault());
if (firstElement == false)
{
if (ObjectUtilities.equal(currentGrouping, grouping) == false)
{
grouping = currentGrouping;
SwingMenuseparator separator = new SwingMenuseparator(null, null, null, "menuseparator");
insertElementsMenu.addChild(separator);
}
}
else
{
grouping = currentGrouping;
firstElement = false;
}
final InsertElementAction action = new InsertElementAction(data);
action.setReportDesignerContext(context);
ActionSwingMenuitem menuItem = new ActionSwingMenuitem(ActionSwingMenuitem.MENUITEM);
menuItem.setAction(action);
insertElementsMenu.addChild(menuItem);
}
}
}