Howto programmatically add a comment [message #53554] |
Sat, 19 July 2008 19:37 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
This is a multi-part message in MIME format.
--------------090503030200090300000409
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
Hi,
After a long trial and error phase I managed to list all comments of a
selected task:
| ITaskDataManager taskDataManager = TasksUi.getTaskDataManager();
IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
ITask task = (ITask)((IStructuredSelection)selection).getFirstElement();
ITaskDataWorkingCopy taskDataState = taskDataManager.getWorkingCopy(task);
TaskRepository taskRepository = repositoryManager.getRepository(taskDataState.getConnectorKi nd(), taskDataState
.getRepositoryUrl());
TaskDataModel model = *new *TaskDataModel(taskRepository, task, taskDataState);
TaskData taskData = model.getTaskData();
TaskAttributeMapper attributeMapper = taskData.getAttributeMapper();
List<TaskAttribute> comments = attributeMapper.getAttributesByType(taskData, TaskAttribute.TYPE_COMMENT);
*for *(TaskAttribute commentAttribute : comments)
{
System.out.println(commentAttribute.getId());
TaskAttribute textAttribute = commentAttribute.getMappedAttribute(TaskAttribute.COMMENT_TE XT);
System.out.println(textAttribute.getValue());
}|
How can I programmatically add a comment?
Cheers
/Eike
--------------090503030200090300000409
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hi,<br>
<br>
After a long trial and error phase I managed to list all comments of a
selected task:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">
|
|
|
Re: Howto programmatically add a comment [message #53608 is a reply to message #53554] |
Sun, 20 July 2008 07:12 |
Eclipse User |
|
|
|
Originally posted by: stepper.sympedia.de
This is a multi-part message in MIME format.
--------------050403080400020903000101
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
I'm so happy that I found it myself:
| TaskAttribute root = taskData.getRoot();
TaskAttribute commentAttribute = root.createMappedAttribute(TaskAttribute.COMMENT_NEW);
commentAttribute.setValue("HURRAH!!!");|
Thanks for your great tool ;-)
/Eike
Eike Stepper schrieb:
> Hi,
>
> After a long trial and error phase I managed to list all comments of a
> selected task:
>
> | ITaskDataManager taskDataManager = TasksUi.getTaskDataManager();
> IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
>
> ITask task = (ITask)((IStructuredSelection)selection).getFirstElement();
> ITaskDataWorkingCopy taskDataState = taskDataManager.getWorkingCopy(task);
> TaskRepository taskRepository = repositoryManager.getRepository(taskDataState.getConnectorKi nd(), taskDataState
> .getRepositoryUrl());
>
> TaskDataModel model = *new *TaskDataModel(taskRepository, task, taskDataState);
> TaskData taskData = model.getTaskData();
> TaskAttributeMapper attributeMapper = taskData.getAttributeMapper();
>
> List<TaskAttribute> comments = attributeMapper.getAttributesByType(taskData, TaskAttribute.TYPE_COMMENT);
> *for *(TaskAttribute commentAttribute : comments)
> {
> System.out.println(commentAttribute.getId());
> TaskAttribute textAttribute = commentAttribute.getMappedAttribute(TaskAttribute.COMMENT_TE XT);
> System.out.println(textAttribute.getValue());
> }|
>
>
> How can I programmatically add a comment?
>
> Cheers
> /Eike
>
>
--------------050403080400020903000101
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I'm so happy that I found it myself:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">
|
|
|
Re: Howto programmatically add a comment [message #591533 is a reply to message #53554] |
Sun, 20 July 2008 07:12 |
|
This is a multi-part message in MIME format.
--------------050403080400020903000101
Content-Type: text/plain; charset=ISO-8859-15; format=flowed
Content-Transfer-Encoding: 7bit
I'm so happy that I found it myself:
| TaskAttribute root = taskData.getRoot();
TaskAttribute commentAttribute = root.createMappedAttribute(TaskAttribute.COMMENT_NEW);
commentAttribute.setValue("HURRAH!!!");|
Thanks for your great tool ;-)
/Eike
Eike Stepper schrieb:
> Hi,
>
> After a long trial and error phase I managed to list all comments of a
> selected task:
>
> | ITaskDataManager taskDataManager = TasksUi.getTaskDataManager();
> IRepositoryManager repositoryManager = TasksUi.getRepositoryManager();
>
> ITask task = (ITask)((IStructuredSelection)selection).getFirstElement();
> ITaskDataWorkingCopy taskDataState = taskDataManager.getWorkingCopy(task);
> TaskRepository taskRepository = repositoryManager.getRepository(taskDataState.getConnectorKi nd(), taskDataState
> .getRepositoryUrl());
>
> TaskDataModel model = *new *TaskDataModel(taskRepository, task, taskDataState);
> TaskData taskData = model.getTaskData();
> TaskAttributeMapper attributeMapper = taskData.getAttributeMapper();
>
> List<TaskAttribute> comments = attributeMapper.getAttributesByType(taskData, TaskAttribute.TYPE_COMMENT);
> *for *(TaskAttribute commentAttribute : comments)
> {
> System.out.println(commentAttribute.getId());
> TaskAttribute textAttribute = commentAttribute.getMappedAttribute(TaskAttribute.COMMENT_TE XT);
> System.out.println(textAttribute.getValue());
> }|
>
>
> How can I programmatically add a comment?
>
> Cheers
> /Eike
>
>
--------------050403080400020903000101
Content-Type: text/html; charset=ISO-8859-15
Content-Transfer-Encoding: 8bit
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-15"
http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
I'm so happy that I found it myself:<br>
<br>
<title></title>
<style type="text/css">
<!--code { font-family: Courier New, Courier; font-size: 10pt; margin: 0px; }-->
</style>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!-- ======================================================== -->
<!-- = Java Sourcecode to HTML automatically converted code = --><!-- = Java2Html Converter 5.0 [2006-02-26] by Markus Gebhard markus@jave.de = -->
<!-- = Further information: http://www.java2html.de = -->
<div class="java" align="left">
<table bgcolor="#ffffff" border="0" cellpadding="3" cellspacing="0">
<tbody>
<tr>
<!-- start source code --> <td align="left" nowrap="nowrap"
valign="top"> <code><font color="#ffffff">
Cheers
/Eike
----
http://www.esc-net.de
http://thegordian.blogspot.com
http://twitter.com/eikestepper
|
|
|
Powered by
FUDForum. Page generated in 0.03076 seconds