Package org.apache.directory.studio.schemaeditor.model.difference

Examples of org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference


        String oid1 = ""; //$NON-NLS-1$
        String oid2 = ""; //$NON-NLS-1$

        if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof AttributeTypeDifference ) )
        {
            AttributeTypeDifference atd1 = ( AttributeTypeDifference ) o1;
            AttributeTypeDifference atd2 = ( AttributeTypeDifference ) o2;

            switch ( atd1.getType() )
            {
                case ADDED:
                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid1 = ( ( SchemaObject ) atd1.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid1 = ( ( SchemaObject ) atd1.getDestination() ).getOid();
                    break;
            }

            switch ( atd2.getType() )
            {
                case ADDED:
                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid2 = ( ( SchemaObject ) atd2.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid2 = ( ( SchemaObject ) atd2.getDestination() ).getOid();
                    break;
            }
        }
        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof ObjectClassDifference ) )
        {
            ObjectClassDifference ocd1 = ( ObjectClassDifference ) o1;
            ObjectClassDifference ocd2 = ( ObjectClassDifference ) o2;

            switch ( ocd1.getType() )
            {
                case ADDED:
                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid1 = ( ( SchemaObject ) ocd1.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid1 = ( ( SchemaObject ) ocd1.getDestination() ).getOid();
                    break;
            }

            switch ( ocd2.getType() )
            {
                case ADDED:
                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid2 = ( ( SchemaObject ) ocd2.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid2 = ( ( SchemaObject ) ocd2.getDestination() ).getOid();
                    break;
            }
        }
        else if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof ObjectClassDifference ) )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) o1;
            ObjectClassDifference ocd = ( ObjectClassDifference ) o2;

            switch ( atd.getType() )
            {
                case ADDED:
                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid1 = ( ( SchemaObject ) atd.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid1 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
            }

            switch ( ocd.getType() )
            {
                case ADDED:
                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid2 = ( ( SchemaObject ) ocd.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid2 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
            }
        }
        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof AttributeTypeDifference ) )
        {
            ObjectClassDifference ocd = ( ObjectClassDifference ) o1;
            AttributeTypeDifference atd = ( AttributeTypeDifference ) o2;

            switch ( ocd.getType() )
            {
                case ADDED:
                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid1 = ( ( SchemaObject ) ocd.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid1 = ( ( SchemaObject ) ocd.getDestination() ).getOid();
                    break;
            }

            switch ( atd.getType() )
            {
                case ADDED:
                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
                case MODIFIED:
                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
                case REMOVED:
                    oid2 = ( ( SchemaObject ) atd.getSource() ).getOid();
                    break;
                case IDENTICAL:
                    oid2 = ( ( SchemaObject ) atd.getDestination() ).getOid();
                    break;
            }
        }

        return oid1.compareToIgnoreCase( oid2 );
View Full Code Here


            {
                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
                Object element = selection.getFirstElement();
                if ( element instanceof AttributeTypeDifference )
                {
                    AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
                    if ( atd.getType().equals( DifferenceType.MODIFIED ) )
                    {
                        tableViewer.setInput( atd.getDifferences() );
                        return;
                    }
                }
                else if ( element instanceof ObjectClassDifference )
                {
View Full Code Here

        String[] o1Names = null;
        String[] o2Names = null;

        if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof AttributeTypeDifference ) )
        {
            AttributeTypeDifference atd1 = ( AttributeTypeDifference ) o1;
            AttributeTypeDifference atd2 = ( AttributeTypeDifference ) o2;

            switch ( atd1.getType() )
            {
                case ADDED:
                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o1Names = ( ( SchemaObject ) atd1.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o1Names = ( ( SchemaObject ) atd1.getDestination() ).getNamesRef();
                    break;
            }

            switch ( atd2.getType() )
            {
                case ADDED:
                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o2Names = ( ( SchemaObject ) atd2.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o2Names = ( ( SchemaObject ) atd2.getDestination() ).getNamesRef();
                    break;
            }
        }
        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof ObjectClassDifference ) )
        {
            ObjectClassDifference ocd1 = ( ObjectClassDifference ) o1;
            ObjectClassDifference ocd2 = ( ObjectClassDifference ) o2;

            switch ( ocd1.getType() )
            {
                case ADDED:
                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o1Names = ( ( SchemaObject ) ocd1.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o1Names = ( ( SchemaObject ) ocd1.getDestination() ).getNamesRef();
                    break;
            }

            switch ( ocd2.getType() )
            {
                case ADDED:
                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o2Names = ( ( SchemaObject ) ocd2.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o2Names = ( ( SchemaObject ) ocd2.getDestination() ).getNamesRef();
                    break;
            }
        }
        else if ( ( o1 instanceof AttributeTypeDifference ) && ( o2 instanceof ObjectClassDifference ) )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) o1;
            ObjectClassDifference ocd = ( ObjectClassDifference ) o2;

            switch ( atd.getType() )
            {
                case ADDED:
                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o1Names = ( ( SchemaObject ) atd.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o1Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
            }

            switch ( ocd.getType() )
            {
                case ADDED:
                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o2Names = ( ( SchemaObject ) ocd.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o2Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
            }
        }
        else if ( ( o1 instanceof ObjectClassDifference ) && ( o2 instanceof AttributeTypeDifference ) )
        {
            ObjectClassDifference ocd = ( ObjectClassDifference ) o1;
            AttributeTypeDifference atd = ( AttributeTypeDifference ) o2;

            switch ( ocd.getType() )
            {
                case ADDED:
                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o1Names = ( ( SchemaObject ) ocd.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o1Names = ( ( SchemaObject ) ocd.getDestination() ).getNamesRef();
                    break;
            }

            switch ( atd.getType() )
            {
                case ADDED:
                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
                case MODIFIED:
                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
                case REMOVED:
                    o2Names = ( ( SchemaObject ) atd.getSource() ).getNamesRef();
                    break;
                case IDENTICAL:
                    o2Names = ( ( SchemaObject ) atd.getDestination() ).getNamesRef();
                    break;
            }
        }

        // Comparing the First Name
View Full Code Here

                    return ( ( Schema ) sd.getDestination() ).getName();
            }
        }
        else 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;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = at.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 = at.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 = at.getOid();
            }
            else
            // Default
            {
                String[] names = at.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 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 )
                {
View Full Code Here

                    return Activator.getDefault().getImage( PluginConstants.IMG_SCHEMA );
            }
        }
        else if ( element instanceof AttributeTypeDifference )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
            switch ( atd.getType() )
            {
                case ADDED:
                    return Activator.getDefault().getImage( PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_ADD );
                case MODIFIED:
                    return Activator.getDefault().getImage( PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_MODIFY );
View Full Code Here

                    return ( ( Schema ) sd.getDestination() ).getName();
            }
        }
        else 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;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = at.getOid();
            }
            else
            // Default
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                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.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // 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() + ")";
        }

        // 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 )
                {
View Full Code Here

                    return Activator.getDefault().getImage( PluginConstants.IMG_SCHEMA );
            }
        }
        else if ( element instanceof AttributeTypeDifference )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
            switch ( atd.getType() )
            {
                case ADDED:
                    return Activator.getDefault().getImage( PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_ADD );
                case MODIFIED:
                    return Activator.getDefault().getImage( PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_MODIFY );
View Full Code Here

                    return ( ( Schema ) sd.getDestination() ).getName();
            }
        }
        else 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;
            }

            // Label
            if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_FIRST_NAME )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = at.getOid();
            }
            else
            // Default
            {
                String[] names = at.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // Abbreviate
            if ( abbreviate && ( abbreviateMaxLength < label.length() ) )
            {
                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.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_ALL_ALIASES )
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = ViewUtils.concateAliases( names );
                }
                else
                {
                    label = NONE;
                }
            }
            else if ( labelValue == PluginConstants.PREFS_SCHEMA_VIEW_LABEL_OID )
            {
                label = oc.getOid();
            }
            else
            // Default
            {
                String[] names = oc.getNames();
                if ( ( names != null ) && ( names.length > 0 ) )
                {
                    label = names[0];
                }
                else
                {
                    label = NONE;
                }
            }

            // 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() + ")";
        }

        // 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 )
                {
View Full Code Here

                        .createImage();
            }
        }
        else if ( element instanceof AttributeTypeDifference )
        {
            AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
            switch ( atd.getType() )
            {
                case ADDED:
                    return AbstractUIPlugin.imageDescriptorFromPlugin( Activator.PLUGIN_ID,
                        PluginConstants.IMG_DIFFERENCE_ATTRIBUTE_TYPE_ADD ).createImage();
                case MODIFIED:
View Full Code Here

            {
                StructuredSelection selection = ( StructuredSelection ) event.getSelection();
                Object element = selection.getFirstElement();
                if ( element instanceof AttributeTypeDifference )
                {
                    AttributeTypeDifference atd = ( AttributeTypeDifference ) element;
                    if ( atd.getType().equals( DifferenceType.MODIFIED ) )
                    {
                        tableViewer.setInput( atd.getDifferences() );
                        return;
                    }
                }
                else if ( element instanceof ObjectClassDifference )
                {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.schemaeditor.model.difference.AttributeTypeDifference

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.