Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [mylyn-integrators] How to get TaskData?

Thanks alot Rob.

In the wait for the answer, I did the following:

In updateTaskFromTaskData(repository, task, taskData), I created an AbstractTask of this task and set the secheduledForDate, estimatedTimeHours and notes and this made the data show on the taskEditor and be update-able. Even though this solved my problem I did not feel that that was they way this was intended to be done. First because I had to use an internal class and second because I could set the DueDate through the TaskMapper. So my updateTaskFromTaskData() looks as follows:

@Override
public void updateTaskFromTaskData(TaskRepository repository, ITask task, TaskData taskData) {
       TaskMapper mapper = new TaskMapper(taskData);
       mapper.setDescription(taskData.getRoot().getAttribute(DESCRIPTION).getValue());
       mapper.setDueDate(extractTime(taskData.getRoot().getAttribute(DUE_DATE).getValue()));
       mapper.applyTo(task);

      // TODO Find a substitute for using AbstractTask
       AbstractTask aTask = (AbstractTask) task;
       aTask.setEstimatedTimeHours(taskData.getRoot().getAttribute(ESTIMATED_HOURS).getValue());
       aTask.setNotes(taskData.getRoot().getAttribute(DESCRIPTION).getValue());
       aTask.setScheduledForDate(taskData.getRoot().getAttribute(SCHEDULED_FOR_DATE).getValue());
}

I checked TaskEditorPlanningPart and it looks to me that it is using a similar way, aka it sets the data in an AbstractTask-version of the task through TasksUiPlugin.getTaskActivityManager() which HAS TO take an AbstractTask as a parameter. So if I use the same way and since TasksUiPlugin itself is an internal class, I end up using 2 internal classes instead of one, which feels even more wrong.

Am I missing something? Or this is actually the only way to go?

Best regards,
Avin

________________________________________
From: mylyn-integrators-bounces@xxxxxxxxxxx [mylyn-integrators-bounces@xxxxxxxxxxx] On Behalf Of Robert Elves [rob.elves@xxxxxxxxxxx]
Sent: Monday, July 28, 2008 5:57 PM
To: Mylyn Integrators list
Subject: Re: [mylyn-integrators] How to get TaskData?

Hi Avin,

Have a look at TaskEditorPlanningPart to get an idea for how these
fields are accessed and manipulated. Some of these fields are internal
so you may need to break some 'rules' to manipulate them. In these
cases, look for an existing api bug or create a new one, to address your
specific needs.

-Rob

Avin Ismail wrote:
> Thank you for the clarification Rob. TasksUi.getTaskData.getTaskDataManager().getTaskData(taskRepository, taskId) actually works fine for me.
>
> Do you allso happen to know where the taskEditorn gets its data from (ex. scheduled for, due, estimated hours...ect)?
>
> /Avin
> ________________________________________
> From: mylyn-integrators-bounces@xxxxxxxxxxx [mylyn-integrators-bounces@xxxxxxxxxxx] On Behalf Of Robert Elves [rob.elves@xxxxxxxxxxx]
> Sent: Sunday, July 27, 2008 6:58 PM
> To: Mylyn Integrators list
> Subject: Re: [mylyn-integrators] How to get TaskData?
>
> Yes, this is a problem. Although the TaskDataManager lies in the
> tasks.core package, it is initialized and its instance held by the
> tasks.ui.TasksUiPlugin.  Same goes for the tasklist itself. If you could
> create a new bug report and prefix the summary with "[api]" we can
> discuss options there. In the mean time you'll need to add a dependency
> on tasks.ui to get access to these facilities.
>
> -Rob
>
>
> Beyhan Veliev wrote:
>
>> Hi Robert,
>>
>>
>>> TasksUi.getTaskData.getTaskDataManager().getTaskData(taskRepository,
>>>
>> taskId)
>> It works fine but I have a "core" and a "ui" plugin. I want to
>> separate the "ui" and the "core" functionality. My
>> "RepositoryConnector" is in my "core" plugin which depends only on
>> "org.eclipse.mylyn.tasks.core". I don't want to have dependency on
>> "org.eclipse.mylyn.tasks.ui" in my "core" plugin but in the APIs of
>> "org.eclipse.mylyn.tasks.core" I haven't found the functionality to
>> get a task or taskdata of its id.
>>
>> Best regards and thank you
>> Beyhan
>>
>> Robert Elves wrote:
>>
>>> Hi Beyhan,
>>>
>>> Given a taskRepository and taskId, you can get the associated
>>> TaskData via:
>>>
>>>  TasksUi.getTaskData.getTaskDataManager().getTaskData(taskRepository,
>>> taskId)
>>>
>>> -Rob
>>>
>>>
>>> Beyhan Veliev wrote:
>>>
>>>> Hello,
>>>>
>>>> I am writing a new connector for Mylyn 3.0 and Eclipse 3.4 and I
>>>> have the same challenge in getTaskData(repository, taskid,
>>>> iprogressMonitor). I need to find the existing task or its taskdata
>>>> for the passed taskid and I should use only the APIs of
>>>> "org.eclipse.mylyn.tasks.core".  I haven't found a way to do this.
>>>> Is it possible?
>>>> @Ismail: How can you retrieve the task with the specified taskid?
>>>>
>>>> Thank you in advance
>>>> Beyhan
>>>>
>>>> Avin Ismail wrote:
>>>>
>>>>> Hello,
>>>>>
>>>>> How can I extract the TaskData of a specific task? I am trying to
>>>>> implement getTaskData(repository, taskId, iprogressMonitor) that
>>>>> has to
>>>>> return a TaskData. Now I can retrieve the task with the specified
>>>>> taskId,
>>>>> but how can I get the TaskData of that task?
>>>>>
>>>>> FYI:
>>>>> in PerformQuery(), I followed the example on
>>>>> http://wiki.eclipse.org/Mylyn/Porting_Guide/3.0 and created the
>>>>> task as
>>>>> follows:
>>>>>
>>>>> TaskData data = createTaskData(repository, id);
>>>>> TaskMapper mapper = new TaskMapper(data, true);
>>>>> mapper.setTaskUrl(taskPrefix + id);
>>>>> mapper.setSummary(description);
>>>>> mapper.setCreationDate(creationDate);
>>>>> mapper.setDueDate(dueDate);
>>>>> resultCollector.accept(data);
>>>>>
>>>>> Thank you in advance
>>>>> Avin
>>>>>
>>>>> _______________________________________________
>>>>> mylyn-integrators mailing list
>>>>> mylyn-integrators@xxxxxxxxxxx
>>>>> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
>>>>>
>>>>>
>>>>>
>>>> _______________________________________________
>>>> mylyn-integrators mailing list
>>>> mylyn-integrators@xxxxxxxxxxx
>>>> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
>>>>
>>>>
>>>
>> _______________________________________________
>> mylyn-integrators mailing list
>> mylyn-integrators@xxxxxxxxxxx
>> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
>>
>>
>
>
> --
> Robert Elves
> Mylyn Committer, http://eclipse.org/mylyn
>
> _______________________________________________
> mylyn-integrators mailing list
> mylyn-integrators@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
> _______________________________________________
> mylyn-integrators mailing list
> mylyn-integrators@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/mylyn-integrators
>
>


--
Robert Elves
Mylyn Committer, http://eclipse.org/mylyn

_______________________________________________
mylyn-integrators mailing list
mylyn-integrators@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/mylyn-integrators


Back to the top