I am working on an Eclipse based RCP. We have a need to prevent one of the opened editors from being closed by the user.
The desired behavior is:
- the user clicks the X in the editor window or “CTRL+W”
- a dialog pops up saying: “If you close this editor, your activity will stop. Do you want to?”
- if they click yes, it closes, if no, it stays open.
Oh yeah, and is this even possible?
Thanks,
gk
You could use a
org.eclipse.ui.ISaveablePart2, more specifically the methodpromptToSaveOnClose().However, as said in this thread,
See an example in this
SaveableHelper.javasource file.See also the article Prevent that a RCP Editor is closed, which explains how this method works: