Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
Copyright (c) 2003, 2007 s IT Solutions AT Spardat GmbH . All rights reserved. This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at http://www.eclipse.org/legal/epl-v10.html Contributors: s IT Solutions AT Spardat GmbH - initial API and implementation /
package at.spardat.xma.boot.comp;
Shell with a progress bar, shown while downloading the resources of an application.

Author(s):
s3595
public class BRBusyIndicator {
    Object result;

    
construts the BRBusyIndicator
    public BRBusyIndicator() {
    }

    
shows a message box as long as the thread loader is alive.

Parameters:
loader thread to start
Returns:
null
    public Object open ( Thread loader ) {
        /*
         * start the thread and wait until it has finished.
         * assume a duration of 60 seconds.
         */
        loader.start();
        ProgressMonitor progressMonitor = new ProgressMonitor(null,BRTCodes.getText("BusyText"),null,0,100);
        int progress = 0;
        long sleep   = 600;
        while(loader.isAlive() ) {
            try { loader.join(sleep);
            } catch (InterruptedException e) { }
            progressMonitor.setProgress((int)(progress/sleep)%99);
            progress+=sleep;
        }
        progressMonitor.close();
        return ;
    }
New to GrepCode? Check out our FAQ X