Examples of UIJob


Examples of org.eclipse.ui.progress.UIJob

                return;
            }

            // Add operation to perform at the end of resolution (i.e. display
            // results and actually save the file)
            final UIJob completionJob = new UIJob(shell.getDisplay(), "Display Resolution Results") {
                @Override
                public IStatus runInUIThread(IProgressMonitor monitor) {
                    ResolutionResult result = job.getResolutionResult();
                    ResolutionWizard wizard = new ResolutionWizard(model, file, result);
                    if (result.getOutcome() != ResolutionResult.Outcome.Resolved /*|| !result.getResolve().getOptionalResources().isEmpty() */) {
                        WizardDialog dialog = new WizardDialog(shell, wizard);
                        if (dialog.open() != Window.OK) {
                            if (!wizard.performFinish()) {
                                MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                            }
                        }
                    } else {
                        if (!wizard.performFinish()) {
                            MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                        }
                    }
                    reallySave(monitor);
                    return Status.OK_STATUS;
                }
            };
            job.addJobChangeListener(new JobChangeAdapter() {
                @Override
                public void done(IJobChangeEvent event) {
                    completionJob.schedule();
                }
            });

            // Start job
            job.setUser(true);
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

                return;
            }

            // Add operation to perform at the end of resolution (i.e. display
            // results and actually save the file)
            final UIJob completionJob = new UIJob(shell.getDisplay(), "Display Resolution Results") {
                @Override
                public IStatus runInUIThread(IProgressMonitor monitor) {
                    ResolutionResult result = job.getResolutionResult();
                    ResolutionWizard wizard = new ResolutionWizard(model, file, result);
                    if (result.getOutcome() != ResolutionResult.Outcome.Resolved /*|| !result.getResolve().getOptionalResources().isEmpty() */) {
                        WizardDialog dialog = new WizardDialog(shell, wizard);
                        if (dialog.open() != Window.OK) {
                            if (!wizard.performFinish()) {
                                MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                            }
                        }
                    } else {
                        if (!wizard.performFinish()) {
                            MessageDialog.openError(shell, "Error", "Unable to store resolution results into Run Bundles list.");
                        }
                    }
                    reallySave(monitor);
                    return Status.OK_STATUS;
                }
            };
            job.addJobChangeListener(new JobChangeAdapter() {
                @Override
                public void done(IJobChangeEvent event) {
                    completionJob.schedule();
                }
            });

            // Start job
            job.setUser(true);
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    return Messages.CommandDefinitionActions_TEXT_CMD_DEF;
  }

  public void run() {

    UIJob job = getUIJob();

    IWorkbenchSiteProgressService service = (IWorkbenchSiteProgressService) editorPage.getEditorSite().getService(
        IWorkbenchSiteProgressService.class);
    if (service != null) {
      service.schedule(job, 0L, true);
    }
    else {
      job.schedule();
    }

  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    }

  }

  protected UIJob getUIJob() {
    UIJob job = new UIJob(Messages.CommandDefinitionActions_TEXT_CMD_DEF) {

      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        try {
          ITunnelServiceCommands commands = TunnelServiceCommandStore.getCurrentStore()
              .getTunnelServiceCommands();
          Shell shell = getShell();

          if (shell != null) {
            ServiceInfo serviceInfo = null;

            if (serviceContext != null) {
              String vendor = CloudUtil.getServiceVendor(serviceContext);
              if (vendor != null) {

                for (ServiceInfo info : ServiceInfo.values()) {
                  if (info.name().equals(vendor)) {
                    serviceInfo = info;
                    break;
                  }
                }
              }
            }
            TunnelCommandDefinitionWizard wizard = new TunnelCommandDefinitionWizard(commands, serviceInfo);
            WizardDialog dialog = new WizardDialog(getShell(), wizard);
            if (dialog.open() == Window.OK) {
              commands = wizard.getExternalToolLaunchCommandsServer();

              try {
                TunnelServiceCommandStore.getCurrentStore().storeServerServiceCommands(commands);
              }
              catch (CoreException e) {
                CloudFoundryPlugin.log(e);
              }
            }
          }
        }
        catch (CoreException e) {
          CloudFoundryPlugin.log(e);
        }
        return Status.OK_STATUS;
      }

    };

    job.setSystem(true);
    return job;
  }
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(getJobName()) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {

          IConnectionProfile profile = getConnectionProfile();
          IStatus status = Status.OK_STATUS;

          if (profile != null) {
            status = profile.connect();
          }
          else {
            status = CloudFoundryPlugin.getErrorStatus(NLS.bind(Messages.DataToolsTunnelAction_ERROR_CREATE_PROFILE, tunnelDescriptor.getServiceName()));
          }

          return status;
        }
      };

      uiJob.schedule();
      return Status.OK_STATUS;

    }
    else {
      return CloudFoundryPlugin.getErrorStatus(NLS.bind(Messages.DataToolsTunnelAction_ERROR_CREATE_TUNNEL_FOR, tunnelDescriptor.getServiceName()));
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

    this.cloudServer = cloudServer;
  }

  public void openCaldecottTunnelWizard() {

    UIJob uiJob = new UIJob(Messages.CaldecottUIHelper_JOB_SHOWTUNNEL) {

      public IStatus runInUIThread(IProgressMonitor monitor) {
        Shell shell = getShell();

        CaldecottTunnelWizard wizard = new CaldecottTunnelWizard(cloudServer);
        WizardDialog dialog = new WizardDialog(shell, wizard);
        if (dialog.open() == Window.OK) {

          Set<CaldecottTunnelDescriptor> descriptorsToRemove = wizard.getDescriptorsToRemove();
          if (descriptorsToRemove != null) {
            for (CaldecottTunnelDescriptor descriptor : descriptorsToRemove) {
              try {
                new TunnelBehaviour(cloudServer).stopAndDeleteCaldecottTunnel(
                    descriptor.getServiceName(), monitor);
              }
              catch (CoreException e) {
                CloudFoundryPlugin.log(e);
              }
            }
          }
        }
        return Status.OK_STATUS;
      }

    };
    uiJob.schedule();
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

  public void displayCaldecottTunnels(List<String> srcNames) {

    if (srcNames != null && !srcNames.isEmpty()) {
      final List<String> serviceNames = srcNames;
      UIJob job = new UIJob(Messages.CaldecottUIHelper_JOB_DISPLAY_INFO) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
          CaldecottTunnelInfoDialog dialogue = new CaldecottTunnelInfoDialog(getShell(), cloudServer,
              serviceNames);
          dialogue.open();
          return Status.OK_STATUS;
        }
      };
      job.setSystem(true);
      job.schedule();
    }

  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

      operationLabel = ""; //$NON-NLS-1$
    }

    // Asynch launch as a UI job, as the wizard messages get updated before
    // and after the forked operation
    UIJob job = new UIJob(operationLabel) {

      @Override
      public IStatus runInUIThread(IProgressMonitor monitor) {
        CoreException cex = null;
        try {
          // Fork in a worker thread.
          CloudUiUtil.runForked(runnable, getWizard().getContainer());
        }
        catch (OperationCanceledException e) {
          // Not an error. User can still enter manual values
        }
        catch (CoreException ce) {
          cex = ce;
        }
        // Do not update the wizard with an error, as users can still
        // complete the wizard with manual values.
        if (cex != null) {
          CloudFoundryPlugin.logError(cex);
        }

        return Status.OK_STATUS;
      }

    };
    job.setSystem(true);
    job.schedule();
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

  public void setVisible(boolean visible) {
    super.setVisible(visible);
    if (visible) {
      // Launch it as a job, to give the wizard time to display
      // the spaces viewer
      UIJob job = new UIJob(Messages.CloneServerPage_JOB_REFRESH_ORG_SPACE) {

        @Override
        public IStatus runInUIThread(IProgressMonitor monitor) {
          updateSpacesDescriptor();
          refreshListOfSpaces();

          return Status.OK_STATUS;
        }

      };
      job.setSystem(true);
      job.schedule();
    }
  }
View Full Code Here

Examples of org.eclipse.ui.progress.UIJob

                      JavaTypeCompletionProcessor.DUMMY_CLASS_NAME,
                      null, defaultPackageFragment);
            }
          });
    }
    UIJob job = new UIJob(Messages.JavaTypeUIAdapter_JOB_JAVA_ASSIST) {

      public IStatus runInUIThread(IProgressMonitor monitor) {

        IType type = helper.getMainTypesFromSource(monitor);
        String qualifiedTypeName = type != null ? type
            .getFullyQualifiedName() : null;
        Text text = javaStartCommandPart.getTypeText();
        if (qualifiedTypeName != null && text != null) {
          text.setText(qualifiedTypeName);
        }
        return Status.OK_STATUS;
      }

    };
    job.setPriority(Job.INTERACTIVE);
    job.setSystem(true);
    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.