@Override
  public void selectionChanged(IAction action, ISelection selection) {
    super.selectionChanged(action, selection);

    task = null;

    if (selection instanceof IStructuredSelection) {

      IStructuredSelection ss = (IStructuredSelection) selection;

      if (!ss.isEmpty()) {

        Iterator<?> iter = ss.iterator();
        while (iter.hasNext()) {
          Object sel = iter.next();
          if (sel instanceof IJiraTask) {
            task = ((IJiraTask) sel).getTask();
            try {
              taskData = TasksUiPlugin.getTaskDataManager().getTaskData(task);
            } catch (CoreException e) {
              handleError(
                  Messages.JiraConnectorUiActions_Cannot_get_task_data + task.getTaskKey(), e);
            }

            break;
          }
        }
      }
    }

    update(action);
  }
示例#2
0
 public ITask getTask(String taskId) throws Exception {
   TaskRepository repository = repository();
   TaskData taskData = fixture.connector().getTaskData(repository, taskId, null);
   ITask task = TasksUi.getRepositoryModel().createTask(repository, taskData.getTaskId());
   TasksUiPlugin.getTaskDataManager().putUpdatedTaskData(task, taskData, true);
   return task;
 }