Examples of LdifFile


Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile

        public Object[] getChildren( Object element )
        {
            // file --> records
            if ( element instanceof LdifFile )
            {
                LdifFile ldifFile = ( LdifFile ) element;
                return ldifFile.getRecords();
            }

            // record --> Array of List of AttrValLine
            else if ( element instanceof LdifContentRecord )
            {
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile

            int newOffset = oldOffset;
            int newLength = oldLength - replacedTextLength + insertedTextLength;
            String textToParse = document.get( newOffset, newLength );

            // parse partion content to containers (offset=0)
            LdifFile newModel = this.ldifParser.parse( textToParse );
            LdifContainer[] newContainers = newModel.getContainers();

            // replace old containers with new containers
            // must adjust offsets of all following containers in model
            this.ldifModel.replace( oldContainers, newContainers );
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile


    public void updateAnnotations()
    {

        LdifFile model = editor.getLdifModel();
        ISourceViewer viewer = ( ISourceViewer ) editor.getAdapter( ISourceViewer.class );
        if ( viewer == null )
            return;

        IDocument document = viewer.getDocument();
        IAnnotationModel annotationModel = viewer.getAnnotationModel();
        if ( document == null || annotationModel == null || model == null )
            return;

        if ( annotationModel instanceof IAnnotationModelExtension )
        {
            ( ( IAnnotationModelExtension ) annotationModel ).removeAllAnnotations();

            List positionList = new ArrayList();

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

                // LdifPart errorPart = null;
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile


    public void createPresentation( TextPresentation presentation, ITypedRegion damage )
    {

        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() );
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile


    public LdifFile parse( String ldif )
    {

        LdifFile model = new LdifFile();

        try
        {
            LdifEnumeration enumeration = this.parse( new StringReader( ldif ) );
            while ( enumeration.hasNext( null ) )
            {
                LdifContainer container = enumeration.next( null );
                model.addContainer( container );
            }
        }
        catch ( ConnectionException e )
        {
            // doesn't occur on the internal LdifEnumeration implementation
View Full Code Here

Examples of org.apache.directory.studio.ldapbrowser.core.model.ldif.LdifFile

            public boolean hasNext( StudioProgressMonitor monitor )
            {
                if ( containerList.isEmpty() )
                {

                    LdifFile model = new LdifFile();

                    // parse header
                    if ( !headerParsed )
                    {
                        checkAndParseComment( model );
                        checkAndParseVersion( model );
                        checkAndParseComment( model );
                        headerParsed = true;
                    }

                    // parse body (in a loop)
                    if ( headerParsed && !bodyParsed )
                    {
                        // parse comment lines
                        if ( !checkAndParseComment( model ) )
                        {
                            // parse record
                            if ( !checkAndParseRecord( model ) )
                            {
                                // parse unknown
                                if ( !checkAndParseOther( model ) )
                                {
                                    // end of body
                                    bodyParsed = true;
                                }
                            }
                        }
                    }

                    // parse footer
                    if ( headerParsed && bodyParsed && !footerParsed )
                    {
                        checkAndParseComment( model );
                        footerParsed = true;
                    }

                    LdifContainer[] containers = model.getContainers();
                    this.containerList.addAll( Arrays.asList( containers ) );
                    return !containerList.isEmpty() && !( containers[0] instanceof LdifEOFContainer );

                }
                else
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.LdifFile

        {
            IEntry referenceCopy = oscSharedReferenceCopies.get( originalEntry );
            IEntry workingCopy = oscSharedWorkingCopies.get( originalEntry );
            if ( referenceCopy != null && workingCopy != null )
            {
                LdifFile diff = Utils.computeDiff( referenceCopy, workingCopy );
                return diff != null;
            }
            return false;
        }
    }
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.LdifFile

                                .getString( "EntryEditorManager.EmptyValueInAttribute" ), attribute.getDescription() ) ); //$NON-NLS-1$
                        }
                    }
                }

                LdifFile diff = Utils.computeDiff( referenceCopy, workingCopy );
                if ( diff != null )
                {
                    // remove entry from map, reduces number of fired events
                    oscSharedReferenceCopies.remove( originalEntry );
                    oscSharedWorkingCopies.remove( originalEntry );
                    // save by executing the LDIF
                    UpdateEntryRunnable runnable = new UpdateEntryRunnable( originalEntry, diff
                        .toFormattedString( LdifFormatParameters.DEFAULT ) );
                    IStatus status = RunnableContextRunner.execute( runnable, null, handleError );
                    // put entry back to map
                    oscSharedReferenceCopies.put( originalEntry, referenceCopy );
                    oscSharedWorkingCopies.put( originalEntry, workingCopy );
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.LdifFile

    }


    public LdifFile parse( String ldif )
    {
        LdifFile model = new LdifFile();
        if ( ldif != null )
        {
            LdifEnumeration enumeration = this.parse( new StringReader( ldif ) );
            try
            {
                while ( enumeration.hasNext() )
                {
                    LdifContainer container = enumeration.next();
                    model.addContainer( container );
                }
            }
            catch ( Exception e )
            {
            }
View Full Code Here

Examples of org.apache.directory.studio.ldifparser.model.LdifFile

            public boolean hasNext()
            {
                if ( containerList.isEmpty() )
                {

                    LdifFile model = new LdifFile();

                    // parse header
                    if ( !headerParsed )
                    {
                        checkAndParseComment( model );
                        checkAndParseVersion( model );
                        checkAndParseComment( model );
                        headerParsed = true;
                    }

                    // parse body (in a loop)
                    if ( headerParsed && !bodyParsed )
                    {
                        // parse comment lines
                        if ( !checkAndParseComment( model ) )
                        {
                            // parse record
                            if ( !checkAndParseRecord( model ) )
                            {
                                // parse unknown
                                if ( !checkAndParseOther( model ) )
                                {
                                    // end of body
                                    bodyParsed = true;
                                }
                            }
                        }
                    }

                    // parse footer
                    if ( headerParsed && bodyParsed && !footerParsed )
                    {
                        checkAndParseComment( model );
                        footerParsed = true;
                    }

                    LdifContainer[] containers = model.getContainers();
                    this.containerList.addAll( Arrays.asList( containers ) );
                    return !containerList.isEmpty() && !( containers[0] instanceof LdifEOFContainer );

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