It's all about the answers!

Ask a question

Double-click action for custom domains


Andrew Freed (21311214) | asked Nov 19 '09, 10:30 a.m.
JAZZ DEVELOPER
I have implemented a custom domain using the great article Contributing to the Team Artifacts view. Now I would like to add a double click action on the elements contributed to this new domain. Ideally, this action would also be bolded in the context menu but that is not required.

The code below is how I might try to implement this, but it is not using public APIs. How can I go about registering a DoubleClickListener to the custom domain?


@Override
public void configure(IWorkbenchPart part, Category category,
IConnectedProjectAreaRegistry registry) {

super.configure(part, category, registry);
//This is how I would add a double-click listener... but this class is restricted access
if(part instanceof TeamArtifactsNavigator) {
((TeamArtifactsNavigator) part).getTreeViewer().addDoubleClickListener(...);
}
}

One answer



permanent link
Andrew Freed (21311214) | answered Dec 01 '09, 3:32 p.m.
JAZZ DEVELOPER
The following code can be used in your Domain, if you define an open action for your type of item. No need to add a double-click listener.


@Override
public boolean open(IWorkbenchPartSite site, IStructuredSelection selection) {
if(selection != null && selection.getFirstElement() instanceof MyItemToOpen) {
openAction.selectionChanged(selection);
openAction.run();

return true;
}

return super.open(site, selection);
}

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.