Package org.eclipse.core.runtime.jobs

Examples of org.eclipse.core.runtime.jobs.IJobManager


        myOptions.setTitled(false);
  }

    public void run(final File outputFile, final ExportFinalizationJob finalizationJob)
    throws Exception {
        final IJobManager jobManager = Platform.getJobManager();
        final List resultFiles = new ArrayList();
        final Job[] jobs = createJobs(outputFile, resultFiles);
        final IProgressMonitor monitor = jobManager.createProgressGroup();
        final IProgressMonitor familyMonitor = new IProgressMonitor() {
      public void beginTask(String name, int totalWork) {
        monitor.beginTask(name, totalWork);
      }
      public void done() {
        monitor.done();
      }
      public void internalWorked(double work) {
        monitor.internalWorked(work);
      }
      public boolean isCanceled() {
        return monitor.isCanceled();
      }
      public void setCanceled(boolean value) {
        monitor.setCanceled(value);
        if (value) {
          System.err.println("ExporterBase: canceling value="+EXPORT_JOB_FAMILY);
          jobManager.cancel(EXPORT_JOB_FAMILY);
        }
      }
      public void setTaskName(String name) {
        monitor.setTaskName(name);
      }
View Full Code Here


    WebPublisher() {
    }

    public void run(final File[] exportFiles, final DocumentManager.FTPOptions options, UIFacade uiFacade) {
        IJobManager jobManager = Platform.getJobManager();
        IProgressMonitor monitor = jobManager.createProgressGroup();
          Job startingJob = new Job("starting") {
        protected IStatus run(IProgressMonitor monitor) {
          monitor.beginTask("Publishing files on FTP", exportFiles.length);
          try{
                final URL baseUrl = buildURL(options);
View Full Code Here

     * any remaining dirtyResources of that job to be processed
     * during the current build.
     */
    private void cancelPreviousPerlBuilderJob()
    {
        IJobManager jobMan = Platform.getJobManager();
        Job[] jobs = jobMan.find(PerlBuilderJob.JOB_FAMILY);

        if (jobs.length == 0) return; // no previous build found
       
        jobMan.cancel(PerlBuilderJob.JOB_FAMILY);
        try { jobMan.join(PerlBuilderJob.JOB_FAMILY, null); }
        catch (InterruptedException e)
        {
            // nobody should interrupt our thread in this state;
            // if they do anyway, we treat is as a build cancellation
            throw new OperationCanceledException();
View Full Code Here

        final IResource beam2 = prj.findMember(targetBeamPath);
        assertThat("beam was not removed", beam2, nullValue());
    }

    private void waitJobsToFinish(final Object family) {
        final IJobManager jobMan = Job.getJobManager();
        final Job[] build = jobMan.find(family);
        while (build.length == 1) {
            try {
                build[0].join();
            } catch (final InterruptedException e) {
            }
View Full Code Here

   */
  protected void waitForBuildCompletion() {
    boolean wasInterrupted = false;
    do {
      try {
        IJobManager _jobManager = Job.getJobManager();
        _jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, null);
        wasInterrupted = false;
      } catch (final Throwable _t) {
        if (_t instanceof OperationCanceledException) {
          final OperationCanceledException e = (OperationCanceledException)_t;
          e.printStackTrace();
View Full Code Here

        if (force || fDocumentRead)
          doc= new Document();
        else
          return;

      IJobManager jobMgr= Platform.getJobManager();

      try {
        IStorage storage= input.getStorage();
        // check for null for backward compatibility (we used to check before...)
        if (storage == null)
View Full Code Here

            logPauseWarning(event);
            return;
        }

        if (log.isTraceEnabled()) {
            IJobManager jobManager = Job.getJobManager();
            Job currentJob = jobManager.currentJob();
            if (currentJob != null) {
                currentJob.addJobChangeListener(jobChangeListener);
                log.trace("currentJob='" + currentJob.getName() + "'");
            }
        }
View Full Code Here

            }
        }

        if (resource instanceof IProject) {
            // Ignore all the jobs from SVN.
            IJobManager jobManager = Job.getJobManager();
            Job currentJob = jobManager.currentJob();
            if (currentJob != null) {
                String jobName = currentJob.getName();
                if (jobNames.contains(jobName)) {
                    setPostponeSending(true);
                }
View Full Code Here

 
  // TODO build stuff should go elsewhere
  public static void waitForBuild(IProgressMonitor monitor) {
    SubMonitor subMonitor = SubMonitor.convert(monitor, 100);
   
    IJobManager jobManager = Job.getJobManager();
   
    // we need to ensure that the build has completed:
    // for some strange reason join-thread gets interrupted
    // once in a while (at least on windows).
    boolean buildHasntFinishedYet = true;
    while(buildHasntFinishedYet && !subMonitor.isCanceled()) {
      subMonitor.setWorkRemaining(100);
      try {
        jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, subMonitor.newChild(50));
        jobManager.join(ResourcesPlugin.FAMILY_MANUAL_BUILD, subMonitor.newChild(50));
       
        buildHasntFinishedYet = false;
      } catch (InterruptedException e) {
        buildHasntFinishedYet = true; //
      }
View Full Code Here

   *      org.eclipse.core.runtime.jobs.ISchedulingRule)
   */
  public void runInUI(final IRunnableContext context,
      final IRunnableWithProgress runnable, final ISchedulingRule rule)
      throws InvocationTargetException, InterruptedException {
    final IJobManager manager = Job.getJobManager();
    final InvocationTargetException[] exception = new InvocationTargetException[1];
    final InterruptedException[] canceled = new InterruptedException[1];
    BusyIndicator.showWhile(Display.getDefault(), new Runnable() {
      public void run() {
        try {
          manager.beginRule(rule,
              ((Workbench) PlatformUI.getWorkbench())
                  .isStarting() ? new NullProgressMonitor()
                  : getEventLoopMonitor());
          context.run(false, false, runnable);
        } catch (InvocationTargetException e) {
          exception[0] = e;
        } catch (InterruptedException e) {
          canceled[0] = e;
        } catch (OperationCanceledException e) {
          canceled[0] = new InterruptedException(e.getMessage());
        } finally {
          manager.endRule(rule);
        }
      }

      /**
       * Get a progress monitor that forwards to an event loop monitor.
View Full Code Here

TOP

Related Classes of org.eclipse.core.runtime.jobs.IJobManager

Copyright © 2018 www.massapicom. 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.