diff options
author | Tor Norbye <tnorbye@google.com> | 2014-09-04 20:44:00 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-09-04 20:44:01 +0000 |
commit | fb5a02906f644d044eb0286bf27d413ba0e05216 (patch) | |
tree | bca7d49005d81d10c70bc3f547df041c636b4300 /platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java | |
parent | 9cde0e3c015174898df8b8f3672185941fad4786 (diff) | |
parent | d245f58efbfc26b13b9b9d5e52e6a83a0d76216c (diff) | |
download | idea-fb5a02906f644d044eb0286bf27d413ba0e05216.tar.gz |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java')
-rw-r--r-- | platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java index 9a71909fcca8..869886d26523 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java @@ -776,15 +776,13 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, @Override public void valueChanged(@NotNull ListSelectionEvent e){ - final LookupElement item = getCurrentItem(); - if (oldItem != item && !myList.isEmpty()) { // do not update on temporary model wipe - fireCurrentItemChanged(item); - if (myDisposed) { //a listener may have decided to close us, what can we do? - return; - } + if (!myUpdating) { + final LookupElement item = getCurrentItem(); + fireCurrentItemChanged(oldItem, item); oldItem = item; } } + }); new ClickListener() { @@ -876,9 +874,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, } } - void fireCurrentItemChanged(LookupElement item){ - if (!myListeners.isEmpty()){ - LookupEvent event = new LookupEvent(this, item, (char)0); + private void fireCurrentItemChanged(@Nullable LookupElement oldItem, @Nullable LookupElement currentItem) { + if (oldItem != currentItem && !myListeners.isEmpty()) { + LookupEvent event = new LookupEvent(this, currentItem, (char)0); for (LookupListener listener : myListeners) { listener.currentItemChanged(event); } @@ -1088,6 +1086,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, public void refreshUi(boolean mayCheckReused, boolean onExplicitAction) { assert !myUpdating; + LookupElement prevItem = getCurrentItem(); myUpdating = true; try { final boolean reused = mayCheckReused && checkReused(); @@ -1100,6 +1099,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, } finally { myUpdating = false; + fireCurrentItemChanged(prevItem, getCurrentItem()); } } |