Need to determine if AutoComplete popup is visible

Post a reply

Smilies
:D :) ;) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :!: :?: :idea: :arrow: :| :mrgreen: :geek: :ugeek:
BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON
Topic review
   

Expand view Topic review: Need to determine if AutoComplete popup is visible

Re: Need to determine if AutoComplete popup is visible

Post by robert » Fri Sep 27, 2013 1:40 pm

Never say never. :D I've made that method public, so it'll be in the upcoming 2.5.1 release.

Re: Need to determine if AutoComplete popup is visible

Post by oskar » Mon Sep 23, 2013 1:08 am

I figured out a hacky solution for those who are interested. I found that java.awt.Window has a getOwnedWindows() method, which will include the AutoCompletePopupWindow after the first time it is summoned. So, I call the method and, if there is an owned window, I call its isVisible() method. That appears to work in my tests.

Need to determine if AutoComplete popup is visible

Post by oskar » Mon Sep 23, 2013 12:10 am

I've run into a problem that can only be solved if I had access to AutoCompletion's isPopupVisible method, which unfortunately is marked as private. I have a KeyListener that intercepts keyPressed in order to provide syntax indentation (among other things). It turns out that it overrides whatever key events are set up by AutoComplete, so if I press enter when the AutoComplete popup is visible, it is intercepted by my KeyListener and a newline is inserted.

I could solve this issue by simply not running my KeyListener when the AutoComplete popup is visible, but there is no way for me to determine this! I've attempted all sorts of ugly hacks to figure out when the popup is visible without any luck. I assume this will probably never be added, because I found a thread over a year ago in which the same thing was requested. If you have any advice, I would really appreciate it.

Top

cron