Currently I am working on RCP application with view part.
In application, user can able to open multiple instances of same view part.
I am able to handle view parts close operation with menu selection.
But I am unaware of handling the ‘X’ i.e tab close operation.
I tried with adding IPartListener object to the view part object,(I refereed this link ),but in its partClosed() method I am facing 2 issues,
- I am not able to get the current instance of
view part object. - The
partClosed()method only gets called after closing the tab, so I am not able to show the confirmation for closing the tab.
What approach should I use to resolve above two questions.
Any help is appreciated.
Best regards,
Mandar
You may consider to implement the interface
ISaveablePart2to yourViewPart. This interface is responsible to prompt the user if the part should be closed or not. Furthermore it decides what to do with the unsaved data.You can promt the user if the view should be closed with a custom dialog in the method
promptToSaveOnClose().Eclispe API: ISaveablePart2