Package org.apache.directory.studio.connection.core.jobs

Examples of org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor



    protected final IStatus run( IProgressMonitor ipm )
    {

        StudioProgressMonitor monitor = new StudioProgressMonitor( externalProgressMonitor == null ? ipm
            : externalProgressMonitor );

        // ensure that connections are opened
        Connection[] connections = getConnections();
        for ( Connection connection : connections )
        {
            if ( connection != null && !connection.getJNDIConnectionWrapper().isConnected() )
            {
                monitor.setTaskName( Messages.bind( Messages.jobs__open_connections_task, new String[]
                    { connection.getName() } ) );
                monitor.worked( 1 );

                connection.getJNDIConnectionWrapper().connect( monitor );
                connection.getJNDIConnectionWrapper().bind( monitor );
                for ( IConnectionListener listener : ConnectionCorePlugin.getDefault().getConnectionListeners() )
                {
                    listener.connectionOpened( connection, monitor );
                }
                ConnectionEventRegistry.fireConnectionOpened( connection, this );
            }
        }

        // execute job
        if ( !monitor.errorsReported() )
        {
            try
            {
                executeAsyncJob( monitor );
            }
            catch ( Exception e )
            {
                monitor.reportError( e );
            }
            finally
            {
                monitor.done();
                ipm.done();
            }
        }

        // error handling
        if ( monitor.isCanceled() )
        {
            // System.out.println("Job: CANCEL+CANCEL");
            externalResult = Status.CANCEL_STATUS;
            return Status.CANCEL_STATUS;
        }
        else if ( monitor.errorsReported() )
        {
            externalResult = monitor.getErrorStatus( getErrorMessage() );
            if ( externalProgressMonitor == null )
            {
                // System.out.println("Job: ERROR+ERROR");
                return externalResult;
            }
View Full Code Here


                { Integer.toString( entriesToDelete.length ) } ), 2 + entriesToDelete.length );
        monitor.reportProgress( " " ); //$NON-NLS-1$
        monitor.worked( 1 );

        int num = 0;
        StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
        for ( int i = 0; !monitor.isCanceled() && !monitor.errorsReported() && i < entriesToDelete.length; i++ )
        {
            IEntry entryToDelete = entriesToDelete[i];
            IBrowserConnection browserConnection = entryToDelete.getBrowserConnection();
View Full Code Here

        if ( browserConnection == null )
        {
            return;
        }

        StudioProgressMonitor dummyMonitor = new StudioProgressMonitor( monitor );
        int importedCount = 0;
        int errorCount = 0;
        try
        {
            while ( !monitor.isCanceled() && enumeration.hasNext() )
            {
                LdifContainer container = enumeration.next();

                if ( container instanceof LdifRecord )
                {
                    LdifRecord record = ( LdifRecord ) container;
                    try
                    {
                        dummyMonitor.reset();
                        importLdifRecord( browserConnection, record, updateIfEntryExists, dummyMonitor );
                        if ( dummyMonitor.errorsReported() )
                        {
                            errorCount++;
                            logModificationError( browserConnection, logWriter, record, dummyMonitor.getException(),
                                monitor );

                            if ( !continueOnError )
                            {
                                monitor.reportError( dummyMonitor.getException() );
                                return;
                            }
                        }
                        else
                        {
View Full Code Here

TOP

Related Classes of org.apache.directory.studio.connection.core.jobs.StudioProgressMonitor

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.