How to get a project area from a WorkItem

3 answers

Hi there,
Can anyone point me towards any docs about how to get a hold of the project area that a particular WorkItem has come from programmatically please?
Many thanks.
I'm getting there slowly with this by doing the following:
ITeamRepository repository = (ITeamRepository) handle.getOrigin();
if (repository != null) {
IWorkItemClient workItemClient = (IWorkItemClient) repository.getClientLibrary(IWorkItemClient.class);
try {
IProcessAreaHandle pah = workItemClient.findProcessArea(workItemHandle, monitor);
}
catch (TeamRepositoryException e) {
....
}
However, doing this causes me the following exception:
11:22:21,125 ERROR com.ibm.team.repository.client.util.ThreadCheck - Long-running operations prohibited on this thread
java.lang.IllegalStateException: Long-running operations prohibited on this thread
at com.ibm.team.repository.client.util.ThreadCheck.checkLongOpsAllowed(ThreadCheck.java:117)
at com.ibm.team.repository.client.internal.ServiceInterfaceProxy.invoke(ServiceInterfaceProxy.java:81)
at $Proxy0.fetchOrRefreshItems(Unknown Source)
at com.ibm.team.repository.client.internal.ItemManager$3.run(ItemManager.java:1561)
at com.ibm.team.repository.client.internal.ItemManager$3.run(ItemManager.java:1)
at com.ibm.team.repository.client.internal.TeamRepository$3.run(TeamRepository.java:1169)
at com.ibm.team.repository.common.transport.CancelableCaller.call(CancelableCaller.java:79)
at com.ibm.team.repository.client.internal.TeamRepository.callCancelableService(TeamRepository.java:1162)
at com.ibm.team.repository.client.internal.TeamPlatformObject.callCancelableService(TeamPlatformObject.java:41)
at com.ibm.team.repository.client.internal.ItemManager.internalFetchItem(ItemManager.java:1556)
at com.ibm.team.repository.client.internal.ItemManager.access$0(ItemManager.java:1538)
at com.ibm.team.repository.client.internal.ItemManager$AbstractStore.retrieveItem(ItemManager.java:186)
at com.ibm.team.repository.client.internal.ItemManager$CurrentStore.fetchItem(ItemManager.java:311)
at com.ibm.team.repository.client.internal.ItemManager.fetchPartialItem(ItemManager.java:1059)
at com.ibm.team.workitem.client.internal.AuditableClient.resolveAuditable(AuditableClient.java:131)
at com.ibm.team.workitem.common.internal.WorkItemCommon.findProcessArea(WorkItemCommon.java:760)
......
Any advice/doc on how I should be doing this to avoid getting this exception please?
Thanks,

On Thu, 03 Jun 2010 10:38:03 +0000, smithsj wrote:
What you're seeing here is code which prevents you from performing
network operations in the UI thread. We require that all network requests
are made in background threads in order to keep the UI responsive.
The most common way to get code into background threads is to use a Job
(org.eclipse.core.runtime.jobs.Job).
- Jared
11:22:21,125 ERROR
com.ibm.team.repository.client.util.ThreadCheck - Long-running
operations prohibited on this thread
java.lang.IllegalStateException: Long-running operations prohibited on
this thread
What you're seeing here is code which prevents you from performing
network operations in the UI thread. We require that all network requests
are made in background threads in order to keep the UI responsive.
The most common way to get code into background threads is to use a Job
(org.eclipse.core.runtime.jobs.Job).
- Jared