Package org.apache.directory.ldapstudio.browser.core.model

Examples of org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy


    {

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            if ( !this.canModify( element, property ) )
            {
                return null;
            }

            if ( ah == null )
            {
                try
                {
                    ah = new AttributeHierarchy( result.getEntry(), property, new IAttribute[]
                        { new Attribute( result.getEntry(), property ) } );
                }
                catch ( ModelModificationException e )
                {
                    e.printStackTrace();
View Full Code Here


        }

        if ( element != null && element instanceof ISearchResult && property != null )
        {
            ISearchResult result = ( ISearchResult ) element;
            AttributeHierarchy ah = result.getAttributeWithSubtypes( property );

            try
            {
                // switch operation:
                if ( ah == null && newRawValue != null )
                {
                    this.valueEditorManager.getCurrentValueEditor( result.getEntry(), property ).createValue(
                        result.getEntry(), property, newRawValue );
                }
                else if ( ah != null && newRawValue == null )
                {
                    this.valueEditorManager.getCurrentValueEditor( ah ).deleteAttribute( ah );
                }
                else if ( ah != null && ah.size() == 1 && ah.getAttribute().getValueSize() == 1 && newRawValue != null )
                {
                    this.valueEditorManager.getCurrentValueEditor( ah ).modifyValue( ah.getAttribute().getValues()[0],
                        newRawValue );
                }
            }
            catch ( ModelModificationException mme )
            {
View Full Code Here

        {
            return compare( entry1.getDn().toString(), entry2.getDn().toString() );
        }
        else
        {
            AttributeHierarchy ah1 = entry1.getAttributeWithSubtypes( attributeName );
            AttributeHierarchy ah2 = entry2.getAttributeWithSubtypes( attributeName );
            if ( ah1 == null && ah2 == null )
            {
                return this.equal();
            }
            else if ( ah1 == null && ah2 != null )
            {
                return this.lessThan();
            }
            else if ( ah1 != null && ah2 == null )
            {
                return this.greaterThan();
            }
            else
            {
                IAttribute attribute1 = ah1.getAttribute();
                IAttribute attribute2 = ah2.getAttribute();

                String value1 = getValue( attribute1 );
                String value2 = getValue( attribute2 );
                return compare( value1, value2 );
            }
View Full Code Here

                {
                    return result.getDn().toString();
                }
                else
                {
                    AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
                    return getDisplayValue( ah );
                }

            }
            catch ( ArrayIndexOutOfBoundsException aioobe )
View Full Code Here

            {
                return null;
            }
            else if ( property != null )
            {
                AttributeHierarchy ah = result.getAttributeWithSubtypes( property );
                if ( ah != null )
                {
                    for ( int i = 0; i < ah.getAttributes().length; i++ )
                    {
                        IAttribute attribute = ah.getAttributes()[i];
                        if ( attribute.isObjectClassAttribute() )
                        {
                            FontData[] fontData = PreferenceConverter.getFontDataArray( BrowserUIPlugin.getDefault()
                                .getPreferenceStore(), BrowserUIConstants.PREFERENCE_OBJECTCLASS_FONT );
                            return BrowserUIPlugin.getDefault().getFont( fontData );
View Full Code Here

            Object o = this.getRow().getData();
            String property = ( String ) this.viewer.getColumnProperties()[this.getColumn()];
            if ( o instanceof ISearchResult && !BrowserUIConstants.DN.equals( property ) )
            {
                ISearchResult sr = ( ISearchResult ) o;
                AttributeHierarchy ah = sr.getAttributeWithSubtypes( property );

                if ( ah == null )
                {
                    try
                    {
                        ah = new AttributeHierarchy( sr.getEntry(), property, new IAttribute[]
                            { new Attribute( sr.getEntry(), property ) } );
                    }
                    catch ( ModelModificationException e )
                    {
                        e.printStackTrace();
View Full Code Here


    public ISelection getSelection()
    {
        ISearchResult searchResult = this.getSelectedSearchResult();
        AttributeHierarchy ah = this.getSelectedAttributeHierarchie();
        String property = this.getSelectedProperty();
        // String attributeName = this.getSelectedAttributeName();

        // System.out.println(attributes.length);
View Full Code Here

                for ( int i = 0; i < objects.length; i++ )
                {
                    Object object = objects[i];
                    if ( object instanceof AttributeHierarchy )
                    {
                        AttributeHierarchy ah = ( AttributeHierarchy ) object;
                        for ( Iterator it = ah.iterator(); it.hasNext(); )
                        {
                            IAttribute attribute = ( IAttribute ) it.next();
                            entry = attribute.getEntry();
                            IValue[] values = attribute.getValues();
                            for ( int v = 0; v < values.length; v++ )
View Full Code Here

        for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
        {
            // check if a non-modifyable, must or objectClass attribute is
            // selected
            AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( !SchemaUtils.isModifyable( attribute.getAttributeTypeDescription() )
                    || attribute.isMustAttribute() || attribute.isObjectClassAttribute() )
                {
                    throw new Exception();
                }
            }
        }

        List attributeList = new ArrayList();

        // add selected attributes
        for ( int i = 0; i < getSelectedAttributes().length; i++ )
        {
            IAttribute attribute = getSelectedAttributes()[i];
            if ( attribute != null && attribute.getValueSize() > 0 )
            {
                attributeList.add( attribute );
            }
        }

        // add selected hierarchies
        for ( int i = 0; i < getSelectedAttributeHierarchies().length; i++ )
        {
            // check if a operational, must or objectClass attribute is
            // selected
            AttributeHierarchy ah = getSelectedAttributeHierarchies()[i];
            for ( Iterator it = ah.iterator(); it.hasNext(); )
            {
                IAttribute attribute = ( IAttribute ) it.next();
                if ( attribute != null && attribute.getValueSize() > 0 )
                {
                    attributeList.add( attribute );
View Full Code Here

        if ( event instanceof EmptyValueAddedEvent && !editor.getActionGroup().isEditorActive() )
        {
            EmptyValueAddedEvent evae = ( EmptyValueAddedEvent ) event;
            IAttribute att = evae.getAddedValue().getAttribute();
            AttributeHierarchy ah = cursor.getSelectedAttributeHierarchie();
            if ( ah != null && ah.contains( att ) )
            {
                viewer.setSelection( null, true );
                viewer.getTable().setSelection( new TableItem[0] );
                if ( startEditAction.isEnabled() )
                {
View Full Code Here

TOP

Related Classes of org.apache.directory.ldapstudio.browser.core.model.AttributeHierarchy

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.