at the moment my context menues are hardcoded.
I was wondering if theia provides a way to asynchronously fetch the options from e.g. an api.
The easiest and as a first step fetching it somehow on startup might work but changing it on runtime would be also great.
since the context menu related API is purely synchronous (I believe), you’ll have to fetch it before the context menus are initialized.
I believe you can accomplish this using the
FrontendApplicationContribution#initialize method. I.e. you create a new
FrontendApplicationContribution, and perform a fetch in there. Later, during the initialization of menus (which I believe happens after all
initialize calls have finished), you can then use the result of that fetch.
Thank you for you reply. Do you also have a idea how I could change it on runtime / depending on the state of my tree model?
e.g. If I add a child with the name “red” to the root element, it gets possible to add “red” elements to its children. If there is no “red” element present on the root element, it is not possible to add a red element to the children.