title: How do you sync a progress bar to data?
body: <p>My program reads files from a directory on the filesystem. I have a progress bar that has minimum set to <code>0</code> and a maximum set to <code>n</code>(number of files in particular directory). Above it is a piece of text which displays the progress of the iterations... <code>1/100, 2/100, 3/100</code> etc.</p>
  
  <p>The problem I'm having is the text displayed is never in sync with the progress bar. The progress bar will be at around <code>70%</code> when the text says <code>100/100</code>. Can anybody help me with this?</p>
  
  <pre><code>pb1.setMinimum(0);
  pb1.setMaximum(files2.size());
  
  shell.getDisplay().asyncExec(new Runnable() {
      public void run() {
          if (pb1.isDisposed()) return;
          for(final File f : files2) {
              pb1.setSelection(pb1.getSelection() + 1);
              dialogShell.setText("Loading" + pb1.getSelection() +
                  "/"+pb1.getMaximum());
  
          }
      }
  });
  </code></pre>