Package org.eclipse.core.runtime.jobs

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


      }
    }

    Assert.isNotNull(status, "status"); //$NON-NLS-1$
    final BackupService backupService = createOnlineBackupService();
    Job job = new Job("Back-up service") { //$NON-NLS-1$
      @Override
      protected IStatus run(IProgressMonitor monitor) {
        if (!Owl.isShuttingDown()) {
          try {
            backupService.backup(true, monitor);
          } catch (PersistenceException e) {
            Activator.safeLogError(e.getMessage(), e);
          }
          schedule(getOnlineBackupDelay(false));
        }

        return Status.OK_STATUS;
      }
    };
    job.setSystem(true);
    job.schedule(getOnlineBackupDelay(true));
    return status;
  }
View Full Code Here


    registerListeners();

    /* Index outstanding news (only in case we are not reindexing) */
    if (!Boolean.getBoolean("rssowl.reindex")) { //$NON-NLS-1$
      if (!InternalOwl.TESTING) {
        Job delayedIndexJob = new Job(Messages.Indexer_INDEX_FROM_SHUTDOWN) {
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            for (IndexingTask task : getIndexOutstandingEntitiesTasks())
              fJobQueue.schedule(task);

            return Status.OK_STATUS;
          }
        };

        delayedIndexJob.setSystem(true);
        delayedIndexJob.setUser(false);
        delayedIndexJob.schedule(1000);
      } else {
        for (IndexingTask task : getIndexOutstandingEntitiesTasks())
          task.run(new NullProgressMonitor());
      }
    }
View Full Code Here

      return;

    if (sync || InternalOwl.TESTING)
      doSaveCommittedNews(uncommittedNews);
    else {
      Job job = new Job(Messages.Indexer_SAVE_INDEXER) {
        @Override
        protected IStatus run(IProgressMonitor monitor) {
          doSaveCommittedNews(uncommittedNews);
          return Status.OK_STATUS;
        }
      };
      job.setSystem(true);
      job.schedule();
    }
  }
View Full Code Here

    if (columnChange)
      EditorUtils.updateColumns();

    /* Peform clean-up on all BookMarks */
    if (runCleanup) {
      Job retentionJob = new Job(Messages.FeedsPreferencePage_PERFORMNG_CLEANUP) {

        @Override
        protected IStatus run(IProgressMonitor monitor) {
          try {
            Set<IBookMark> bookmarks = new HashSet<IBookMark>();
            CoreUtils.fillBookMarks(bookmarks, rootFolders);

            monitor.beginTask(Messages.FeedsPreferencePage_PERFORMNG_CLEANUP, bookmarks.size());

            for (IBookMark bookmark : bookmarks) {
              if (Controller.getDefault().isShuttingDown() || monitor.isCanceled())
                break;

              monitor.subTask(bookmark.getName());
              RetentionStrategy.process(bookmark);
              monitor.worked(1);
            }
          } finally {
            monitor.done();
          }

          return Status.OK_STATUS;
        }
      };

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

    final IBookMark bm = (IBookMark) fInput.getMark();
    final URI feedLink = bm.getFeedLinkReference().getLink();
    try {
      final IProtocolHandler handler = Owl.getConnectionService().getHandler(feedLink);
      if (handler instanceof org.rssowl.core.internal.connection.DefaultProtocolHandler) {
        Job downloadJob = new Job(Messages.FeedView_DOWNLOADING_FEED) {
          @Override
          protected IStatus run(IProgressMonitor monitor) {
            monitor.beginTask(bm.getName(), IProgressMonitor.UNKNOWN);

            InputStream in = null;
            FileOutputStream out = null;
            boolean canceled = false;
            Exception error = null;
            try {
              byte[] buffer = new byte[8192];

              in = handler.openStream(feedLink, monitor, null);
              out = new FileOutputStream(fileName);
              while (true) {

                /* Check for Cancellation and Shutdown */
                if (monitor.isCanceled() || Controller.getDefault().isShuttingDown()) {
                  canceled = true;
                  return Status.CANCEL_STATUS;
                }

                /* Read from Stream */
                int read = in.read(buffer);
                if (read == -1)
                  break;

                out.write(buffer, 0, read);
              }
            } catch (FileNotFoundException e) {
              error = e;
              Activator.safeLogError(e.getMessage(), e);
            } catch (IOException e) {
              error = e;
              Activator.safeLogError(e.getMessage(), e);
            } catch (ConnectionException e) {
              error = e;
              Activator.safeLogError(e.getMessage(), e);
            } finally {
              monitor.done();

              if (out != null) {
                try {
                  out.close();
                } catch (IOException e) {
                  Activator.safeLogError(e.getMessage(), e);
                }
              }

              if (in != null) {
                try {
                  if ((canceled || error != null) && in instanceof IAbortable)
                    ((IAbortable) in).abort();
                  else
                    in.close();
                } catch (IOException e) {
                  Activator.safeLogError(e.getMessage(), e);
                }
              }
            }

            return Status.OK_STATUS;
          }
        };
        downloadJob.schedule();
      }
    } catch (ConnectionException e) {
      Activator.safeLogError(e.getMessage(), e);
    }
  }
View Full Code Here

        return new String[]{"pdf"};
    }

    protected Job[] createJobs(File outputFile, List resultFiles) {
        ExportState state = new ExportState(outputFile);
        Job generateGanttChart = createGenerateGanttChartJob(state);
        Job generateResourceChart = createGenerateResourcechartJob(state);
        Job initializeFOP = createFOPInitializationJob(state);
        Job runTransormation = createTransformationJob(state, resultFiles);
        return new Job[]{generateGanttChart, generateResourceChart,
                initializeFOP, runTransormation};
    }
View Full Code Here

        return new Job[]{generateGanttChart, generateResourceChart,
                initializeFOP, runTransormation};
    }

    private Job createGenerateGanttChartJob(final ExportState state) {
        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 ExportState state) {
        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 createFOPInitializationJob(final ExportState state) {
        Job result = new ExportJob("Initializing FOP") {
            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 createTransformationJob(final ExportState state, final List resultFiles) {
        Job result = new ExportJob("Generating PDF") {
            protected IStatus run(IProgressMonitor monitor) {
              if (monitor.isCanceled()) {
                Platform.getJobManager().cancel(ExporterBase.EXPORT_JOB_FAMILY);
                return Status.CANCEL_STATUS;
              }
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.