It's all about the answers!

Ask a question

Open and view work item - programmatically?


Benjamin Stadin (11) | asked Aug 20 '08, 9:47 a.m.
Hi,

I need to open and view a work item in code. What I'm actually trying to do is to link a work item with associated information of my own application, when clicked on this information element the associated work item should open.

Could somebody provide me pointers or even an code example for this?

Ben

7 answers



permanent link
Arun Batra (14612427) | answered Nov 02 '11, 9:13 a.m.
I understand that this is an old post, I would be very grateful if you could hint to how can one get the IWorkbenchPart targetPart in the code that you mentioned.

Warm Regards,
Arun



import com.ibm.team.workitem.rcp.ui.WorkItemUI;

...
WorkItemUI.openEditor(targetPart.getSite().getPage(), wi);



permanent link
Ralph Schoon (63.7k33647) | answered Aug 20 '08, 9:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hello Ben,

I am just starting to have a look st the extensibility side, so this might
be not sufficient.

In the Team Wiki, you can find the RTC SDK https://jazz.net/wiki/bin/view/Main/RtcSdk

There are several options one comes with some samples e.g. java libraries
and classes to access RTC without being in an Eclipse environment.
The SDK also pints to the sourcecode for RTC which should allow you to locate
plugins that do what you try to from within the server as well as a client.

Ralph

Hi,

I need to open and view a work item in code. What I'm actually trying
to do is to link a work item with associated information of my own
application, when clicked on this information element the associated
work item should open.

Could somebody provide me pointers or even an code example for this?

Ben

permanent link
Ralph Schoon (63.7k33647) | answered Aug 20 '08, 9:47 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER
Hello Ben,

this is actually extending Eclipse then.

I haven't seen any examples. Assuming you know how Eclipse extensibility
works I'd download the client source, browse the extension points, defined
views and context menus and try to figure the external API. Sorry but I am
not that far either. Maybe someone of the Jazz team has a better answer.

In the Team Wiki, you can find the RTC SDK

https://jazz.net/wiki/bin/view/Main/RtcSdk

Hi Ralph,

thanks for your reply. I was looking at these examples before, but I

need to open the work item view and the editor for a specific
customized work item. The user should see the same UI as he does when
he edits the work item in the project area.

Ben

permanent link
Benjamin Stadin (11) | answered Aug 20 '08, 11:06 a.m.

In the Team Wiki, you can find the RTC SDK https://jazz.net/wiki/bin/view/Main/RtcSdk


Hi Ralph,

thanks for your reply. I was looking at these examples before, but I need to open the work item view and the editor for a specific customized work item. The user should see the same UI as he does when he edits the work item in the project area.

Ben

permanent link
Pat McCarthy (12152) | answered Aug 20 '08, 2:54 p.m.
JAZZ DEVELOPER
I'm not sure if I've understood your goal completely - but one or two pointers.

First, I'm assuming you're working in an IDE where the Jazz/RTC RCP Client is active. If opening a work item in the RCP editor is your goal - this is the key bit of code I've found/used for some experiments:

import com.ibm.team.workitem.rcp.ui.WorkItemUI;

...
WorkItemUI.openEditor(targetPart.getSite().getPage(), wi);


In my code the wi is a ref to an IWorkItem object; but digging into the Jazz/RTC RCP code it can be most anything.
This logic is used to interpret the object passed to get to the work item that is to be opened.

public static IWorkItemHandle getWorkItemHandle(Object object) {


if (object == null)
return null;

// TODO: use registry
if (object instanceof IWorkItemHandle)
return (IWorkItemHandle) object;

if (object instanceof WorkItemEditorHistoryEntry) {
WorkItemEditorHistoryEntry entry= (WorkItemEditorHistoryEntry) object;
return entry.getWorkItem();
}

if (object instanceof ResolvedWorkItem)
return ((ResolvedWorkItem) object).getWorkItem();

// registry

if (object instanceof IAdaptable) {
IAdaptable a= (IAdaptable) object;
return (IWorkItemHandle) a.getAdapter(IWorkItemHandle.class);
}

IAdapterManager manager= Platform.getAdapterManager();
return (IWorkItemHandle) manager.getAdapter(object, IWorkItemHandle.class);
}


Note that the WorkItemUI class also has a show method:
showWorkItems(IWorkbenchWindow window, String title, IWorkItemHandle[] workItems)


Given show is more common for a view target, I expect this to result in the work items view being made visible with the passed content displayed. I've not called that method yet - but will be trying it soon as supporting this type of gesture is on my list of 'experiments' to run soon.

If the assumptions I started with are invalid - please explain your goal in more detail.

Good luck

permanent link
Christof Marti (681) | answered Aug 21 '08, 3:30 a.m.
That should work as you describe. If your goal is to change the work item on the client without saving it and opening it in the editor for the user to review the changes you can use a WorkItemUIOperation as described in https://jazz.net/wiki/bin/view/Main/ProgrammaticWorkItemCreation.

Regards,

Christof
Jazz Work Item team

permanent link
Benjamin Stadin (11) | answered Aug 21 '08, 7:59 a.m.
Thanks for the input, I will give Pat's idea a try.

I'll try to explain briefly what I want to do. I have two different kinds of applications, a business logic application and N engineering applications. An engineering application can be anything, a software project, a workspace just for reviewing requirements, a SYSML impact analyzer, whatsoever.
In my business application I have my own UI and the application is connected to a "requirements backbone" (several tools, analyzers, Telelogic DOORS, etc.).

What I'm now here trying to do for a start is to create a customized work item (a "Top Level Requirement") programmatically in my business application, and link the item ID to some attribute in my business app. When the attribute is clicked, the RTC work item editor for my customized work item should open. But I actually dont't want the complete RTC client in this app.

This work item is associated to any other project (that can be any kind of "engineering application" as described above). So this "Top Level Requirement") is then shown in a certain project area.

Ben

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.