if ( parents != null )
{
for ( Object parent : parents )
{
AttributeTypeWrapper parentATW = ( AttributeTypeWrapper ) getWrapper( parent );
AttributeTypeWrapper atw = null;
if ( parentATW == null )
{
int group = store.getInt( PluginConstants.PREFS_SCHEMA_VIEW_GROUPING );
if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_FOLDERS )
{
for ( TreeNode child : root.getChildren() )
{
if ( child instanceof Folder )
{
Folder folder = ( Folder ) child;
if ( folder.getType().equals( FolderType.ATTRIBUTE_TYPE ) )
{
atw = new AttributeTypeWrapper( at, folder );
break;
}
}
}
}
else if ( group == PluginConstants.PREFS_SCHEMA_VIEW_GROUPING_MIXED )
{
atw = new AttributeTypeWrapper( at, root );
}
}
else
{
atw = new AttributeTypeWrapper( at, parentATW );
}
atw.getParent().addChild( atw );
createdWrappers.add( atw );
elementsToWrappersMap.put( at, atw );
}
}
List<Object> children = hierarchyManager.getChildren( at );
if ( children != null )
{
for ( Object child : children )
{
AttributeTypeWrapper childATW = ( AttributeTypeWrapper ) getWrapper( child );
elementsToWrappersMap.remove( child );
childATW.getParent().removeChild( childATW );
for ( TreeNode createdWrapper : createdWrappers )
{
AttributeTypeWrapper atw = new AttributeTypeWrapper( ( AttributeType ) child, createdWrapper );
atw.getParent().addChild( atw );
elementsToWrappersMap.put( child, atw );
}
}
}
}