private Object aboutToStart(boolean cancelable) {
    Map savedState = null;
    Shell shell = getShell();
    if (shell != null) {
      // Save focus control
      Control focusControl = getShell().getDisplay().getFocusControl();
      if (focusControl != null && focusControl.getShell() != getShell()) focusControl = null;

      Button cancelButton = getButton(IDialogConstants.CANCEL_ID);
      // Set the busy cursor to all shells.
      Display d = getShell().getDisplay();
      setDisplayCursor(d, d.getSystemCursor(SWT.CURSOR_WAIT));

      // Set the arrow cursor to the cancel component.
      cancelButton.setCursor(d.getSystemCursor(SWT.CURSOR_ARROW));

      boolean hasProgressMonitor = fProgressMonitorPart != null;

      // Deactivate shell
      savedState = saveUIState(false);
      if (focusControl != null) savedState.put("focus", focusControl); // $NON-NLS-1$

      if (hasProgressMonitor) {
        if (cancelable) fProgressMonitorPart.attachToCancelComponent(cancelButton);
        fStatusContainer.showPage(fProgressMonitorPart);
      }
      // Update the status container since we are blocking the event loop right now.
      fStatusContainer.update();
    }
    return savedState;
  }
  private void setCursor(int i_cursorId) {

    // save current cursor
    Control ctrl = getCurrentViewer().getControl();
    while (ctrl != null) {
      if (ctrl.getCursor() != null) {
        m_pushedCursor = ctrl.getCursor();
        break;
      }

      ctrl = ctrl.getParent();
    }

    m_pushedCursor = getCurrentViewer().getControl().getDisplay().getSystemCursor(SWT.CURSOR_ARROW);

    // hide cursor and save position
    ctrl = getCurrentViewer().getControl();
    Display display = ctrl.getDisplay();

    Cursor cursor = display.getSystemCursor(i_cursorId);
    ctrl.setCursor(cursor);
  }
Пример #3
0
 @Override
 public void run() {
   Display display = Display.getCurrent();
   Shell shell = display.getActiveShell();
   Cursor cursor = shell == null ? null : shell.getCursor();
   try {
     if (shell != null) {
       shell.setCursor(display.getSystemCursor(SWT.CURSOR_WAIT));
     }
     setEnabled(false);
     if (installButton != null) {
       installButton.setEnabled(false);
     }
     DiscoveryUi.install(discoveryViewer.getInstallableConnectors(), SoftwarePage.this);
   } finally {
     if (shell != null) {
       shell.setCursor(cursor);
     }
     setEnabled(true);
     if (installButton != null) {
       installButton.setEnabled(true);
     }
   }
 }