DZone Forums
Go Back   DZone Forums > Community > Tools & IDEs > Eclipse
Reload this Page How to prevent an editor from closing
Notices
Reply
 
LinkBack Thread Tools Display Modes
  (#1 (permalink)) Old
Member
 
Posts: 17
Thanks: 1
Thanked 2 Times in 2 Posts
Join Date: Jan 2009
Question How to prevent an editor from closing - 06-01-2009, 08:40 AM

Hi,

I am writing an Eclipse rcp application that features a FormEditor part. When the editor is dirty and someone tries to close it, he will be trapped in the promptToSaveOnClose() method. If the answer is "cancel" or "no", everything is fine.

If the answer is "yes", the editor's content is going to be validated and saved. The problem arises, if validation encounters an error. Then I open a message window to inform the user. If he clicks "ok", the dialog window and the editor close.

How can I prevent the editor from closing after an error was encountered? Is there any boolean I have overseen like "canClose" or so? Having searched for a solution, I would appreciate any hint.

Thanks
Heiko
Reply With Quote
  (#2 (permalink)) Old
Active Contributor
 
Posts: 62
Thanks: 0
Thanked 6 Times in 6 Posts
Join Date: Jun 2009
Default 06-11-2009, 01:36 AM

Maybe we can rewrite the close method in editor to solve the problem.


www.eclaxy.com
let's perfect the eclipse!
Reply With Quote
  (#3 (permalink)) Old
Member
 
Posts: 5
Thanks: 0
Thanked 1 Time in 1 Post
Join Date: May 2009
Default 06-11-2009, 03:17 AM

In prompToSaveOnClose(), if the user has select "OK" and you validate, if the validation fails, show message to user and return ISaveablePart2.CANCEL. This is equivalent of the user pressing the Cancel button while prompting to SAVE. This will cancel the editor close.
Reply With Quote
The Following User Says Thank You to m_kasid For This Useful Post:
hmausolf (06-11-2009)
  (#4 (permalink)) Old
Member
 
Posts: 17
Thanks: 1
Thanked 2 Times in 2 Posts
Join Date: Jan 2009
Default 06-11-2009, 03:32 AM

Thanks a lot, this works really great!
Reply With Quote
Reply

Tags
closing, editor, validation

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Integrating GMF editor with a custom Eclipse Forms editor llednicki Eclipse 0 12-21-2008 03:43 AM


Copyright 1997-2009, DZone, Inc.
vBulletin Skin developed by: vBStyles.com