Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Closing editor and focus events
Closing editor and focus events [message #325943] Mon, 03 March 2008 20:29 Go to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

I'm working on custom (forms-based) editors that rely on focus-lost
events to push changes from Text widgets to the model. We've noticed,
however, that when the user is editing in a Text widget and then closes
an editor (via the X button on the editor tab), no focus-lost event is
ever getting fired for the widget.
Is this a known limitation?
I absolutely need to work around this, so even if you don't know the
direct answer any pointers in the right direction (such as what part of
the platform code to look at, or some previous discussions on the topic)
are greatly appreciated. I tried Googling but can't come up with the
right terms to produce useful results.

Thanks in advance,
Eric
Re: Closing editor and focus events [message #325972 is a reply to message #325943] Tue, 04 March 2008 15:59 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eric Rizzo wrote:
> I'm working on custom (forms-based) editors that rely on focus-lost
> events to push changes from Text widgets to the model. We've noticed,
> however, that when the user is editing in a Text widget and then closes
> an editor (via the X button on the editor tab), no focus-lost event is
> ever getting fired for the widget.
> Is this a known limitation?

yes ... In KeySequenceText we had to add a dispose listener to do the
final "filter removal" since disposing the dialog doesn't generate a
final focusOut event.

you might be able to look at SWT.Activate and SWT.Deactivate to see if
you get better matching events (we use that in places as well, although
I'm not sure what the criteria is for firing those events).

Later,
PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Closing editor and focus events [message #326055 is a reply to message #325972] Thu, 06 March 2008 14:48 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Paul Webster wrote:
> Eric Rizzo wrote:
>> I'm working on custom (forms-based) editors that rely on focus-lost
>> events to push changes from Text widgets to the model. We've noticed,
>> however, that when the user is editing in a Text widget and then
>> closes an editor (via the X button on the editor tab), no focus-lost
>> event is ever getting fired for the widget.
>> Is this a known limitation?
>
> yes ... In KeySequenceText we had to add a dispose listener to do the
> final "filter removal" since disposing the dialog doesn't generate a
> final focusOut event.

Do you know if there was ever a bug entered about it?

Eric
Re: Closing editor and focus events [message #326072 is a reply to message #326055] Thu, 06 March 2008 23:28 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Eric Rizzo wrote:
>
> Do you know if there was ever a bug entered about it?

This is the bug we used to fix KeySequencText
https://bugs.eclipse.org/bugs/show_bug.cgi?id=185094#c12

"SWT.Dispose is the only event that is guaranteed to come for all
widgets in the shell when the shell is disposed."

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/help33/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm


Re: Closing editor and focus events [message #326131 is a reply to message #326072] Fri, 07 March 2008 17:20 Go to previous message
Eclipse UserFriend
Originally posted by: eclipse-news.rizzoweb.com

Paul Webster wrote:
> Eric Rizzo wrote:
>>
>> Do you know if there was ever a bug entered about it?
>
> This is the bug we used to fix KeySequencText
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=185094#c12
>
> "SWT.Dispose is the only event that is guaranteed to come for all
> widgets in the shell when the shell is disposed."

The problem I face is that dispose-time it is too late - I need to push
the Text value to the model before the editor is even asked if it is OK
to close or if a save is needed first.

For now I've overridden EditorPart.isSaveOnCloseNeeded() in my editors
to see if one of its child widgets has the focus and if so, manually
fire a FocusOut notification before answering isSaveOnCloseNeeded.

Guess I'll enter a new bug about this, as it seems like a likely problem
in the age of data binding and forms API.

Eric
Previous Topic:compare with revision/compare examples
Next Topic:howto handle double click in commonnavigator view
Goto Forum:
  


Current Time: Sun Jun 30 00:28:23 GMT 2024

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

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

Back to the top