Examples of LdifAttrValLine


Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

                {
                    sepToken = this.scanner.matchSep();
                }
            }

            LdifAttrValLine line = new LdifAttrValLine( attrToken.getOffset(), getValueOrNull( attrToken ),
                getValueOrNull( valueTypeToken ), getValueOrNull( valueToken ), getValueOrNull( sepToken ) );

            return line;
        }
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

            Map<String, LdifAttrValLine> oldAttrValLines = new LinkedHashMap<String, LdifAttrValLine>();
            if ( oldAttribute != null )
            {
                for ( IValue value : oldAttribute.getValues() )
                {
                    LdifAttrValLine attrValLine = computeDiffCreateAttrValLine( value );
                    oldValues.add( attrValLine.getUnfoldedValue() );
                    oldAttrValLines.put( attrValLine.getUnfoldedValue(), attrValLine );
                }
            }
            IAttribute newAttribute = newEntry.getAttribute( attributeDescription );
            Set<String> newValues = new HashSet<String>();
            Map<String, LdifAttrValLine> newAttrValLines = new LinkedHashMap<String, LdifAttrValLine>();
            if ( newAttribute != null )
            {
                for ( IValue value : newAttribute.getValues() )
                {
                    LdifAttrValLine attrValLine = computeDiffCreateAttrValLine( value );
                    newValues.add( attrValLine.getUnfoldedValue() );
                    newAttrValLines.put( attrValLine.getUnfoldedValue(), attrValLine );
                }
            }

            // check what to do
            if ( oldAttribute != null && newAttribute == null )
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

                String rawAttributeDescription = prefix;
                String rawValueType = ""; //$NON-NLS-1$

                if ( part instanceof LdifAttrValLine )
                {
                    LdifAttrValLine line = ( LdifAttrValLine ) part;
                    rawAttributeDescription = line.getRawAttributeDescription();
                    rawValueType = line.getRawValueType();
                }

                if ( offset <= part.getOffset() + rawAttributeDescription.length() )
                {
                    Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

                    attributeDescription = oldLine.getUnfoldedAttributeDescription();
                    oldValue = null;
                }
                else
                {
                    LdifAttrValLine oldLine = ( LdifAttrValLine ) line;
                    attributeDescription = oldLine.getUnfoldedAttributeDescription();
                    oldValue = oldLine.getValueAsString();
                }

                Schema schema = editor.getConnection() != null ? editor.getConnection().getSchema()
                    : Schema.DEFAULT_SCHEMA;
                IBrowserConnection dummyConnection = new DummyConnection( schema );

                IEntry dummyEntry = null;
                if ( containers[0] instanceof LdifContentRecord )
                {
                    dummyEntry = ModelConverter.ldifContentRecordToEntry( ( LdifContentRecord ) containers[0],
                        dummyConnection );
                }
                else if ( containers[0] instanceof LdifChangeAddRecord )
                {
                    dummyEntry = ModelConverter.ldifChangeAddRecordToEntry( ( LdifChangeAddRecord ) containers[0],
                        dummyConnection );
                }
                else if ( containers[0] instanceof LdifChangeModifyRecord )
                {
                    dummyEntry = new DummyEntry( new LdapDN(), dummyConnection );
                }

                AttributeWizard wizard = new AttributeWizard( Messages
                    .getString( "EditLdifAttributeAction.EditAttributeDescription" ), true, false, //$NON-NLS-1$
                    attributeDescription, dummyEntry );
                WizardDialog dialog = new WizardDialog( Display.getDefault().getActiveShell(), wizard );
                dialog.setBlockOnOpen( true );
                dialog.create();
                if ( dialog.open() == Dialog.OK )
                {
                    String newAttributeDescription = wizard.getAttributeDescription();

                    if ( newAttributeDescription != null )
                    {
                        IDocument document = editor.getDocumentProvider().getDocument( editor.getEditorInput() );

                        if ( modSpec != null )
                        {
                            LdifModSpecTypeLine oldTypeLine = modSpec.getModSpecType();
                            LdifModSpecTypeLine newTypeLine = null;
                            if ( oldTypeLine.isAdd() )
                            {
                                newTypeLine = LdifModSpecTypeLine.createAdd( newAttributeDescription );
                            }
                            else if ( oldTypeLine.isDelete() )
                            {
                                newTypeLine = LdifModSpecTypeLine.createDelete( newAttributeDescription );
                            }
                            else if ( oldTypeLine.isReplace() )
                            {
                                newTypeLine = LdifModSpecTypeLine.createReplace( newAttributeDescription );
                            }

                            LdifAttrValLine[] oldAttrValLines = modSpec.getAttrVals();
                            LdifAttrValLine[] newAttrValLines = new LdifAttrValLine[oldAttrValLines.length];
                            for ( int i = 0; i < oldAttrValLines.length; i++ )
                            {
                                LdifAttrValLine oldAttrValLine = oldAttrValLines[i];
                                newAttrValLines[i] = LdifAttrValLine.create( newAttributeDescription, oldAttrValLine
                                    .getValueAsString() );

                            }

                            LdifModSpecSepLine newSepLine = LdifModSpecSepLine.create();

                            String text = newTypeLine.toFormattedString( Utils.getLdifFormatParameters() );
                            for ( int j = 0; j < newAttrValLines.length; j++ )
                            {
                                text += newAttrValLines[j].toFormattedString( Utils.getLdifFormatParameters() );
                            }
                            text += newSepLine.toFormattedString( Utils.getLdifFormatParameters() );
                            try
                            {
                                document.replace( modSpec.getOffset(), modSpec.getLength(), text );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
                            }

                        }
                        else
                        { // LdifContentRecord ||
                            // LdifChangeAddRecord
                            LdifAttrValLine newLine = LdifAttrValLine.create( newAttributeDescription, oldValue );
                            try
                            {
                                document.replace( line.getOffset(), line.getLength(), newLine.toFormattedString( Utils
                                    .getLdifFormatParameters() ) );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

                    else if ( element instanceof List )
                    {
                        List list = ( List ) element;
                        if ( !list.isEmpty() && list.get( 0 ) instanceof LdifAttrValLine )
                        {
                            LdifAttrValLine line = ( LdifAttrValLine ) list.get( 0 );
                            ldifEditor.selectAndReveal( line.getOffset(), line.getRawAttributeDescription().length() );
                        }
                    }
                    else if ( element instanceof LdifAttrValLine )
                    {
                        LdifAttrValLine line = ( LdifAttrValLine ) element;
                        ldifEditor.selectAndReveal( line.getOffset() + line.getRawAttributeDescription().length()
                            + line.getRawValueType().length(), line.getRawValue().length() );
                    }
                    else if ( element instanceof LdifModSpec )
                    {
                        LdifModSpec modSpec = ( LdifModSpec ) element;
                        ldifEditor.selectAndReveal( modSpec.getOffset(), modSpec.getModSpecType().getLength() );
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

                        this.addStyleRange( presentation, offset + dnSpecLength + valueTypeLength, dnLength,
                            DN_TEXT_ATTRIBUTE );
                    }
                    else if ( line instanceof LdifAttrValLine )
                    {
                        LdifAttrValLine attrValLine = ( LdifAttrValLine ) line;
                        int attributeNameLength = attrValLine.getRawAttributeDescription().length();
                        int valueTypeLength = attrValLine.getRawValueType().length();
                        int valueLength = attrValLine.getRawValue().length();
                        this.addStyleRange( presentation, offset, attributeNameLength, ATTRIBUTE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength, valueTypeLength,
                            VALUETYPE_TEXT_ATTRIBUTE );
                        this.addStyleRange( presentation, offset + attributeNameLength + valueTypeLength, valueLength,
                            VALUE_TEXT_ATTRIBUTE );
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

            }

            // AttrValLine
            else if ( element instanceof LdifAttrValLine )
            {
                LdifAttrValLine line = ( LdifAttrValLine ) element;
                return Utils.getShortenedString( line.getValueAsString(), 20 );
            }

            else
            {
                return ""; //$NON-NLS-1$
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

            Map<String, LdifAttrValLine> oldAttrValLines = new LinkedHashMap<String, LdifAttrValLine>();
            if ( oldAttribute != null )
            {
                for ( IValue value : oldAttribute.getValues() )
                {
                    LdifAttrValLine attrValLine = computeDiffCreateAttrValLine( value );
                    oldValues.add( attrValLine.getUnfoldedValue() );
                    oldAttrValLines.put( attrValLine.getUnfoldedValue(), attrValLine );
                }
            }
            IAttribute newAttribute = newEntry.getAttribute( attributeDescription );
            Set<String> newValues = new HashSet<String>();
            Map<String, LdifAttrValLine> newAttrValLines = new LinkedHashMap<String, LdifAttrValLine>();
            if ( newAttribute != null )
            {
                for ( IValue value : newAttribute.getValues() )
                {
                    LdifAttrValLine attrValLine = computeDiffCreateAttrValLine( value );
                    newValues.add( attrValLine.getUnfoldedValue() );
                    newAttrValLines.put( attrValLine.getUnfoldedValue(), attrValLine );
                }
            }

            // check what to do
            if ( oldAttribute != null && newAttribute == null )
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

        mrudParser.setQuirksMode( true );

        LdifAttrValLine[] lines = schemaRecord.getAttrVals();
        for ( int i = 0; i < lines.length; i++ )
        {
            LdifAttrValLine line = lines[i];
            String attributeName = line.getUnfoldedAttributeDescription();
            String value = line.getValueAsString();
            List<String> ldifValues = new ArrayList<String>( 1 );
            ldifValues.add( value );

            try
            {
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.lines.LdifAttrValLine

        for ( int i = 0; i < parts.length; i++ )
        {
            if ( parts[i] instanceof LdifAttrValLine )
            {
                LdifAttrValLine line = ( LdifAttrValLine ) parts[i];
                String attributeName = line.getUnfoldedAttributeDescription();
                Object value = line.getValueAsObject();
                IAttribute attribute = entry.getAttribute( attributeName );
                if ( attribute == null )
                {
                    attribute = new Attribute( entry, attributeName );
                    entry.addAttribute( attribute );
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.