Opening a modal dialog from menu item in Jmix 2

What is the proper way to open a modal dialog view from a menu item in Jmix 2.4?

In Jmix 1.x, there was an OpenMode property that could be set to DIALOG, NEW_TAB, etc. Is there something similar in Jmix 2? I can’t find anything in the documentation.

My workaround is to specify a bean method in the menu item, and open the view from the method. It appears to work ok, but I’m specifying the “origin” as null:

dialogWindows.view(null, MyModalWindowView.class).open().setWidth(20, Unit.EM);

Is there a better way to open a modal dialog view from a menu item?

You can pass UiComponentUtils.getCurrentView() as origin.
I have a similar code in my project to open dialog from main menu.

Perfect! Thank you!