Source:
protected IStatus run(IProgressMonitor monitor) { HashSet<ITask> relevantTasks = new HashSet<ITask>(); IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow workbenchWindow : workbenchWindows) { IWorkbenchPage[] workbenchPages = workbenchWindow.getPages(); for (IWorkbenchPage workbenchPage : workbenchPages) { IEditorReference[] editorReferences = workbenchPage.getEditorReferences(); for (IEditorReference editorReference : editorReferences) { IEditorPart editorPart = editorReference.getEditor(false); if (editorPart instanceof TaskEditor) { ITask task = ((TaskEditor) editorPart).getTaskEditorInput().getTask(); relevantTasks.add(task); } } } } relevantTasks.add(taskActivityManager.getActiveTask()); Set<ITask> dueTasks = taskActivityManager.getScheduledTasks(TaskActivityUtil.getCurrentWeek().getToday()); relevantTasks.addAll(dueTasks); ListMultimap<TaskRepository, ITask> repositoryMap = ArrayListMultimap.create(); for (ITask task : relevantTasks) { String connectorKind = task.getConnectorKind(); String repositoryUrl = task.getRepositoryUrl(); TaskRepository taskRepository = repositoryManager.getRepository(connectorKind, repositoryUrl); repositoryMap.put(taskRepository, task); } for (TaskRepository taskRepository : repositoryMap.keySet()) { List<ITask> repositoryTasks = repositoryMap.get(taskRepository); AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(taskRepository.getConnectorKind()); taskJobFactory.createSynchronizeTasksJob(connector, taskRepository, new HashSet<>(repositoryTasks)) .schedule(); } return Status.OK_STATUS; }

Target:
protected IStatus run(IProgressMonitor monitor) { HashSet<ITask> relevantTasks = new HashSet<ITask>(); IWorkbenchWindow[] workbenchWindows = PlatformUI.getWorkbench().getWorkbenchWindows(); for (IWorkbenchWindow workbenchWindow : workbenchWindows) { IWorkbenchPage[] workbenchPages = workbenchWindow.getPages(); for (IWorkbenchPage workbenchPage : workbenchPages) { IEditorReference[] editorReferences = workbenchPage.getEditorReferences(); for (IEditorReference editorReference : editorReferences) { IEditorPart editorPart = editorReference.getEditor(false); if (editorPart instanceof TaskEditor) { TaskEditorInput taskEditorInput = ((TaskEditor) editorPart).getTaskEditorInput(); if (taskEditorInput.exists()) { relevantTasks.add(taskEditorInput.getTask()); } } } } } ITask activeTask = taskActivityManager.getActiveTask(); if (activeTask != null) { relevantTasks.add(activeTask); } Set<ITask> dueTasks = taskActivityManager.getScheduledTasks(TaskActivityUtil.getCurrentWeek().getToday()); relevantTasks.addAll(dueTasks); ListMultimap<TaskRepository, ITask> repositoryMap = ArrayListMultimap.create(); for (ITask task : relevantTasks) { if (!(task instanceof LocalTask)) { String connectorKind = task.getConnectorKind(); String repositoryUrl = task.getRepositoryUrl(); TaskRepository taskRepository = repositoryManager.getRepository(connectorKind, repositoryUrl); repositoryMap.put(taskRepository, task); } } for (TaskRepository taskRepository : repositoryMap.keySet()) { List<ITask> repositoryTasks = repositoryMap.get(taskRepository); AbstractRepositoryConnector connector = TasksUi.getRepositoryConnector(taskRepository.getConnectorKind()); taskJobFactory.createSynchronizeTasksJob(connector, taskRepository, new HashSet<>(repositoryTasks)) .schedule(); } return Status.OK_STATUS; }