Examples of LdifContainer


Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

            List positionList = new ArrayList();

            LdifContainer[] containers = model.getContainers();
            for ( int i = 0; i < containers.length; i++ )
            {
                LdifContainer container = containers[i];

                // LdifPart errorPart = null;
                int errorOffset = -1;
                int errorLength = -1;
                StringBuffer errorText = null;

                LdifPart[] parts = container.getParts();
                for ( int k = 0; k < parts.length; k++ )
                {
                    LdifPart part = parts[k];
                    if ( !part.isValid() )
                    {
                        if ( errorOffset == -1 )
                        {
                            // errorPart = part;
                            errorOffset = part.getOffset();
                            errorLength = part.getLength();
                            errorText = new StringBuffer();
                            errorText.append( part.toRawString() );
                        }
                        else
                        {
                            errorLength += part.getLength();
                            errorText.append( part.toRawString() );
                        }
                    }
                }

                if ( errorOffset == -1 && !container.isValid() )
                {
                    errorOffset = container.getOffset();
                    errorLength = container.getLength();
                    errorText = new StringBuffer();
                    errorText.append( container.toRawString() );
                }

                if ( errorOffset > -1 )
                {
                    // Annotation annotation = new Annotation("DEFAULT",
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        if ( ENABLE_FOLDING )
        {
            for ( int i = 0; i < containers.length; i++ )
            {
                LdifContainer container = containers[i];
                int containerStartLine = document.getLineOfOffset( container.getOffset() );
                int containerEndLine = -1;
                LdifPart[] parts = container.getParts();
                for ( int j = parts.length - 1; j >= 0; j-- )
                {
                    if ( containerEndLine == -1
                        && ( !( parts[j] instanceof LdifSepLine ) || ( container instanceof LdifCommentContainer && j < parts.length - 1 ) ) )
                    {
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        LdifContainer[] containers = getSelectedLdifContainers();
        if ( containers.length == 1
            && ( containers[0] instanceof LdifContentRecord || containers[0] instanceof LdifChangeAddRecord ) )
        {

            LdifContainer container = containers[0];

            LdifEntryEditorDialog dialog = null;
            if ( container instanceof LdifContentRecord )
            {
                dialog = new LdifEntryEditorDialog( editor.getEditorSite().getShell(), editor.getConnection(),
                    ( LdifContentRecord ) container );
            }
            else
            {
                dialog = new LdifEntryEditorDialog( editor.getEditorSite().getShell(), editor.getConnection(),
                    ( LdifChangeAddRecord ) container );
            }

            editor.deactivateGlobalActionHandlers();
            if ( dialog.open() == LdifEntryEditorDialog.OK )
            {
                LdifRecord record = dialog.getLdifRecord();

                IDocument document = editor.getDocumentProvider().getDocument( editor.getEditorInput() );
                String old = document.get();
                StringBuffer sb = new StringBuffer();
                sb.append( old.substring( 0, container.getOffset() ) );
                sb.append( record.toFormattedString() );
                sb.append( old.substring( container.getOffset() + container.getLength(), old.length() ) );
                document.set( sb.toString() );
            }
            editor.activateGlobalActionHandlers();
        }
    }
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        LdifFile ldifModel = this.editor.getLdifModel();
        LdifContainer[] allContainers = ldifModel.getContainers();
        List containerList = new ArrayList();
        for ( int i = 0; i < allContainers.length; i++ )
        {
            LdifContainer container = allContainers[i];
            Region containerRegion = new Region( container.getOffset(), container.getLength() );
            if ( TextUtilities.overlaps( containerRegion, damage ) )
            {
                containerList.add( container );
            }
        }
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        TextAttribute MODDN_TEXT_ATTRIBUTE = geTextAttribute( LdifEditorConstants.PREFERENCE_LDIFEDITOR_SYNTAX_CHANGETYPEMODDN );

        for ( int z = 0; z < containers.length; z++ )
        {

            LdifContainer container = containers[z];

            LdifPart[] parts = container.getParts();

            for ( int i = 0; i < parts.length; i++ )
            {

                // int offset = damage.getOffset() + parts[i].getOffset();
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        {
            if ( this.editor != null )
            {

                int offset = sourceViewer.getDocument().getLineOffset( lineNumber );
                LdifContainer container = LdifFile.getContainer( this.editor.getLdifModel(), offset );
                if ( container != null )
                {
                    LdifPart part = LdifFile.getContainerContent( container, offset );
                    if ( part != null )
                    {
                        // return container.getClass().getName() + " - " +
                        // part.getClass().getName();
                        return container.getInvalidString() + " - " + part.getInvalidString();
                    }
                }
            }
        }
        catch ( BadLocationException e )
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

     */
    public void scrollToNewest()
    {
        try
        {
            LdifContainer record = view.getMainWidget().getLdifModel().getLastContainer();
            int offset = record.getOffset();
            int line = view.getMainWidget().getSourceViewer().getDocument().getLineOfOffset( offset );
            if ( line > 3 )
                line -= 3;
            view.getMainWidget().getSourceViewer().setTopIndex( line );
        }
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

                int relativePos = cursorPos - offset;

                // parse partition
                String s = document.get( partition.getOffset(), partition.getLength() );
                LdifFile model = parser.parse( s );
                LdifContainer container = LdifFile.getContainer( model, relativePos );
                if ( container != null )
                {
                    LdifPart part = LdifFile.getContainerContent( container, relativePos );

                    if ( part != null && !( part instanceof LdifSepLine ) && !( part instanceof LdifInvalidPart )
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

    public static LdifContainer getContainer( LdifFile model, int offset )
    {
        if ( model == null || offset < 0 )
            return null;

        LdifContainer container = null;
        LdifContainer[] containers = model.getContainers();
        if ( containers.length > 0 )
        {
            for ( int i = 0; i < containers.length; i++ )
            {
View Full Code Here

Examples of org.apache.directory.ldapstudio.browser.core.model.ldif.container.LdifContainer

        // adjust offset of folling containers
        int adjust = insertLength - removeLength;
        for ( int i = index + newContainers.length; i < this.containerList.size(); i++ )
        {
            LdifContainer container = ( LdifContainer ) this.containerList.get( i );
            container.adjustOffset( adjust );
        }

    }
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.