Example #1
0
 public void clear() {
   SafeUIRunner.asyncExec(
       new SafeRunnable() {
         public void run() throws Exception {
           if (infoText != null && !infoText.isDisposed()) {
             infoText.setText("");
           }
         }
       });
 }
Example #2
0
 private void updateExecutingBuffer(final String buffername) {
   SafeUIRunner.asyncExec(
       new SafeRunnable() {
         public void run() throws Exception {
           if (isDisposed()) {
             return;
           }
           currentBufferLabel.setText("Running: " + buffername);
         }
       });
 }
Example #3
0
  public void launch() throws LauncherException {
    if (widgetClass == null) {
      return;
    }
    SafeUIRunner.asyncExec(
        new SafeRunnable() {
          public void run() throws Exception {
            try {
              ContentViewUtils.createContentView(
                  new IViewContentContributor() {
                    public Image getTitleImage() {
                      if (getDescriptor() != null) {
                        return getDescriptor().getIcon16().createImage();
                      }
                      return null;
                    }

                    public String getTitle() {
                      if (getDescriptor() != null) {
                        return getDescriptor().getLabel();
                      }
                      return "View";
                    }

                    public void dispose() {}

                    public void createContentControl(Composite parent) {
                      parent.setLayout(new FillLayout());
                      try {
                        Object widget =
                            ObjectFactory.instantiateObject(
                                widgetClass,
                                new Class[] {Composite.class, int.class},
                                parent,
                                SWT.INHERIT_DEFAULT);
                        if (widget instanceof IConfigurable) {
                          ((IConfigurable) widget).afterParametersSet();
                        }
                      } catch (ObjectCreateException e) {
                        logger.error("Failed to create control " + widgetClass, e);
                      }
                    }
                  });
            } catch (Exception e) {
              // TODO: generate error view
              logger.error("Failed to create content view " + widgetClass, e);
            }
          }
        });
  }
Example #4
0
 private void autoScroll() {
   SafeUIRunner.asyncExec(
       new SafeRunnable() {
         public void run() throws Exception {
           if (infoText != null && !infoText.isDisposed()) {
             StyledTextContent doc = infoText.getContent();
             int lineCount = doc.getLineCount();
             int lineLimit = DEFAULT_LINE_LIMIT;
             if (lineCount > lineLimit) {
               int startPoint = doc.getOffsetAtLine(lineCount - lineLimit);
               doc.replaceTextRange(0, startPoint, "");
             }
             int docLength = doc.getCharCount();
             infoText.setCaretOffset(docLength);
             infoText.showSelection();
             infoText.redraw();
           }
         }
       },
       200);
 }
Example #5
0
 private void updateStatus(final BatchBufferManagerStatus status) {
   SafeUIRunner.asyncExec(
       new SafeRunnable() {
         public void run() throws Exception {
           if (isDisposed()) {
             return;
           }
           statusLabel.setText("\n" + status.name() + "\n\n");
           if (status.equals(BatchBufferManagerStatus.DISCONNECTED)) {
             statusLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_RED));
             currentBufferLabel.setText(TEXT_NO_RUNNING_BUFFER);
           } else if (status.equals(BatchBufferManagerStatus.IDLE)) {
             statusLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_GREEN));
             currentBufferLabel.setText(TEXT_NO_RUNNING_BUFFER);
           } else if (status.equals(BatchBufferManagerStatus.PREPARING)) {
             statusLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));
           } else if (status.equals(BatchBufferManagerStatus.EXECUTING)) {
             statusLabel.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_YELLOW));
           }
         }
       });
 }