Jazz Forum Welcome to the Jazz Community Forum Connect and collaborate with IBM Engineering experts and users

How to read project name in AttributePart

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,

0 votes



4 answers

Permanent link
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();
}

0 votes


Permanent link
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

0 votes


Permanent link
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;
}

0 votes


Permanent link
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.

0 votes

Your answer

Register or log in 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.

Search context
Follow this question

By Email: 

Once you sign in you will be able to subscribe for any updates here.

By RSS:

Answers
Answers and Comments
Question details
× 10,943

Question asked: Mar 09 '11, 2:50 a.m.

Question was seen: 6,446 times

Last updated: Mar 09 '11, 2:50 a.m.

Confirmation Cancel Confirm