Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » RCP closing view handle(RCP closing view handle)
RCP closing view handle [message #1019346] Fri, 15 March 2013 13:55 Go to next message
abc test is currently offline abc testFriend
Messages: 4
Registered: January 2013
Junior Member
0 down vote favorite


In my Rcp application if user close a view all modified data not saved in to the project, inorder to avoid that implement ISavable part and override isSaveOnCloseNeeded() The pblm here is that it ask user any modification done while closing view.If click yes it sved modified data,but click no it again asking smeconfirmation window how avoid that my sample code like this public class ExplorerView extends CommonNavigator implements KeyListener, ISaveablePart, IProjectExplorerView {

@Override
public boolean isSaveOnCloseNeeded(){

if (true == isAnyProjectToSave()) {

MessageBox messageBox = new MessageBox(Display.getCurrent().getActiveShell(),
SWT.YES | SWT.NO
| SWT.ICON_WARNING);
messageBox.setText("Exit Explorer");
messageBox.setMessage("Do you want to save ]?");

int buttonID = messageBox.open();

if (SWT.YES == buttonID)
{
try
{
saveAll();


}
catch (Exception e)
{
e.printStackTrace();
}
}
if (SWT.NO == buttonID){

return false;

}
}

return false;
Re: RCP closing view handle [message #1021735 is a reply to message #1019346] Wed, 20 March 2013 15:41 Go to previous message
Wim Jongman is currently offline Wim JongmanFriend
Messages: 423
Registered: July 2009
Senior Member
Hi abc,

Just implement ISaveablePart and flow with the framework.

Best regards,

Wim

> 0 down vote favorite
>
>
> In my Rcp application if user close a view all modified data not saved in
to the project, inorder to avoid that implement ISavable part and override
isSaveOnCloseNeeded() The pblm here is that it ask user any modification done
while closing view.If click yes it sved modified data,but click no it again
asking smeconfirmation window how avoid that my sample code like this public
class ExplorerView extends CommonNavigator implements KeyListener,
ISaveablePart, IProjectExplorerView {
>
> @Override
> public boolean isSaveOnCloseNeeded(){
>
> if (true == isAnyProjectToSave()) {
>
> MessageBox messageBox = new
MessageBox(Display.getCurrent().getActiveShell(),
> SWT.YES | SWT.NO
> | SWT.ICON_WARNING);
> messageBox.setText("Exit Explorer");
> messageBox.setMessage("Do you want to save ]?");
>
> int buttonID = messageBox.open();
>
> if (SWT.YES == buttonID)
> {
> try
> {
> saveAll();
>
>
> }
> catch (Exception e)
> {
> e.printStackTrace();
> }
> }
> if (SWT.NO == buttonID){
>
> return false;
>
> }
> }
>
> return false;
Previous Topic:Change the DaD feedback on the pointer
Next Topic:how to change colour of label in swt tree editor
Goto Forum:
  


Current Time: Fri Apr 26 07:52:46 GMT 2024

Powered by FUDForum. Page generated in 0.03992 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top