Refine search
/** * Waits for the early startup job to complete. */ private void waitForEarlyStartup() { try { Job.getJobManager().join(Workbench.EARLY_STARTUP_FAMILY, null); } catch (OperationCanceledException e) { // ignore } catch (InterruptedException e) { // ignore } }
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { ISchedulingRule rule = ResourcesPlugin.getWorkspace().getRoot(); Job.getJobManager().beginRule(rule, monitor); try { try { this.createdProjects = doCreateMavenProjects(monitor); if(workingSets != null) { WorkingSets.addToWorkingSets(createdProjects, workingSets); } } catch(CoreException e) { throw new InvocationTargetException(e); } } finally { Job.getJobManager().endRule(rule); } }
public void schedule(Job job, long interval) { Job[] existingJobs = Job.getJobManager().find(job); if (existingJobs.length < MAX_QUEUED_REFRESH_JOBS) { job.schedule(interval); } }
public void stop(BundleContext bundleContext) throws Exception { try { // cancel any repository load jobs started in the UI Job.getJobManager().cancel(LoadMetadataRepositoryJob.LOAD_FAMILY); // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=305163 // join the jobs so that this bundle does not stop until the jobs are // actually cancelled. Job.getJobManager().join(LoadMetadataRepositoryJob.LOAD_FAMILY, new NullProgressMonitor()); plugin = null; ProvUIActivator.context = null; ui = null; } finally { super.stop(bundleContext); } }
/** * Cancels the early startup job, if it's still running. */ private void cancelEarlyStartup() { Job.getJobManager().cancel(EARLY_STARTUP_FAMILY); // We do not currently wait for any plug-in currently being started to // complete // (e.g. by doing a join on EARLY_STARTUP_FAMILY), since they may do a // syncExec, // which would hang. See bug 94537 for rationale. }
public void threadChange(Thread thread) { // we must make sure we aren't transferring control away from a thread that // already owns a scheduling rule because this is deadlock prone (bug 105491) if (rule == null) { return; } Job currentJob = Job.getJobManager().currentJob(); if (currentJob == null) { return; } ISchedulingRule currentRule = currentJob.getRule(); if (currentRule == null) { return; } throw new IllegalStateException( "Cannot fork a thread from a thread owning a rule"); // $NON-NLS-1$ }
@Override public boolean shouldSchedule() { Job[] jobs = Job.getJobManager().find(process); for (Job job : jobs) { if (job instanceof ConsoleCreation) { return false; } } return true; } }
private void cancelBuild(Object jobfamily) { Job[] buildJobs = Job.getJobManager().find(jobfamily); for (Job curr : buildJobs) { if (curr != this && curr instanceof BuildJob) { BuildJob job = (BuildJob) curr; if (job.isCoveredBy(this)) { curr.cancel(); // cancel all other build jobs of our // kind } } } }
/** * Workaround a deficiency of ISourceLookupParticipant API, which does not provide access to a progress monitor. * * <p> * This method can be called in three different cases: * <ol> * <li>from UI thread, in which case {@code null} is return. this tells the caller to only perform fast operations (i.e. cache lookups) on this * thread and submit any long-running operations as background jobs * <li>from background job with existing IProgressMonitor, in which case the monitor is returned * <li>from background job without IProgressMonitor, in which case {@link NullProgressMonitor} is returned. * </ol> */ public static IProgressMonitor getContextMonitor(IProgressMonitor monitor) { if (monitor == null) { Job job = Job.getJobManager().currentJob(); if (job != null) { // current implementation can perform workspace project cache initialization on system job without any user feedback // although eclipse ui remains responsive, source lookup will appear to do nothing until initialization is complete // a fix requires changes to ISourceLookupParticipant#findSourceElements API to accept user-visible progress monitor monitor = new NullProgressMonitor(); } } return monitor; }
private boolean isJobInFamilyRunning(Object family) { Job[] jobs = Job.getJobManager().find(family); if (jobs != null && jobs.length > 0) { for (int i = 0; i < jobs.length; i++) { Job job = jobs[i]; if (job.getState() != Job.NONE) { return true; } } } return false; }
/** * Print a debug message to the console. * Prepend the message with the current date, the name of the current thread and the current job if present. */ public static void debug(String message) { StringBuilder output = new StringBuilder(); Job currentJob = Job.getJobManager().currentJob(); if (currentJob != null) { output.append(currentJob.getClass().getName()); output.append("("); //$NON-NLS-1$ output.append(currentJob.getName()); output.append("): "); //$NON-NLS-1$ } output.append(message); DEBUG_TRACE.trace(null, output.toString()); }
public void done(IJobChangeEvent event) { if (event.getJob().belongsTo(FederatedSearchJob.FAMILY)) { Job[] searchJobs = Job.getJobManager().find(FederatedSearchJob.FAMILY); if (searchJobs.length == 0) { // search finished searchInProgress = false; if (container.isDisposed()) return; container.getDisplay().asyncExec(this); SearchResultsPart results = (SearchResultsPart) parent .findPart(IHelpUIConstants.HV_FSEARCH_RESULT); results.completed(); } } }
private boolean suppressAuthentication() { Job job = Job.getJobManager().currentJob(); if (job != null) { return job.getProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER) != null; } return false; }
private void unlockDocument(IJobManager jobMgr, ISchedulingRule rule) { if (rule != null) { jobMgr.endRule(rule); } else synchronized (fDocumentAccessorLock) { fDocumentLocked= false; fDocumentAccessorLock.notifyAll(); } }
try { project.refreshLocal(IResource.DEPTH_INFINITE, null); IJobManager jobManager = Job.getJobManager(); jobManager.join(ResourcesPlugin.FAMILY_AUTO_BUILD, null); } catch (CoreException | OperationCanceledException | InterruptedException e) { e.printStackTrace(); }
@Override public void run() { manager.beginRule(rule, null); } };
/** Waits for all the jobs to finish. */ public static void waitForJobsToFinish() { EclipseMisc.withService(IJobManager.class, jobManager -> { Job job; while ((job = jobManager.currentJob()) != null) { System.out.print(" waiting for " + job.getName() + " to finish... "); job.join(); System.out.println("complete."); } }); } }
public void run() { IWorkspace workspace= ResourcesPlugin.getWorkspace(); ISchedulingRule rule= workspace.getRuleFactory().modifyRule(workspace.getRoot()); try { Platform.getJobManager().beginRule(rule, null); if (validateResources((FileSearchQuery) fPage.getInput().getQuery())) { ReplaceDialog2 dialog= new ReplaceDialog2(fSite.getShell(), fElements, fPage); dialog.open(); } } catch (OperationCanceledException e) { } finally { Platform.getJobManager().endRule(rule); } }
public void done(IJobChangeEvent event) { Job[] jobs = jobManager.find(getContext()); if (jobs.length == 0) { final IResourceDiffTree diffTree = getContext().getDiffTree(); diffTree.clearBusy(null); jobManager.removeJobChangeListener(this); } } };