Getting the value for comments from a ResolvedWorkItem?
My code obtains the value for various attributes from a ResolvedWorkItem, based on their respective attribute ids. The following logic generally works fine:
WorkItemUIWorkingCopy uiCopy = (WorkItemUIWorkingCopy) myWorkItemWorkingCopy.getAdapter(IWorkItemUIWorkingCopy.class); However, getValue() throws an exception if the attribute id is "internalComments" (the id for the comments field): org.eclipse.core.runtime.AssertionFailedException: assertion failed: at org.eclipse.core.runtime.Assert.isTrue(Assert.java:110) at org.eclipse.core.runtime.Assert.isTrue(Assert.java:96) at com.ibm.team.workitem.client.internal.util.ResolvedWorkItem.getValue(ResolvedWorkItem.java:181) I've confirmed that the attribute exists within the work item (that is, workItem.findAttribute("internalComments") returns a non-null result, and calling getAttributeType on it returns the value "comments"). What is the right way to get the value for the comments? Thanks! Roger |
One answer
There is a get specific to comments -
IComment[] comments = iWorkItem.getComments().getContents(); From there you can get the creator / data / description of each comment. |
Your answer
Dashboards and work items are no longer publicly available, so some links may be invalid. We now provide similar information through other means. Learn more here.