title: Progressbar with SWT
body: <p>I have tried to add progress bar in status line of the window, where there are already many text items on status line (for e.g. current time). I want to make progress in progressbar while loading data to one of the frame (called data) of the window. I have few problems regarding this. (I am quite new to SWT, so kindly bear with me.)</p>
  
  <p>in makeProgress method I try to make progress in progress bar. Following is my code </p>
  
  <pre><code>public class Progress extends ContributionItem {
  
      private static org.eclipse.swt.widgets.ProgressBar progressBar;
  
      public Progress(final String id) {
          super(id);
      }
  
      @Override
      public void fill(final Composite parent) {
          if (progressBar == null) {
              progressBar = new ProgressBar(parent, SWT.None);
          }
          progressBar.setVisible(false);
      }
  
      public void makeProgress(final int loaded_data, final int total_data) {
          logger.log("progressitem do progress", new String [] {""});
          Display.getDefault().asyncExec(new Runnable() {
              public void run() {
                  Progress.progressBar.setVisible(true);
                  Progress.progressBar.setMaximum(total_data);
                  Progress.progressBar.setSelection(loaded_data);
              }});
          if (loaded_data == total_data) {
              //When all of the data are loaded, make progress bar disappear
              Display.getDefault().asyncExec(new Runnable() {
                  public void run() {
                      Progress.progressBar.setVisible(false);
                  }});
          }
      }
  }
  </code></pre>
  
  <p>where makeProgress called by a class which handles statusbar like following: change is a type of </p>
  
  <pre><code>if (change.getChange() == hasChanged.UPDATE_PROGRESS) {
              progress.makeProgress(change.getLoaded_data(), change.getTotal_data);
  </code></pre>
  
  <p>Problems:</p>
  
  <p>1) My progress bar is progressing very slow. May be proper use of threads required ?</p>
  
  <p>2) Although I tried, I am not quite clear with the difference between Display.getDefault.asyncExec and syncExec. </p>
  
  <p>3) Another issue is, when progress bar is progressing, The whole GUI is not responsive. How can I make progressbar independent of other views on the GUI ?</p>
  
  <p>I would really appreciate any pointers or suggestions regarding this.</p>