Java Code Examples for org.eclipse.core.runtime.jobs.Job#NONE
The following examples show how to use
org.eclipse.core.runtime.jobs.Job#NONE .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void scheduleFetchChangePathJob(ILogEntry logEntry) { if(fetchChangePathJob == null) { fetchChangePathJob = new FetchChangePathJob(); } if(fetchChangePathJob.getState() != Job.NONE) { fetchChangePathJob.cancel(); try { fetchChangePathJob.join(); } catch(InterruptedException e) { SVNUIPlugin.log(IStatus.ERROR, e.getMessage(), e); // SVNUIPlugin.log(new // SVNException(Policy.bind("HistoryView.errorFetchingEntries", // remoteResource.getName()), e)); //$NON-NLS-1$ } } fetchChangePathJob.setLogEntry(logEntry); Utils.schedule(fetchChangePathJob, getSite()); }
Example 2
Source File: SVNHistoryPage.java From APICloud-Studio with GNU General Public License v3.0 | 6 votes |
public void run() { final ISVNRemoteResource remoteResource = historyTableProvider.getRemoteResource(); if(fetchNextLogEntriesJob == null) { fetchNextLogEntriesJob = new FetchNextLogEntriesJob(); } if(fetchNextLogEntriesJob.getState() != Job.NONE) { fetchNextLogEntriesJob.cancel(); try { fetchNextLogEntriesJob.join(); } catch(InterruptedException e) { SVNUIPlugin.log(new SVNException(Policy .bind("HistoryView.errorFetchingEntries", remoteResource.getName()), e)); //$NON-NLS-1$ } } fetchNextLogEntriesJob.setRemoteFile(remoteResource); Utils.schedule(fetchNextLogEntriesJob, getSite()); }
Example 3
Source File: ExternalFoldersManager.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 6 votes |
private void runRefreshJob(Collection paths) { Job[] jobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_MANUAL_REFRESH); RefreshJob refreshJob = null; if (jobs != null) { for (int index = 0; index < jobs.length; index++) { // We are only concerned about ExternalFolderManager.RefreshJob if(jobs[index] instanceof RefreshJob) { refreshJob = (RefreshJob) jobs[index]; refreshJob.addFoldersToRefresh(paths); if (refreshJob.getState() == Job.NONE) { refreshJob.schedule(); } break; } } } if (refreshJob == null) { refreshJob = new RefreshJob(new Vector(paths)); refreshJob.schedule(); } }
Example 4
Source File: WaitUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
private static String jobStateToString(int jobState) { switch (jobState) { case Job.RUNNING: return "RUNNING"; //$NON-NLS-1$ case Job.WAITING: return "WAITING"; //$NON-NLS-1$ case Job.SLEEPING: return "SLEEPING"; //$NON-NLS-1$ case Job.NONE: return "NONE"; //$NON-NLS-1$ default: return "UNKNOWN"; //$NON-NLS-1$ } }
Example 5
Source File: TmfEventsCache.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Clear the current contents of this cache. */ public synchronized void clear() { if (job != null && job.getState() != Job.NONE) { job.cancel(); } Arrays.fill(fCache, null); fCacheStartIndex = 0; fCacheEndIndex = 0; fFilterIndex.clear(); }
Example 6
Source File: SVNPristineCopyQuickDiffProvider.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void dispose() { isReferenceInitialized = false; // stop update job if(fUpdateJob != null && fUpdateJob.getState() != Job.NONE) { fUpdateJob.cancel(); } // remove listeners if(documentProvider != null) { documentProvider.removeElementStateListener(documentListener); } SVNWorkspaceSubscriber.getInstance().removeListener(teamChangeListener); }
Example 7
Source File: SubclipseSubscriberChangeSetManager.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Wait until the collector is done processing any events. * This method is for testing purposes only. * @param monitor */ public void waitUntilDone(IProgressMonitor monitor) { monitor.worked(1); // wait for the event handler to process changes. while(handler.getEventHandlerJob().getState() != Job.NONE) { monitor.worked(1); try { Thread.sleep(10); } catch (InterruptedException e) { } Policy.checkCanceled(monitor); } monitor.worked(1); }
Example 8
Source File: SVNTeamProviderType.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
public void share(IProject project) { if (!RepositoryProvider.isShared(project)) { synchronized (projectsToShare) { if (!projectsToShare.contains(project)) { SVNWorkspaceRoot.setManagedBySubclipse(project); projectsToShare.add(project); } } if(getState() == Job.NONE && !isQueueEmpty()) schedule(); } }
Example 9
Source File: DBTestDialog.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
@Override protected void okPressed(){ if (dbCheckJob == null || dbCheckJob.getState() == Job.NONE) { super.okPressed(); } else { MessageDialog.openInformation(getShell(), "Laufende Datenbank Wartung", "Zuletzt gestartete Datenbanküberprüfung noch nicht abgeschlossen...\n(siehe rechts unten)"); } }
Example 10
Source File: TaskJobHandler.java From orion.server with Eclipse Public License 1.0 | 4 votes |
/** * Schedules {@link TaskJob} and handles response. If job lasts more than {@link this#WAIT_TIME} * handler starts a task and returns 202 (Accepted) response with task details. If job finishes sooner the * response if immediately returned filled with {@link TaskJob#getResult()}, if result is OK, than only * {@link ServerStatus#getJsonData()} is returned, if result is OK and it is not an instance of {@link ServerStatus} * than {@link TaskJob#getFinalResult()} is returned as a response content. * * @param request * @param response * @param job Job that should be handled as a task. * @param statusHandler status handler to handle error statuses. * @return <code>true</code> if job was handled properly. * @throws IOException * @throws ServletException * @throws URISyntaxException * @throws JSONException */ public static boolean handleTaskJob(HttpServletRequest request, HttpServletResponse response, TaskJob job, ServletResourceHandler<IStatus> statusHandler, IURIUnqualificationStrategy strategy) throws IOException, ServletException, URISyntaxException, JSONException { final Object jobIsDone = new Object(); final JobChangeAdapter jobListener = new JobChangeAdapter() { public void done(IJobChangeEvent event) { synchronized (jobIsDone) { jobIsDone.notify(); } } }; job.addJobChangeListener(jobListener); job.schedule(); try { synchronized (jobIsDone) { if (job.getState() != Job.NONE) { jobIsDone.wait(WAIT_TIME); } } } catch (InterruptedException e) { } job.removeJobChangeListener(jobListener); if (job.getState() == Job.NONE || job.getRealResult() != null) { if (job.getRealResult() == null) { logger.error("Job RealResult is null result=" + job.getResult(), job.getResult() != null ? job.getResult().getException() : null); } return writeResult(request, response, job, statusHandler, strategy); } else { TaskInfo task = job.startTask(); task.setUnqualificationStrategy(strategy); JSONObject result = task.toJSON(); URI taskLocation = createTaskLocation(ServletResourceHandler.getURI(request), task.getId(), task.isKeep()); result.put(ProtocolConstants.KEY_LOCATION, taskLocation); if (!task.isRunning()) { job.removeTask(); // Task is not used, we may remove it return writeResult(request, response, job, statusHandler, strategy); } response.setHeader(ProtocolConstants.HEADER_LOCATION, ServletResourceHandler.resovleOrionURI(request, taskLocation).toString()); OrionServlet.writeJSONResponse(request, response, result, strategy); response.setStatus(HttpServletResponse.SC_ACCEPTED); return true; } }
Example 11
Source File: ThreadDumpingWatchdog.java From google-cloud-eclipse with Apache License 2.0 | 4 votes |
private static void dumpJob(StringBuilder sb, String linePrefix, Job job, Thread thread) { String status; switch (job.getState()) { case Job.RUNNING: status = "RUNNING"; break; case Job.WAITING: status = "WAITING"; break; case Job.SLEEPING: status = "SLEEPING"; break; case Job.NONE: status = "NONE"; break; default: status = "UNKNOWN(" + job.getState() + ")"; break; } Object blockingJob = null; try { blockingJob = ReflectionUtil.invoke(Job.getJobManager(), "findBlockingJob", InternalJob.class, new Class<?>[] {InternalJob.class}, job); } catch (NoSuchMethodException | SecurityException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) { System.err.println("Unable to fetch blocking-job: " + ex); } sb.append("\n").append(linePrefix); sb.append( String.format( " %s%s{pri=%d%s%s%s%s} %s (%s)%s", status, (job.isBlocking() ? "<BLOCKING>" : ""), job.getPriority(), (job.isSystem() ? ",system" : ""), (job.isUser() ? ",user" : ""), (job.getRule() != null ? ",rule=" + job.getRule() : ""), (thread != null ? ",thr=" + thread : ""), job, job.getClass().getName(), (job.getJobGroup() != null ? " [group=" + job.getJobGroup() + "]" : ""))); if (blockingJob != null) { sb.append("\n").append(linePrefix) .append(String.format(" - blocked by: %s (%s)", blockingJob, blockingJob.getClass())); } }