Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How do I find out if the content assist popup window is currently showing?
How do I find out if the content assist popup window is currently showing? [message #514044] Fri, 12 February 2010 09:51 Go to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
I am implementing a text editor that is closed when ESC is pressed. But
if the content assist popup window is showing, ESC should only close
this popup.

The main problem is that the
org.eclipse.jface.text.contentassist.CompletionProposalPopup .verifyKey(VerifyEvent)
returns true when ESC is pressed, thus handing the key event through to
the KeyListener that closes the editor.

My current workaround is a combined VerifyKeyListener / KeyListener that
sets a flag in verifyKey() if ESC is pressed and
ContentAssistant.hasProposalPopupFocus() returns true. If the flag is
set, the keyPressed() method ignores the next ESC. But that ugly
workaround only works if the popup is *focussed*.

I cannot add another IContentAssistListener to the ContentAssistant that
returns false in this case, as the add method is package private. I
guess that'd be a problem anyway, as I cannot make sure in which order
the IContentAssistListeners are registered / executed.

Any ideas?

--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: How do I find out if the content assist popup window is currently showing? [message #514117 is a reply to message #514044] Fri, 12 February 2010 13:32 Go to previous message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
Jan Kšoehnlein wrote:
> I am implementing a text editor that is closed when ESC is pressed.
> But if the content assist popup window is showing, ESC should only
> close this popup.
>
> The main problem is that the
> org.eclipse.jface.text.contentassist.CompletionProposalPopup .verifyKey(VerifyEvent)
>
> returns true when ESC is pressed, thus handing the key event through
> to the KeyListener that closes the editor.
>
> My current workaround is a combined VerifyKeyListener / KeyListener
> that sets a flag in verifyKey() if ESC is pressed and
> ContentAssistant.hasProposalPopupFocus() returns true. If the flag is
> set, the keyPressed() method ignores the next ESC. But that ugly
> workaround only works if the popup is *focussed*.
>
> I cannot add another IContentAssistListener to the ContentAssistant
> that returns false in this case, as the add method is package private.
> I guess that'd be a problem anyway, as I cannot make sure in which
> order the IContentAssistListeners are registered / executed.
>
> Any ideas?
You don't need to implement closing on 'Esc'. Simply assign 'Esc' to the
Close command and all works as expected.

Dani
Previous Topic:How ViewPart response to some EditorPart Action
Next Topic:TabbedProperties
Goto Forum:
  


Current Time: Tue Mar 19 10:15:56 GMT 2024

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

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

Back to the top