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;
morphMenu.addSeparator();
}
}
else
{
grouping = currentGrouping;
firstElement = false;
}
try
{
final MorphAction action = new MorphAction(data.create());
action.setReportDesignerContext(context);
morphMenu.add(new JMenuItem(action));
}
catch (InstantiationException e)
{
UncaughtExceptionsModel.getInstance().addException(e);
}
}
}
final JMenu insertElementsMenu = context.getXulDesignerFrame().getMenuById("insert-elements-menu");// 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;