Package org.eclipse.core.runtime.jobs

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


      }
      public void worked(int work) {
        monitor.worked(work);
      }
        };
        Job starting = new Job("starting") {
      protected IStatus run(IProgressMonitor monitor) {
            monitor.beginTask("Running export", jobs.length);
            for (int i=0; i<jobs.length; i++) {
              if (monitor.isCanceled()) {
                return Status.CANCEL_STATUS;
              }
                jobs[i].setProgressGroup(monitor, 1);
                jobs[i].schedule();
                try {
            jobs[i].join();
          } catch (InterruptedException e) {
            myUIFacade.showErrorDialog(e);
          }
            }
            Job finishing = new Job("finishing") {
          protected IStatus run(IProgressMonitor monitor) {
            monitor.done();
                finalizationJob.run((File[]) resultFiles.toArray(new File[0]));
            return Status.OK_STATUS;
          }
            };
            finishing.setProgressGroup(monitor, 0);
            finishing.schedule();
            try {
          finishing.join();
        } catch (InterruptedException e) {
          myUIFacade.showErrorDialog(e);
        }
        return Status.OK_STATUS;
      }
View Full Code Here


    public String getFileNamePattern() {
        return "html";
    }

    protected Job[] createJobs(File outputFile, List resultFiles) {
        Job generateGanttChartJob = createGenerateGanttChartJob(outputFile, resultFiles);
        Job generateResourceChartJob = createGenerateResourceChartJob(outputFile, resultFiles);
        Job generatePagesJob = createGeneratePagesJob(outputFile, resultFiles);
        Job copyImagesJob = createCopyImagesJob(outputFile, resultFiles);
        return new Job[] {
                generateGanttChartJob, generateResourceChartJob, generatePagesJob, copyImagesJob
        };
    }
View Full Code Here

                generateGanttChartJob, generateResourceChartJob, generatePagesJob, copyImagesJob
        };
    }
   
    private Job createGenerateGanttChartJob(final File outputFile, final List resultFiles) {
        Job result = new ExportJob("generate gantt chart") {
            protected IStatus run(IProgressMonitor monitor) {
                if (monitor.isCanceled()) {
                    Platform.getJobManager().cancel(ExporterBase.EXPORT_JOB_FAMILY);
                    return Status.CANCEL_STATUS;
                }
View Full Code Here

        };
        return result;
    }
   
    private Job createGenerateResourceChartJob(final File outputFile, final List resultFiles) {
        Job result = new ExportJob("Generate resource chart") {
            protected IStatus run(IProgressMonitor monitor) {
                if (monitor.isCanceled()) {
                    Platform.getJobManager().cancel(ExporterBase.EXPORT_JOB_FAMILY);
                    return Status.CANCEL_STATUS;
                }
View Full Code Here

        };
        return result;
    }
   
    private Job createGeneratePagesJob(final File outputFile, final List resultFiles) {
        Job result = new ExportJob("Generate HTML pages") {

            protected IStatus run(IProgressMonitor monitor) {
                if (monitor.isCanceled()) {
                    Platform.getJobManager().cancel(ExporterBase.EXPORT_JOB_FAMILY);
                    return Status.CANCEL_STATUS;
View Full Code Here

        };
        return result;
    }
   
    private Job createCopyImagesJob(final File outputFile, final List resultFiles) {
        Job result = new ExportJob("Copying images") {
            protected IStatus run(IProgressMonitor monitor) {
                if (monitor.isCanceled()) {
                    Platform.getJobManager().cancel(ExporterBase.EXPORT_JOB_FAMILY);
                    return Status.CANCEL_STATUS;
                }
View Full Code Here

    }

    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);
                if (baseUrl==null) {
                  throw new RuntimeException("Failed to discover your FTP settings. Please make sure that you specified server name and user name");
                }
                for (int i=0; i<exportFiles.length; i++) {
                    Job nextJob = createTransferJob(baseUrl, exportFiles[i]);
                    nextJob.setProgressGroup(monitor, 1);
                    nextJob.schedule();
                    nextJob.join();
                }
                Job finishingJob = new Job("finishing") {
            protected IStatus run(IProgressMonitor monitor) {
              monitor.done();
              return Status.OK_STATUS;
            }
                };
                finishingJob.setProgressGroup(monitor, 0);
                finishingJob.schedule();
                finishingJob.join();
          } catch (IOException e) {
            if (!GPLogger.log(e)) {
              e.printStackTrace(System.err);
            }
          } catch (InterruptedException e) {
View Full Code Here

          startingJob.schedule();
    }

    private Job createTransferJob(URL baseUrl, final File file) throws IOException {
        final URL outUrl = new URL(baseUrl, file.getName());
        Job result = new Job("transfer file "+file.getName()) {
            protected IStatus run(IProgressMonitor monitor) {
                byte[] buffer = new byte[(int) file.length()];
                FileInputStream inputStream = null;
                OutputStream outStream = null;
                try {
View Full Code Here

      startIndexing();
     
      // process deltas since last activated in indexer thread so that indexes are up-to-date.
      // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=38658
      Job processSavedState = new Job(Messages.savedState_jobName) {
        protected IStatus run(IProgressMonitor monitor) {
          try {
            // add save participant and process delta atomically
            // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=59937
            workspace.run(
              new IWorkspaceRunnable() {
                public void run(IProgressMonitor progress) throws CoreException {
                  ISavedState savedState = workspace.addSaveParticipant(JavaCore.getJavaCore(), JavaModelManager.this);
                  if (savedState != null) {
                    // the event type coming from the saved state is always POST_AUTO_BUILD
                    // force it to be POST_CHANGE so that the delta processor can handle it
                    JavaModelManager.this.deltaState.getDeltaProcessor().overridenEventType = IResourceChangeEvent.POST_CHANGE;
                    savedState.processResourceChangeEvents(JavaModelManager.this.deltaState);
                  }
                }
              },
              monitor);
          } catch (CoreException e) {
            return e.getStatus();
          }
          return Status.OK_STATUS;
        }
      };
      processSavedState.setSystem(true);
      processSavedState.setPriority(Job.SHORT); // process asap
      processSavedState.schedule();
    } catch (RuntimeException e) {
      shutdown();
      throw e;
    }
  }
View Full Code Here

          this.notifyAll(); // ensure its awake so it can be shutdown
        }
        // in case processing thread is handling a job
        thread.join();
      }
      Job job = this.progressJob;
      if (job != null) {
        job.cancel();
        job.join();
      }
    } catch (InterruptedException e) {
      // ignore
    }
  }
View Full Code Here

TOP

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

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.