eclipse-sprotty/sprotty

Contextmenu usage

FelixJoehnk opened this issue · 2 comments

Hey,
the current implementation of the Context Menu uses MenuItem[] produced by the ContextMenuProviderRegistry.
I don't know now how to get the actions for example deleteAction from a MenuItem. I simply have a MenuItem with label Delete but no way of telling what to delete. If there is a way to get those Actions from the MenuItems tell me please.
If there is no way wouldn't it be nicer to simply use the LabeledActions to construct the ContextMenu?
Also the flattenAndRestructure function takes in MenuItems but LabeledActions are given might be good to change that so its not as confusing.
If there is no way and the functionality is wanted i can implement the changes!
Best Regards

Could you please elaborate a bit more? I don't see the issue here. MenuItem is a suberinterface of LabledAction (i.e. all menuItems are also LabeledActions) so you should be able to retrieve the actions (for example deleteAction) with menuItem.actions

Ah sorry i didn't see that. Also i thought that a delete action is created for every delete able element and thus one would get more menu items... sorry and thanks for the explanation