diff options
author | Tor Norbye <tnorbye@google.com> | 2014-09-04 13:24:04 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2014-09-04 13:24:04 -0700 |
commit | c3d3a90f6b4ead083d63e28e6b9fcea93d675678 (patch) | |
tree | fc0dcd722b6d445468dbe7dad13b4c11781b1cbe /platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java | |
parent | 1aa2e09bdbd413eacb677e9fa4b50630530d0656 (diff) | |
download | idea-c3d3a90f6b4ead083d63e28e6b9fcea93d675678.tar.gz |
Snapshot idea/138.1980 from git://git.jetbrains.org/idea/community.git
Change-Id: Ib567c9c152d770212a7a3db20fbf591c210920bd
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()); } } |