Skip to main content



      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 09:55 Go to next message
Eclipse UserFriend
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 11:41 Go to previous message
Eclipse UserFriend
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: Wed Mar 19 23:11:09 EDT 2025

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

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

Back to the top