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 ea0f8a4853e5..3349c17a8280 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 @@ -67,8 +67,10 @@ import javax.swing.event.ListSelectionListener; import java.awt.*; import java.awt.event.KeyEvent; import java.awt.event.MouseEvent; -import java.util.*; +import java.util.Collection; +import java.util.HashMap; import java.util.List; +import java.util.Map; public class LookupImpl extends LightweightHint implements LookupEx, Disposable, WeighingContext { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.lookup.impl.LookupImpl"); @@ -102,6 +104,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, final LookupCellRenderer myCellRenderer; private final List myListeners = ContainerUtil.createLockFreeCopyOnWriteList(); + private PrefixChangeListener myPrefixChangeListener = new PrefixChangeListener.Adapter() {}; private long myStampShown = 0; private boolean myShown = false; @@ -307,6 +310,7 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, requestResize(); refreshUi(false, true); ensureSelectionVisible(true); + myPrefixChangeListener.afterAppend(c); } public void setStartCompletionWhenNothingMatches(boolean startCompletionWhenNothingMatches) { @@ -1158,6 +1162,10 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable, } } + public void setPrefixChangeListener(PrefixChangeListener listener) { + myPrefixChangeListener = listener; + } + public enum FocusDegree { FOCUSED, SEMI_FOCUSED, UNFOCUSED } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/PrefixChangeListener.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/PrefixChangeListener.java new file mode 100644 index 000000000000..721986e4887f --- /dev/null +++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/PrefixChangeListener.java @@ -0,0 +1,26 @@ +/* + * Copyright 2000-2015 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.intellij.codeInsight.lookup.impl; + +public interface PrefixChangeListener { + + void afterAppend(char c); + + abstract class Adapter implements PrefixChangeListener { + @Override + public void afterAppend(char c) {} + } +}