we have the following problem:
In our Eclipse RCP 4 application there are multiple parts and the parts are closable. When the user is closing a part there should be a custom pop-up (depending on some internal part state) which is asking the user if he really wants to close the part or not. It seems to be not that easy to implement in Eclipse RCP 4 or we have just totally overseen something. I'll just give you a short brieifing about the things we tried:
- Use dirtable with a @persist method in the part. Though the problem is, we don't want this standard eclipse save dialog. So is there a way to override this?
- public int promptToSaveOnClose(): This seemed to be promising but not for Eclipse 4 or is there a way to integrate it that way? Compare: http://e-rcp.blogspot.de/2007/09/prevent-that-rcp-editor-is-closed.html
Our last try was to integrate a custom part listener, simple example shown in the following:
partService.addPartListener(new IPartListener() { public void partVisible(MPart part) { } public void partHidden(MPart part) { partService.showPart(part, PartState.ACTIVATE); } public void partDeactivated(MPart part) { } public void partBroughtToTop(MPart part) { } public void partActivated(MPart part) { } });
The problem with this was we are running into a continuous loop. Something similar is posted over here in the last comment: Detect tab close in Eclipse editor
So I could write some more about this problem, but I think that's enough for the moment. If you need some more input just give me a hint. Thanks for helping.