With the introduction of View Menu Actions its possible for ViewPanes to accidentally override them. We should verify if this is happening and consider if we still want View Menu Actions with DnD for views already introduced.
/cc @eamodio
Looking a little more at this, there may be other uses?
@sbatten @sandy081 I wanted to follow up on a related topic, not sure if it is the same as this issue: today, Composite has methods getActions and getSecondaryActions (even getContextMenuActions?). We probably have other view related pieces with this kind of API.
That API should be deprecated imho and removed in favour of registering commands to Menu locations, as we e.g. do with all editor related actions in the editor tool bar. There should be no reason that any piece of UI is required to return actions upfront from these methods and every location should be capable of receiving actions with proper menu contributions and commands.
Example for the proper way of registering actions:
@sbatten Not sure if I understand this debt item. Can you please elaborate more?
@bpasero Yes, I completely agree.
Thanks to @jrieken who provided support for contributing menu actions to any view. I discussed with him then and discussed about the future plan of moving away from get*Actions to MenuRegistry.
We can use this item to migrate.
I also quickly looked into this then and figured out that there are some actions which need ActionItem infrastructure. For eg:
FilterAction in problems panelFWIW, When adding commands to the Timeline view -- I first added them through the MenuRegistry and context keys, but I ultimately removed all of that and moved to get*Actions because it was so much easier, especially dealing with internal view state. Also the Timeline has a custom list of "filters" which are the labels of the sources registered, so hooking that into getSecondaryActions was quite trivial, where as to provide that with the MenuRegistry would require a lot more indirection and complexity.
@eamodio Can you please provide an example of the complexity and indirection you mentioned. At the end you need to have a logical condition to show an action in get*Actions or through MenuRegistry. Is not it possible to compute the logical state in your view and set that as context?
Ultimately it turned out not to be a big deal -- I converted Timeline back to using the MenuRegistry via registerAction2
If I understand the desired action from @bpasero and @sandy081, this is the list of usages that should be migrated. Perhaps we can have view owners migrate during upcoming debt week.
Most helpful comment
Ultimately it turned out not to be a big deal -- I converted Timeline back to using the
MenuRegistryviaregisterAction2