{
String oldValue = null;
for (int i = 0; i < metaData.length; i++)
{
final StyleMetaData data = metaData[i];
if (data.isHidden())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowExpertItems() == false && data.isExpert())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && data.isDeprecated())
{
continue;
}
metaDataCount += 1;
if (groupCount == 0)
{
groupCount = 1;
oldValue = data.getGrouping(locale);
continue;
}
final String grouping = data.getGrouping(locale);
if ((ObjectUtilities.equal(oldValue, grouping)) == false)
{
groupCount += 1;
oldValue = grouping;
continue;
}
}
}
final StyleMetaData[] groupedMetaData = new StyleMetaData[metaDataCount + groupCount];
int targetIdx = 0;
GroupingHeader[] groupings = new GroupingHeader[groupedMetaData.length];
GroupingHeader group = null;
for (int sourceIdx = 0; sourceIdx < metaData.length; sourceIdx++)
{
final StyleMetaData data = metaData[sourceIdx];
if (data.isHidden())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowExpertItems() == false && data.isExpert())
{
continue;
}
if (WorkspaceSettings.getInstance().isShowDeprecatedItems() == false && data.isDeprecated())
{
continue;
}
if (targetIdx == 0)
{
group = new GroupingHeader(data.getGrouping(locale));
groupings[targetIdx] = group;
targetIdx += 1;
}
else
{
final String newgroup = data.getGrouping(locale);
if ((ObjectUtilities.equal(newgroup, group.getHeaderText())) == false)
{
group = new GroupingHeader(newgroup);
groupings[targetIdx] = group;
targetIdx += 1;