Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[platform-swt-dev] Multi-Threaded Applications

Hello All,
 
I have an application built using SWT. I have a time consuming Thread process as follows:
 
public class ExpandThread_C extends Thread
{
    final private Display __display;
    final private Shell __window;
    final private ProgressBar __progress;
    /**
     * Constructor
     */
    public ExpandThread_C( final Shell window, ProgressBar progress )
    {
        super();
        this.__display = window.getDisplay();
        this.__window = window;
        this.__progress = progress;
    }
 
    /**
     * Run process
     */
    public void run()
    {
        //Update the progress
        updateProgress();
        this.__window.update(); // this doesnt update the application window
        this.__window.redraw(); // nor does this doesnt update the application window
    }
 
    /**
     * Update progress
     */
    public void updateProgress()
    {
        __display.syncExec(
                new Runnable()
                {
                    public void run()
                    {
                        this.__progress.setSelection(1);
                    }
                }
        );   
    }
 
}

In my application I call the Thread using the BusyIndication class as follows:
 
BusyIndicator.showWhile( shell.getDisplay(), new ExpandThread_C( shell, progress ) );
 
The problem I have is that the process takes almost 3-4 minutes and during the time if I minimize and maximize the application window, my application is locked up!!! Am I missing something or is this not the correct way to run the thread? I want my application window to always be available and responsive to the user, any suggestions and/or feedback is greatly appreciated.
 
Thank you,
Shaffin.
 

Back to the top