How to make ToolbarDecorator have context based on selected element

I''ve created a toolbar using this document:

I have a list created by:

The toolbar has custom actions and my question is what is the most straight forward way to make those actions have context based on the element selected in the list.
What kind of Action should I extend for the elements? Currently I have extended AnActionButton, but I don't see a way to get the selected element from it.
There is getContextComponent() method, but it seems to return null. The parameter AnActionEvent has getDataContext(key) method, but I couldn't find the key for it.
I know I must be missing something obvious.

1 comment
Comment actions Permalink

I found a way.
Iterated over the ActionGroup, and called setContextComponent(list); on every action that is instance of AnActionButton. That way the list is available from the action and I can just get the selected element.


Please sign in to leave a comment.