Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Scout » SWT UI: unsaved changes confirmation box called too late
SWT UI: unsaved changes confirmation box called too late [message #1477966] Tue, 18 November 2014 09:02 Go to next message
Jeremie Bresson is currently offline Jeremie BressonFriend
Messages: 1252
Registered: October 2011
Senior Member
Following situation:
* A Form opened as SWT View
* A FormField with some custom logic in execIsSaveNeeded(): "return !isFormLoading();" [the real logic is more complicated. Goal of this simulation: during initialization of the form the logic returns false, after that it returns true].
* In the Form: execOnCloseRequest(..) calls doCancel().

See this thread for more information about the IsSaveNeeded and OnCloseRequest.

The problem:
When I close the view with the "X" in the Tab, the View is closed before the scout model logic is called. The scout layer displays a message box because of the unsaved changes: "Do you want to save unsaved changes [Yes] [No] [Cancel]" The problem is that it is too late, the RCP Layer has already closed the part. If the user clicks on "Cancel" the view is no longer there.

index.php/fa/19928/0/

index.php/fa/19929/0/

The current workaround is to call touch() in execPostLoad(), this way the SWT view is marked as dirty and the Eclipse RCP framework will not Short circuit the confirmation phase.
See org.eclipse.ui.internal.SaveableHelper.savePart(ISaveablePart2, IWorkbenchWindow, boolean) [without any guarantee that this is the correct position in the code].


  • Attachment: Close_1.png
    (Size: 14.74KB, Downloaded 413 times)
  • Attachment: Close_2.png
    (Size: 40.83KB, Downloaded 469 times)
Re: SWT UI: unsaved changes confirmation box called too late [message #1479285 is a reply to message #1477966] Wed, 19 November 2014 10:03 Go to previous message
Urs Beeli is currently offline Urs BeeliFriend
Messages: 573
Registered: October 2012
Location: Bern, Switzerland
Senior Member
Thanks, this is something we would have stumbled across pretty soon, too. I bookmarked this thread so I can refer to it when we get there Smile
Previous Topic:Web Services4.0 Tutorial
Next Topic:Editable Amount Column in Table
Goto Forum:
  


Current Time: Thu Apr 25 11:32:01 GMT 2024

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

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

Back to the top