ITask is an object that holds just sufficient information to display and
filter the task in the Task List, TaskData is a container that holds everything
to be displayed in the Rich Task Editor. This Task Editor is different for each
kind of repository.
A new Task starts life as a local task (which it is it has not yet been
synchronized), but with the intended repository included as an attribute. Upon
synchronization it changes into a task for that specific repository and gets
form the repository its unique ID.
public void testProgrammaticCreation() {
try {
assertNotNull("repository null", repository);
ITask newTask =
TasksUiUtil.createOutgoingNewTask(CONNECTOR_KIND, REPOSITORY_URL);
assertNotNull("Task
creation failed", newTask);
assertNotNull("Task
creation failed - ID", newTask.getTaskId());
MyAttributeMapper mapper = new MyAttributeMapper(repository);
assertNotNull("Mapper creation failed", mapper);
TaskData data = ""
style="COLOR: #7f0055">new TaskData(mapper,CONNECTOR_KIND, REPOSITORY_URL, newTask
.getTaskId());
assertNotNull("TaskData creation failed", mapper);
boolean
success = connector.getTaskDataHandler().initializeTaskData(repository, data,
new
DefaultTaskMapping(), new
NullProgressMonitor());
assertTrue("TaskData not
initialized", success);
Map<String, TaskAttribute> dataAttributes
= data.getRoot().getAttributes();
assertNotNull("TaskData no attributes", dataAttributes);
System.out.println(dataAttributes.toString());
Map<String, String> taskAttributes =
newTask.getAttributes();
assertNotNull("TaskData no attributes", taskAttributes);
System.out.println(taskAttributes.toString());
} catch
(CoreException e) {
fail(e.getMessage());
}
}
You need the taskdata to have things show up in the
editor.
Maarten
Hi all,
I´m
currently trying to trigger creation of tasks programmatically through the
mylyn api. I succeeded in creating local tasks in the local repository, but
failed for any other repository (I tried bugzilla,but my guess is that similar
issues will happen with other repositories as well). I think I´m struggling a
bit with the difference between ITask and TaskData.
The issues I faced were:
- The task initially was shown in the
"uncategorized" container rather than the "unsubmitted" container for the
bugzilla repository. I think this issue can be solved by manually putting
the task there. The interesting thing is that after a restart of eclipse,
the task is moved there automatically ;-)
- Opening the task editor for this task fails and
shows an empty bugzilla page. Debugging into the code I recognized that
there is a NPE because the editor tries to access the TaskData of the task
which does not exist.
Currently, I´m using the API
TasksUiUtil.createOutgoingNewTask() to
create the task. Could you give me some advises on this topic? Especially on
the handling of ITask and TaskData. Is it at all possible to create tasks for
various repositories using the mentioned way?
Thanks in advance,
Stefan
_______________________________________________
mylyn-integrators
mailing list
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators