Examples of LdifAttrValLine


Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.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.ldapbrowser.core.model.ldif.lines.LdifAttrValLine

            value1 = ( IValue ) o1;
            attribute1 = value1.getAttribute();
        }
        else if ( o1 instanceof LdifAttrValLine )
        {
            LdifAttrValLine line1 = ( LdifAttrValLine ) o1;
            value1 = ModelConverter.ldifAttrValLineToValue( line1, dummyEntry );
            attribute1 = value1.getAttribute();
        }

        IAttribute attribute2 = null;
        IValue value2 = null;
        if ( o2 instanceof IAttribute )
        {
            attribute2 = ( IAttribute ) o2;
        }
        else if ( o2 instanceof IValue )
        {
            value2 = ( IValue ) o2;
            attribute2 = value2.getAttribute();
        }
        else if ( o2 instanceof LdifAttrValLine )
        {
            LdifAttrValLine line2 = ( LdifAttrValLine ) o2;
            value2 = ModelConverter.ldifAttrValLineToValue( line2, dummyEntry );
            attribute2 = value2.getAttribute();
        }

        if ( value1 != null && value2 != null )
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine

                checkAndParseComment( record );

                // read attr-val lines
                do
                {
                    LdifAttrValLine line = this.getAttrValLine();
                    if ( line != null )
                    {
                        modSpec.addAttrVal( line );

                        // clean line
                        if ( "".equals( line.getRawNewLine() ) )
                        {
                            this.cleanupLine( record );
                        }
                    }
                    else
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine

            {
                return;
            }

            // check attr-val line
            LdifAttrValLine line = this.getAttrValLine();
            if ( line != null )
            {
                if ( record instanceof LdifContentRecord )
                {
                    ( ( LdifContentRecord ) record ).addAttrVal( line );
                }
                else if ( record instanceof LdifChangeAddRecord )
                {
                    ( ( LdifChangeAddRecord ) record ).addAttrVal( line );
                }

                // clean line
                if ( "".equals( line.getRawNewLine() ) )
                {
                    this.cleanupLine( record );
                }
            }
            else
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.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.ldapbrowser.core.model.ldif.lines.LdifAttrValLine

            }

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

            else
            {
                return "";
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.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 DN(), dummyConnection );
                }

                AttributeWizard wizard = new AttributeWizard( "Edit Attribute Description", true, false,
                    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();
                            for ( int j = 0; j < newAttrValLines.length; j++ )
                            {
                                text += newAttrValLines[j].toFormattedString();
                            }
                            text += newSepLine.toFormattedString();
                            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() );
                            }
                            catch ( BadLocationException e )
                            {
                                e.printStackTrace();
                            }
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.lines.LdifAttrValLine

                String rawAttributeDescription = prefix;
                String rawValueType = "";

                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

                checkAndParseComment( record );

                // read attr-val lines
                do
                {
                    LdifAttrValLine line = this.getAttrValLine();
                    if ( line != null )
                    {
                        modSpec.addAttrVal( line );

                        // clean line
                        if ( "".equals( line.getRawNewLine() ) )
                        {
                            this.cleanupLine( record );
                        }
                    }
                    else
View Full Code Here

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

            {
                return;
            }

            // check attr-val line
            LdifAttrValLine line = this.getAttrValLine();
            if ( line != null )
            {
                if ( record instanceof LdifContentRecord )
                {
                    ( ( LdifContentRecord ) record ).addAttrVal( line );
                }
                else if ( record instanceof LdifChangeAddRecord )
                {
                    ( ( LdifChangeAddRecord ) record ).addAttrVal( line );
                }

                // clean line
                if ( "".equals( line.getRawNewLine() ) )
                {
                    this.cleanupLine( record );
                }
            }
            else
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.