* the Type Hierarchy for an attribute type
*/
private List<TreeNode> createTypeHierarchyAttributeType( AttributeTypeImpl at )
{
List<TreeNode> children = new ArrayList<TreeNode>();
HierarchyManager hierarchyManager = new HierarchyManager();
int mode = Activator.getDefault().getDialogSettings().getInt( PluginConstants.PREFS_HIERARCHY_VIEW_MODE );
// Creating the wrapper of the attribute type
AttributeTypeWrapper atw = new AttributeTypeWrapper( at );
if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_TYPE )
{
// Creating the children's wrappers
createChildrenHierarchy( atw, hierarchyManager.getChildren( at ), hierarchyManager );
// Creating its parents' wrappers
List<Object> parents = hierarchyManager.getParents( at );
while ( ( parents != null ) && ( parents.size() == 1 ) )
{
Object parent = parents.get( 0 );
if ( parent instanceof AttributeTypeImpl )
{
AttributeTypeImpl parentAT = ( AttributeTypeImpl ) parent;
AttributeTypeWrapper atw2 = new AttributeTypeWrapper( parentAT );
atw.setParent( atw2 );
atw2.addChild( atw );
atw = atw2;
parents = hierarchyManager.getParents( parentAT );
}
else
{
break;
}
}
children.add( atw );
}
else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
{
// Creating its parents' wrappers
List<Object> parents = hierarchyManager.getParents( at );
while ( ( parents != null ) && ( parents.size() == 1 ) )
{
Object parent = parents.get( 0 );
if ( parent instanceof AttributeTypeImpl )
{
AttributeTypeImpl parentAT = ( AttributeTypeImpl ) parent;
AttributeTypeWrapper atw2 = new AttributeTypeWrapper( parentAT );
atw.setParent( atw2 );
atw2.addChild( atw );
atw = atw2;
parents = hierarchyManager.getParents( parentAT );
}
else
{
break;
}
}
children.add( atw );
}
else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
{
// Creating the children's wrappers
createChildrenHierarchy( atw, hierarchyManager.getChildren( at ), hierarchyManager );
children.add( atw );
}
return children;