label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
}
}
else if ( element instanceof ObjectClassDifference )
{
ObjectClassDifference ocd = ( ObjectClassDifference ) element;
ObjectClassImpl oc = null;
switch ( ocd.getType() )
{
case ADDED:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
case MODIFIED:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
case REMOVED:
oc = ( ( ObjectClassImpl ) ocd.getSource() );
break;
case IDENTICAL:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
}
// Label
if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
{
String[] names = oc.getNamesRef();
if ( ( names != null ) && ( names.length > 0 ) )
{
label = names[0];
}
else
{
label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
}
}
else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
{
String[] names = oc.getNamesRef();
if ( ( names != null ) && ( names.length > 0 ) )
{
label = ViewUtils.concateAliases( names );
}
else
{
label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
}
}
else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
{
label = oc.getOid();
}
else
// Default
{
String[] names = oc.getNamesRef();
if ( ( names != null ) && ( names.length > 0 ) )
{
label = names[0];
}
else
{
label = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
}
}
// Abbreviate
if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
{
label = label.substring( 0, abbreviateMaxLength ) + "..."; //$NON-NLS-1$
}
}
else if ( element instanceof Folder )
{
Folder folder = ( Folder ) element;
return folder.getName() + " (" + folder.getChildren().size() + ")"; //$NON-NLS-1$ //$NON-NLS-2$
}
// Secondary Label
if ( secondaryLabelDisplay )
{
String secondaryLabel = ""; //$NON-NLS-1$
if ( element instanceof AttributeTypeDifference )
{
AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
AttributeTypeImpl at = null;
switch ( atd.getType() )
{
case ADDED:
at = ( ( AttributeTypeImpl ) atd.getDestination() );
break;
case MODIFIED:
at = ( ( AttributeTypeImpl ) atd.getDestination() );
break;
case REMOVED:
at = ( ( AttributeTypeImpl ) atd.getSource() );
break;
case IDENTICAL:
at = ( ( AttributeTypeImpl ) atd.getDestination() );
break;
}
if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
{
String[] names = at.getNamesRef();
if ( ( names != null ) && ( names.length > 0 ) )
{
secondaryLabel = names[0];
}
else
{
secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
}
}
else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
{
String[] names = at.getNamesRef();
if ( ( names != null ) && ( names.length > 0 ) )
{
secondaryLabel = ViewUtils.concateAliases( names );
}
else
{
secondaryLabel = Messages.getString( "DifferencesWidgetSchemaLabelProvider.None" ); //$NON-NLS-1$
}
}
else if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
{
secondaryLabel = at.getOid();
}
}
else if ( element instanceof ObjectClassDifference )
{
ObjectClassDifference ocd = ( ObjectClassDifference ) element;
ObjectClassImpl oc = null;
switch ( ocd.getType() )
{
case ADDED:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
case MODIFIED:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
case REMOVED:
oc = ( ( ObjectClassImpl ) ocd.getSource() );
break;
case IDENTICAL:
oc = ( ( ObjectClassImpl ) ocd.getDestination() );
break;
}
if ( secondaryLabelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
{