It's all about the answers!

Ask a question

How to get the current work item programmatically?


S M (8622023) | asked Nov 23 '12, 3:36 p.m.
I'm looking for a way to extend the RTC client to get the current work item programmatically, or even better add a listener that notifies me whenever the current work item is changed.

I don't know where to start. Any hints?

3 answers



permanent link
sam detweiler (12.5k6195201) | answered Nov 23 '12, 5:21 p.m.
far as I know, there is no general purpose listener chain you can use.

the code to save a workitem is in the com.ibm.team.workitem.client jar,

com.ibm.team.workitem.client.internal.WorkitemClient.java

to view the source for any plugin jar,   use the Plugins view of the Plugins Perspective,,
find the plugin of interest, and right mouse button, select Import as Source

then u have the full compilable plugin jar file source and build process.

Comments
S M commented Nov 23 '12, 5:38 p.m.

Thanks, I tried this. However, the projects that are loaded are always empty (no code, just one jar), and com.ibm.team.workitem.client.internal is not even available.


sam detweiler commented Nov 23 '12, 7:54 p.m.

you have to download the source zip and configure the plugin path to get the source to deploy for plugins..

thats in the Eclipse ui menu, Windows, Preferences, Plugins, target Platform


Ralph Schoon commented Nov 26 '12, 2:28 a.m.
FORUM ADMINISTRATOR / FORUM MODERATOR / JAZZ DEVELOPER

See the Extensions workshop for how to set up for development.


permanent link
Filip Wieladek (30413) | answered Nov 26 '12, 9:12 a.m.
 Hi S M,

It is indeed possible to get a listener for the work item activation. Please look at the method:

com.ibm.team.workitem.rcp.core.ClientModel.getWorkItemActivationManager()

That static method will return you an instance of an IWorkItemActivationManager which manages the active (current) work item status. If you just want to get the currently active workitem you can use the method com.ibm.team.workitem.rcp.core.activation.IWorkItemActivationManager.getActiveWorkItem(). Otherwise, you can register a listener by calling com.ibm.team.workitem.rcp.core.activation.IWorkItemActivationManager.addActivationParticipant(WorkItemActivationParticipant) and adding your own WorkItemActivationParticipant.

Please consult the Javadoc for further information

permanent link
sam detweiler (12.5k6195201) | answered Nov 26 '12, 9:29 a.m.
thanks. never saw this anywhere.. the rcp.core.Clientmodel.... is not published in the javadoc

IWorkitemClient.addListener(listener )

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.