Examples of UIJob


Examples of org.eclipse.ui.progress.UIJob

  @Override
  public void handleError(final IStatus status, BehaviourEventType eventType) {

    if (status != null && status.getSeverity() == IStatus.ERROR) {

      UIJob job = new UIJob(Messages.CloudFoundryUiCallback_JOB_CF_ERROR) {
        public IStatus runInUIThread(IProgressMonitor monitor) {
          Shell shell = CloudUiUtil.getShell();
          if (shell != null) {
            new MessageDialog(shell, Messages.CloudFoundryUiCallback_ERROR_CALLBACK_TITLE, null,
                status.getMessage(), MessageDialog.ERROR, new String[] { Messages.COMMONTXT_OK }, 0)
                .open();
          }
          return Status.OK_STATUS;
        }
      };
      job.setSystem(true);
      job.schedule();

    }
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

      // Now check if there are any options that require values,
      // and fill in any tunnel
      // options
      // THis must be wrapped in a UI Job

      UIJob uiJob = new UIJob(Messages.LaunchTunnelCommandAction_JOB_PROMPT) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
          Shell shell = PlatformUI.getWorkbench().getModalDialogShellProvider().getShell();
          final ServiceCommand resolvedCommand = new CommandOptionsUIHandler(shell, serviceCommand,
              descriptor).promptForValues();

          // Once prompted, launch it asynchronously outside the UI
          // thread as it may be a long
          // running process that may block the thread while waiting
          // for the user to exist the external
          // application
          if (resolvedCommand != null) {
            Job job = new Job(Messages.LaunchTunnelCommandAction_JOB_LAUNCH) {

              @Override
              protected IStatus run(IProgressMonitor monitor) {
                // Finally launch the external tool after
                // options
                // are filled
                // in.
                try {
                  new LaunchTunnelCommandManager(resolvedCommand).run(monitor);
                }
                catch (CoreException e) {
                  IStatus errorStatus = CloudFoundryPlugin.getErrorStatus(e);
                  CloudFoundryPlugin.log(errorStatus);
                  return errorStatus;
                }
                return Status.OK_STATUS;
              }
            };

            // As this may be a long running process, so set it as a
            // system job
            job.setSystem(true);
            job.schedule();
          }

          return Status.OK_STATUS;
        }
      };

      uiJob.schedule();

    }

    return Status.OK_STATUS;
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

      }
    }

    private void refresh(final IServer server) {

      UIJob job = new UIJob(Messages.CloudFoundryApplicationsEditorPage_JOB_REFRESH) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
          try {
            if (server != null) {
              CloudFoundryServer cloudServer = (CloudFoundryServer) server.loadAdapter(
                  CloudFoundryServer.class, monitor);
              if (cloudServer != null) {
                setServices(cloudServer.getBehaviour().getServices(monitor));
              }
            }

            if (mform != null && mform.getForm() != null && !mform.getForm().isDisposed()) {
              masterDetailsBlock.refreshUI(RefreshArea.ALL);
            }
          }
          catch (CoreException e) {
            return e.getStatus();
          }
          return Status.OK_STATUS;
        }
      };

      job.schedule();

    }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    Button button = toolkit.createButton(client, Messages.ApplicationMasterPart_TEXT_REMOVE_BUTTON, SWT.PUSH);
    GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(button);

    button.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        UIJob uiJob = new UIJob(Messages.ApplicationMasterPart_JOB_REMOVE_ROUTE) {

          public IStatus runInUIThread(IProgressMonitor monitor) {
            CloudRoutesWizard wizard = new CloudRoutesWizard(cloudServer);

            WizardDialog dialog = new WizardDialog(editorPage.getEditorSite().getShell(), wizard);
            dialog.open();
            return Status.OK_STATUS;
          }

        };
        uiJob.setSystem(true);
        uiJob.setPriority(Job.INTERACTIVE);
        uiJob.schedule();
      }
    });

  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    }

    @Override
    public boolean performDrop(final Object data) {
      final String jobName = "Deploying application"; //$NON-NLS-1$
      UIJob job = new UIJob(jobName) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {

          if (data instanceof IStructuredSelection) {
            Object modObj = ((IStructuredSelection) data).getFirstElement();
            IProject prj = null;
            if (modObj instanceof IProject) {
              prj = (IProject) modObj;
            }
            else if (modObj instanceof IJavaProject) {
              prj = ((IJavaProject) modObj).getProject();
            }

            if (prj != null) {

              final CloudFoundryServer cloudServer = (CloudFoundryServer) editorPage.getServer()
                  .getOriginal().loadAdapter(CloudFoundryServer.class, monitor);

              if (cloudServer != null) {

                final String moduleName = prj.getName();

                // First of all, should make sure there is no
                // CloundApplicationModule
                // with the same name of the selected project,
                // otherwise it will cause
                // the CloundApplicationModule with the same
                // name and its related remote
                // application in CF to be deleted.
                if (cloudServer.getBehaviour().existCloudApplicationModule(moduleName)) {
                  Display.getDefault().asyncExec(new Runnable() {

                    public void run() {
                      MessageDialog.openError(
                          editorPage.getSite().getShell(),
                          Messages.ApplicationMasterPart_ERROR_DEPLOY_FAIL_TITLE,
                          NLS.bind(
                              Messages.ApplicationMasterPart_ERROR_DEPLOY_FAIL_BODY,
                              moduleName));
                    }

                  });
                  return Status.CANCEL_STATUS;
                }

                // Make sure parent performs the drop first to
                // create the IModule. Unsupported modules will
                // not proceed result in IModule creation
                // therefore checks on the IProject are not
                // necessary
                ApplicationViewersDropAdapter.super.performDrop(data);

                // Now do a publish AFTER the IModule is
                // created. If no IModule is created (either
                // user cancels or project
                // is not supported), the publish operation will
                // do nothing.
                Job job = new Job(jobName) {

                  @Override
                  protected IStatus run(IProgressMonitor monitor) {
                    cloudServer.getBehaviour().publishAdd(moduleName, monitor);
                    return Status.OK_STATUS;
                  }

                };
                job.setPriority(Job.INTERACTIVE);
                job.schedule();
                return Status.OK_STATUS;
              }
            }
          }
          return Status.CANCEL_STATUS;
        }
      };
      job.schedule();

      return true;
    }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    envVarsButton.addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(SelectionEvent e) {
        try {
          final CloudFoundryApplicationModule appModule = getExistingApplication();
          if (appModule != null) {
            UIJob uiJob = new UIJob(Messages.ApplicationDetailsPart_JOB_EDIT_ENV_VAR) {

              public IStatus runInUIThread(IProgressMonitor monitor) {
                try {
                  DeploymentInfoWorkingCopy infoWorkingCopy = appModule
                      .resolveDeploymentInfoWorkingCopy(monitor);

                  EnvVarsWizard wizard = new EnvVarsWizard(cloudServer, appModule, infoWorkingCopy);
                  WizardDialog dialog = new WizardDialog(editorPage.getEditorSite().getShell(),
                      wizard);
                  dialog.open();
                  return Status.OK_STATUS;
                }
                catch (CoreException e) {
                  return e.getStatus();
                }
              }

            };
            uiJob.setSystem(true);
            uiJob.setPriority(Job.INTERACTIVE);
            uiJob.schedule();

          }
        }
        catch (CoreException ce) {
          logError(NLS.bind(Messages.ApplicationDetailsPart_ERROR_UPDATE_ENV_VAR, ce.getMessage()));
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    public void handleDebuggerTermination() {

      try {
        final CloudFoundryApplicationModule appModule = getExistingApplication();

        UIJob job = new UIJob(Messages.ApplicationDetailsPart_JOB_DEBUG) {

          public IStatus runInUIThread(IProgressMonitor arg0) {

            // refreshApplicationDeploymentButtons(appModule);
            refreshAndReenableDeploymentButtons(appModule);
            return Status.OK_STATUS;
          }

        };
        job.setSystem(true);
        job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule());
        job.setPriority(Job.INTERACTIVE);
        job.schedule();
      }
      catch (CoreException ce) {
        logApplicationModuleFailureError(Messages.ApplicationDetailsPart_ERROR_REFRESH_DEBUG_BUTTON);
      }
    }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

  public void doRun(final CloudFoundryServer cloudServer) {
    final Shell shell = activePart != null && activePart.getSite() != null ? activePart.getSite().getShell()
        : CloudUiUtil.getShell();

    if (shell != null) {
      UIJob job = new UIJob(getJobName()) {

        public IStatus runInUIThread(IProgressMonitor monitor) {
          OrgsAndSpacesWizard wizard = new OrgsAndSpacesWizard(cloudServer);
          WizardDialog dialog = new WizardDialog(shell, wizard);
          dialog.open();

          return Status.OK_STATUS;
        }
      };
      job.setSystem(true);
      job.schedule();
    }
    else {
      CloudFoundryPlugin.logError("Unable to find an active shell to open the orgs and spaces wizard."); //$NON-NLS-1$
    }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    return Messages.MANAGE_SERVICES_TO_APPLICATIONS_TITLE;
  }

  @Override
  public void run() {
    UIJob uiJob = new UIJob(Messages.MANAGE_SERVICES_TO_APPLICATIONS_TITLE) {
      public IStatus runInUIThread(IProgressMonitor monitor) {       
        try {
          if (serverBehaviour != null){
            ServiceToApplicationsBindingWizard wizard = new ServiceToApplicationsBindingWizard(servicesHandler,
                serverBehaviour.getCloudFoundryServer(),editorPage);
            WizardDialog dialog = new WizardDialog(getEditorPage().getSite().getShell(), wizard);
            dialog.open();         
          }
        }
        catch (CoreException e) {
            if (Logger.ERROR) {
              Logger.println(Logger.ERROR_LEVEL, this, "runInUIThread", "Error launching wizard",e); //$NON-NLS-1$ //$NON-NLS-2$
            }
        }

        return Status.OK_STATUS;
      }

    };
    uiJob.setSystem(true);
    uiJob.setPriority(Job.INTERACTIVE);
    uiJob.schedule();
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

  public String getLocation() {
    return location;
  }

  public void navigate() {
    UIJob job = new UIJob(label) {

      public IStatus runInUIThread(IProgressMonitor monitor) {
        CloudUiUtil.openUrl(location);
        return Status.OK_STATUS;
      }
    };

    job.schedule();
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.