Set<ObjectClass> selectedObjectClasses = new HashSet<ObjectClass>();
for ( IValue value : values )
{
String type = value.getAttribute().getType();
AttributeType atd = value.getAttribute().getAttributeTypeDescription();
AttributeHierarchy ah = value.getAttribute().getEntry().getAttributeWithSubtypes( type );
// check if (part of) Rdn is selected
if ( value.isRdnPart() )
{
message.append( NLS.bind( Messages.getString( "DeleteAction.DeletePartOfRDN" ), value.toString() ) ); //$NON-NLS-1$
message.append( BrowserCoreConstants.LINE_SEPARATOR );
message.append( BrowserCoreConstants.LINE_SEPARATOR );
}
// check if a required objectClass is selected
if ( value.getAttribute().isObjectClassAttribute() )
{
selectedObjectClasses.add( value.getAttribute().getEntry().getBrowserConnection().getSchema()
.getObjectClassDescription( value.getStringValue() ) );
}
// check if ALL values of objectClass or a MUST attribute are selected
if ( !attributeNameToSelectedValuesCountMap.containsKey( atd ) )
{
attributeNameToSelectedValuesCountMap.put( atd, new Integer( 0 ) );
}
int count = ( attributeNameToSelectedValuesCountMap.get( atd ) ).intValue() + 1;
attributeNameToSelectedValuesCountMap.put( atd, new Integer( count ) );
if ( value.getAttribute().isObjectClassAttribute() && count >= ah.getValueSize() )
{
message.append( Messages.getString( "DeleteAction.DeleteObjectClass" ) ); //$NON-NLS-1$
message.append( BrowserCoreConstants.LINE_SEPARATOR );
message.append( BrowserCoreConstants.LINE_SEPARATOR );
continue;
}
else if ( value.getAttribute().isMustAttribute() && count >= ah.getValueSize() )
{
message.append( NLS.bind( Messages.getString( "DeleteAction.DeleteMust" ), type ) ); //$NON-NLS-1$
message.append( BrowserCoreConstants.LINE_SEPARATOR );
message.append( BrowserCoreConstants.LINE_SEPARATOR );
}