|
28 | 28 | import org.eclipse.core.runtime.IProgressMonitor; |
29 | 29 | import org.eclipse.core.runtime.IStatus; |
30 | 30 | import org.eclipse.core.runtime.Status; |
| 31 | +import org.eclipse.core.runtime.SubMonitor; |
31 | 32 | import org.eclipse.egit.github.core.Comment; |
32 | 33 | import org.eclipse.egit.github.core.IRepositoryIdProvider; |
33 | 34 | import org.eclipse.egit.github.core.Issue; |
@@ -287,7 +288,7 @@ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, T |
287 | 288 | List<String> statuses = QueryUtils.getAttributes( |
288 | 289 | IssueService.FILTER_STATE, query); |
289 | 290 |
|
290 | | - monitor.beginTask(Messages.IssueConector_TaskQuerying, statuses.size()); |
| 291 | + SubMonitor subMonitor = SubMonitor.convert(monitor, Messages.IssueConector_TaskQuerying, statuses.size() * 100); |
291 | 292 | try { |
292 | 293 | RepositoryId repo = GitHub.getRepository(repository.getRepositoryUrl()); |
293 | 294 |
|
@@ -324,28 +325,32 @@ public IStatus performQuery(TaskRepository repository, IRepositoryQuery query, T |
324 | 325 | String name = repo.getName(); |
325 | 326 | for (String status : statuses) { |
326 | 327 | filterData.put(IssueService.FILTER_STATE, status); |
| 328 | + SubMonitor statusMonitor = subMonitor.split(100); |
| 329 | + statusMonitor.setTaskName(status + Messages.IssueConnector_LabelIssues); |
327 | 330 | List<Issue> issues = service.getIssues(repo.getOwner(), repo.getName(), filterData); |
| 331 | + statusMonitor.checkCanceled(); |
328 | 332 |
|
329 | 333 | // collect task data |
| 334 | + statusMonitor.setWorkRemaining(issues.size()); |
330 | 335 | for (Issue issue : issues) { |
331 | | - if (isPullRequest(issue)) { |
332 | | - continue; |
| 336 | + if (!isPullRequest(issue)) { |
| 337 | + List<Comment> comments = null; |
| 338 | + if (issue.getComments() > 0) { |
| 339 | + comments = service.getComments(owner, name, Integer.toString(issue.getNumber())); |
| 340 | + } |
| 341 | + TaskData taskData = taskDataHandler.createTaskData(repository, statusMonitor, owner, name, |
| 342 | + issue, comments); |
| 343 | + collector.accept(taskData); |
333 | 344 | } |
334 | | - List<Comment> comments = null; |
335 | | - if (issue.getComments() > 0) { |
336 | | - comments = service.getComments(owner, name, Integer.toString(issue.getNumber())); |
337 | | - } |
338 | | - TaskData taskData = taskDataHandler.createTaskData( |
339 | | - repository, monitor, owner, name, issue, comments); |
340 | | - collector.accept(taskData); |
| 345 | + statusMonitor.split(1); |
341 | 346 | } |
342 | | - monitor.worked(1); |
| 347 | + statusMonitor.done(); |
343 | 348 | } |
344 | 349 | } catch (IOException e) { |
345 | 350 | result = GitHub.createWrappedStatus(e); |
| 351 | + } finally { |
| 352 | + subMonitor.done(); |
346 | 353 | } |
347 | | - |
348 | | - monitor.done(); |
349 | 354 | return result; |
350 | 355 | } |
351 | 356 |
|
|
0 commit comments