{
// select the value
LdifAttrValLine line = ( LdifAttrValLine ) element;
for ( int a = 0; a < attributes.length; a++ )
{
IAttribute attribute = attributes[a];
if ( attribute.getDescription().equals( line.getUnfoldedAttributeDescription() ) )
{
IValue[] values = attribute.getValues();
for ( int v = 0; v < values.length; v++ )
{
IValue value = values[v];
if ( value.getStringValue().equals( line.getValueAsString() ) )
{
selectionList.add( value );
}
}
}
}
}
else if ( element instanceof List )
{
// select attribute and all values
List list = ( List ) element;
if ( !list.isEmpty() && list.get( 0 ) instanceof LdifAttrValLine )
{
LdifAttrValLine line = ( LdifAttrValLine ) list.get( 0 );
for ( int a = 0; a < attributes.length; a++ )
{
IAttribute attribute = attributes[a];
if ( attribute.getDescription().equals(
line.getUnfoldedAttributeDescription() ) )
{
selectionList.add( attribute );
selectionList.addAll( Arrays.asList( attribute.getValues() ) );
}
}
}
}
else if ( element instanceof LdifRecord )
{
for ( int a = 0; a < attributes.length; a++ )
{
IAttribute attribute = attributes[a];
selectionList.add( attribute );
selectionList.addAll( Arrays.asList( attribute.getValues() ) );
}
}
}
IStructuredSelection selection = new StructuredSelection( selectionList );