It's all about the answers!

Ask a question

How to read project name in AttributePart


Baris Erdemir (1812819) | asked Mar 09 '11, 2:50 a.m.
Hi,
I am extending com.ibm.team.workitem.ide.ui.internal.editor.presentations.AttributePart
I have IProjectAreaHandle but I cannot get IProjectArea
Can you please help me getting IProjectArea from IProjectAreaHandle?
I would like to read project Area name.
Thanks,

4 answers



permanent link
Qiong Feng Huang (76911610) | answered Mar 09 '11, 2:50 a.m.
JAZZ DEVELOPER
If your code is in server side, you can use:
IRepositoryItemService.fetchItem() to get the project area.
If your code is in eclipse client side, you can use
IItemManager.fetchCompleteItems() to get the project area. You can use
ITeamRepository.itemManager() to get the item manager instance.

permanent link
Baris Erdemir (1812819) | answered Mar 14 '11, 4:52 a.m.
If your code is in server side, you can use:
IRepositoryItemService.fetchItem() to get the project area.
If your code is in eclipse client side, you can use
IItemManager.fetchCompleteItems() to get the project area. You can use
ITeamRepository.itemManager() to get the item manager instance.

Hi,
Thanks for the answer but I still cannot fill the gaps. I am rephrasing my question:
I am in client side and extending presentation pf a workitem attribute
(com.ibm.team.workitem.ide.ui.internal.editor.presentations.AttributePart )
What I need is to read the name of project area.
I am able to get IProjectAreaHandle.
I am asking an example of reading project area name from IProjectAreaHandle.

Below is my method that gets IProjectAreaHandle:


private String getProjectAreaName() {

String projectAreaName = "";
IAttribute ia = getAttribute();
IProjectAreaHandle ph = ia.getProjectArea();
//set projectAreaName
return projectAreaName;
}

permanent link
Andre Weinand (4811) | answered Mar 15 '11, 7:42 a.m.
Hi,

Whenever you have a handle, you will have to resolve it to the real thing before you can get its attributes. This was explained two weeks ago.
So in your case resolve the IProjectAreaHandle to a IProjectArea and then use the getName() method.

--andre


Andre Weinand
Work Item Team

permanent link
Baris Erdemir (1812819) | answered Mar 16 '11, 2:52 a.m.
Hi Andre thanks for your effort but my question was how to resolve IProjectAreaHandle to a IProjectArea.
Here is the answer we found by digging the API:
fWorkingCopy is WorkItemEditorInput's working copy.

private String getComponentName() {

ITeamRepository tRepo = fWorkingCopy.getTeamRepository();
IAttribute ia = getAttribute();
IProjectAreaHandle ph = ia.getProjectArea();
IItemManager im = tRepo.itemManager();
IProjectArea pa = (IProjectArea)im.fetchCompleteItem(ph, 0, null);
return pa.getName();
}

Your answer


Register or to post 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.