Пример #1
0
 /**
  * Update ProgressBar widget.<br>
  * Try to reuse the old ProgressBar if possible, otherwise dispose it and create a new one.
  *
  * @param parent
  * @param indeterminate
  * @param visible
  */
 void eswtUpdateProgressbar(Composite parent, boolean indeterminate, boolean visible) {
   // Only dispose old ProgressBar if it has wrong style
   if (eswtProgressBar != null) {
     boolean isIndeterminate = (eswtProgressBar.getStyle() & SWT.INDETERMINATE) != 0;
     if (indeterminate != isIndeterminate) {
       eswtProgressBar.setLayoutData(null);
       eswtProgressBar.dispose();
       eswtProgressBar = null;
     }
   }
   // create new ProgressBar
   if (eswtProgressBar == null) {
     int newStyle = indeterminate ? SWT.INDETERMINATE : SWT.NONE;
     eswtProgressBar = new ProgressBar(parent, newStyle);
     eswtProgressBar.setLayoutData(eswtProgbarLD);
     // update ScrolledText's layoutdata
     FormData imageLD = (FormData) eswtImgLabel.getLayoutData();
     imageLD.bottom = new FormAttachment(eswtProgressBar);
   }
   // set Progressbar visibility
   if (eswtProgressBar != null) {
     eswtProgbarLD.top = (visible ? null : new FormAttachment(100));
     eswtProgressBar.setVisible(visible);
   }
 }
 public void close() {
   progressBar.dispose();
   shell.close();
 }
 public void dispose() {
   progressBar.dispose();
   childShell.dispose();
 }