ObjectClassImpl oc = ( ( ObjectClassWrapper ) selectedItem ).getObjectClass();
schemaObjectsList.add( oc );
}
}
SchemaHandler schemaHandler = Activator.getDefault().getSchemaHandler();
// Removing schema objects
for ( SchemaObject schemaObject : schemaObjectsList )
{
if ( !schemasMap.containsKey( schemaObject.getSchema().toLowerCase() ) )
{
// If the schema object is not part of deleted schema, we need to delete it.
// But, we don't delete schema objects that are part of a deleted schema, since
// deleting the schema will also delete this schema object.
if ( schemaObject instanceof AttributeTypeImpl )
{
schemaHandler.removeAttributeType( ( AttributeTypeImpl ) schemaObject );
}
else if ( schemaObject instanceof ObjectClassImpl )
{
schemaHandler.removeObjectClass( ( ObjectClassImpl ) schemaObject );
}
}
}
// Removing schemas
for ( Schema schema : schemasMap.values() )
{
schemaHandler.removeSchema( schema );
}
}
}
}