Capture / Intercept file open

In my extension I am loading a specific file path that the extension needs to receive the path name of. What I would like to do is bind an event in my extension to file open, check the path of the file that is opened, if it matches a string, stop the editor from opening.

This might fall in the same area of binding to save (https://spectrum.chat/theia/dev/trigger-event-in-my-extension-on-save-editor~622b51b9-284b-4e05-bfd4-b3531d125421)https://spectrum.chat/theia/dev/trigger-event-in-my-extension-on-save-editor~622b51b9-284b-4e05-bfd4-b3531d125421 which I am also hoping to do.

[original thread by Eiso Kant]

By an editor do you mean your widget or Monaco editor?

I’m not totally sure, but you can implement NavigatableWidgetOpenHandler with canHandler returning a number greate than a number returned by EditorManager. In this case your handler will be used as a primar.

see https://github.com/TypeFox/theia-workshop/tree/exercise-1

[Eiso Kant]

This looks exactly what I need. I want to stop Monaco editor from opening and have my widget handle it instead. Thank you.