@Override public void run() { manager.beginRule(rule, null); } };
@Override public void run() { manager.beginRule(rule, null); } };
public void run() { manager.beginRule(rule, null); } };
private void lockDocument(IProgressMonitor monitor, IJobManager jobMgr, ISchedulingRule rule) { if (rule != null) { jobMgr.beginRule(rule, monitor); } else synchronized (fDocumentAccessorLock) { while (fDocumentLocked) { try { fDocumentAccessorLock.wait(); } catch (InterruptedException e) { // nobody interrupts us! throw new OperationCanceledException(); } } fDocumentLocked= true; } }
private void lockDocument(IProgressMonitor monitor, IJobManager jobMgr, ISchedulingRule rule) { if (rule != null) { jobMgr.beginRule(rule, monitor); } else synchronized (fDocumentAccessorLock) { while (fDocumentLocked) { try { fDocumentAccessorLock.wait(); } catch (InterruptedException e) { // nobody interrupts us! throw new OperationCanceledException(); } } fDocumentLocked= true; } }
@Override public void startup(IProgressMonitor monitor) { jobManager.beginRule(workspace.getRoot(), monitor); lock.acquire(); }
@Override public void startup(IProgressMonitor monitor) { jobManager.beginRule(workspace.getRoot(), monitor); lock.acquire(); }
@Override public void startup(IProgressMonitor monitor) { jobManager.beginRule(workspace.getRoot(), monitor); lock.acquire(); }
@Override public void run() { IJobManager manager = Job.getJobManager(); try { manager.beginRule(rule, getEventLoopMonitor()); context.run(false, false, runnable); } catch (InvocationTargetException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } catch (InterruptedException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } catch (OperationCanceledException e) { status = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, e.getMessage(), e); } finally { manager.endRule(rule); } }
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); } }
protected void trackIssues(Map<ISonarLintFile, IDocument> docPerFile, Map<ISonarLintIssuable, List<Issue>> rawIssuesPerResource, TriggerType triggerType, final IProgressMonitor monitor) { for (Map.Entry<ISonarLintIssuable, List<Issue>> entry : rawIssuesPerResource.entrySet()) { if (monitor.isCanceled()) { return; } ISonarLintFile file = (ISonarLintFile) entry.getKey(); Optional<IDocument> openedDocument = Optional.ofNullable(docPerFile.get((ISonarLintFile) file)); IDocument document = openedDocument.orElse(file.getDocument()); List<Issue> rawIssues = entry.getValue(); List<Trackable> trackables = rawIssues.stream().map(issue -> transform(issue, file, document)).collect(Collectors.toList()); IssueTracker issueTracker = SonarLintCorePlugin.getOrCreateIssueTracker(getProject()); Collection<Trackable> tracked = trackFileIssues(file, trackables, issueTracker, triggerType, rawIssuesPerResource.size()); ISchedulingRule markerRule = ResourcesPlugin.getWorkspace().getRuleFactory().markerRule(file.getResource()); try { getJobManager().beginRule(markerRule, monitor); SonarLintMarkerUpdater.createOrUpdateMarkers(file, document, tracked, triggerType, openedDocument.isPresent()); } finally { getJobManager().endRule(markerRule); } // Now that markerId are set, store issues in cache issueTracker.updateCache(file, tracked); } }
/** * An operation calls this method and it only returns when the operation is * free to run. */ public void checkIn(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { boolean success = false; try { if (workspace.isTreeLocked()) { String msg = Messages.resources_cannotModify; throw new ResourceException(IResourceStatus.WORKSPACE_LOCKED, null, msg, null); } jobManager.beginRule(rule, monitor); lock.acquire(); incrementPreparedOperations(); success = true; } finally { //remember if we failed to check in, so we can avoid check out if (!success) checkInFailed.set(Boolean.TRUE); } }
/** * An operation calls this method and it only returns when the operation is * free to run. */ public void checkIn(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { boolean success = false; try { if (workspace.isTreeLocked()) { String msg = Messages.resources_cannotModify; throw new ResourceException(IResourceStatus.WORKSPACE_LOCKED, null, msg, null); } jobManager.beginRule(rule, monitor); lock.acquire(); incrementPreparedOperations(); success = true; } finally { //remember if we failed to check in, so we can avoid check out if (!success) checkInFailed.set(Boolean.TRUE); } }
private void performOperation(IFileBuffer fileBuffer, IFileBufferOperation operation, IProgressMonitor progressMonitor) throws CoreException, OperationCanceledException { ISchedulingRule rule= fileBuffer.computeCommitRule(); IJobManager manager= Job.getJobManager(); try { manager.beginRule(rule, progressMonitor); String name= fileBuffer.getLocation().lastSegment(); progressMonitor.beginTask(name, 100); try { IProgressMonitor subMonitor= Progress.getSubMonitor(progressMonitor, 100); operation.run(fileBuffer, subMonitor); subMonitor.done(); } finally { progressMonitor.done(); } } finally { manager.endRule(rule); } }
/** * An operation calls this method and it only returns when the operation is * free to run. */ public void checkIn(ISchedulingRule rule, IProgressMonitor monitor) throws CoreException { boolean success = false; try { if (workspace.isTreeLocked()) { String msg = Messages.resources_cannotModify; throw new ResourceException(IResourceStatus.WORKSPACE_LOCKED, null, msg, null); } jobManager.beginRule(rule, monitor); lock.acquire(); incrementPreparedOperations(); success = true; } finally { //remember if we failed to check in, so we can avoid check out if (!success) checkInFailed.set(Boolean.TRUE); } }
protected void commit(final IFileBuffer[] fileBuffers, final IProgressMonitor progressMonitor) throws CoreException { IProgressMonitor monitor= Progress.getMonitor(progressMonitor); ISchedulingRule rule= computeCommitRule(fileBuffers); Job.getJobManager().beginRule(rule, progressMonitor); try { doCommit(fileBuffers, progressMonitor); } finally { Job.getJobManager().endRule(rule); monitor.done(); } }
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); } }
protected void commit(final IFileBuffer[] fileBuffers, final IProgressMonitor progressMonitor) throws CoreException { SubMonitor subMonitor= SubMonitor.convert(progressMonitor, 2); ISchedulingRule rule= computeCommitRule(fileBuffers); Job.getJobManager().beginRule(rule, subMonitor.split(1)); try { doCommit(fileBuffers, subMonitor.split(1)); } finally { Job.getJobManager().endRule(rule); } }
@Override public void run() { ILabelUpdate update = getNextUpdate(); while (update != null) { ISchedulingRule rule = getRule(update); if (!update.isCanceled()) { try { if (rule != null) { Job.getJobManager().beginRule(rule, null); } retrieveLabel(update); } catch (CoreException e) { update.setStatus(e.getStatus()); } finally { if (rule != null) { Job.getJobManager().endRule(rule); } } } update.done(); update = getNextUpdate(); } }
private void performOperation(IFileBuffer fileBuffer, IFileBufferOperation operation, IProgressMonitor progressMonitor) throws CoreException, OperationCanceledException { SubMonitor subMonitor= SubMonitor.convert(progressMonitor, 100); ISchedulingRule rule= fileBuffer.computeCommitRule(); IJobManager manager= Job.getJobManager(); manager.beginRule(rule, subMonitor.split(1)); String name= fileBuffer.getLocation().lastSegment(); subMonitor.setTaskName(name); operation.run(fileBuffer, subMonitor.split(99)); manager.endRule(rule); }