int mode = Activator.getDefault().getDialogSettings().getInt( PluginConstants.PREFS_HIERARCHY_VIEW_MODE );
List<ITreeNode> children = null;
if ( parentElement instanceof ObjectClass )
{
ObjectClass oc = ( ObjectClass ) parentElement;
ObjectClassWrapper ocw = new ObjectClassWrapper( oc, null );
children = new ArrayList<ITreeNode>();
children.add( ocw );
}
else if ( parentElement instanceof AttributeType )
{
AttributeType at = ( AttributeType ) parentElement;
AttributeTypeWrapper atw = new AttributeTypeWrapper( at, null );
children = new ArrayList<ITreeNode>();
children.add( atw );
}
else if ( parentElement instanceof ObjectClassWrapper )
{
ObjectClassWrapper ocw = ( ObjectClassWrapper ) parentElement;
ObjectClass oc = ocw.getMyObjectClass();
if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUPERTYPE )
{
String[] superiors = oc.getSuperiors();
for ( String superior : superiors )
{
if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
{
ObjectClass supOC = schemaPool.getObjectClass( superior );
if ( supOC != null )
{
ObjectClassWrapper supOCW = new ObjectClassWrapper( supOC, ocw );
ocw.addChild( supOCW );
}
}
}
}
else if ( mode == PluginConstants.PREFS_HIERARCHY_VIEW_MODE_SUBTYPE )
{
for ( ObjectClass objectClass : objectClasses )
{
String[] superiors = objectClass.getSuperiors();
for ( String superior : superiors )
{
if ( superior != null || "".equals( superior ) ) //$NON-NLS-1$
{
ObjectClass supOC = schemaPool.getObjectClass( superior );
if ( supOC != null && oc.equals( supOC ) )
{
ObjectClassWrapper supOCW = new ObjectClassWrapper( objectClass, ocw );
ocw.addChild( supOCW );
}