From 1ab20cc9642710828416154cecbd6c97d8cfa2fa Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 28 Feb 2011 17:13:29 +0100 Subject: [PATCH] don't bother tracking modifiers if there weren't any --- .../completion/CodeCompletionHandlerBase.java | 2 +- .../completion/CompletionProgressIndicator.java | 16 ++++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java index d4deb96e1249..bb1ef81c466c 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java @@ -248,7 +248,7 @@ public class CodeCompletionHandlerBase implements CodeInsightActionHandler { final Semaphore freezeSemaphore = new Semaphore(); freezeSemaphore.down(); final CompletionProgressIndicator indicator = new CompletionProgressIndicator(editor, parameters, this, freezeSemaphore, - initContext.getOffsetMap(), lookup); + initContext.getOffsetMap(), lookup, hasModifiers); boolean sync = (invokedExplicitly || ApplicationManager.getApplication().isUnitTestMode()) && !CompletionAutoPopupHandler.ourTestingAutopopup; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java index e09e2239e641..5437e8b63154 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CompletionProgressIndicator.java @@ -105,7 +105,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement private volatile int myCount; public CompletionProgressIndicator(final Editor editor, CompletionParameters parameters, CodeCompletionHandlerBase handler, Semaphore freezeSemaphore, - final OffsetMap offsetMap, LookupImpl lookup) { + final OffsetMap offsetMap, LookupImpl lookup, boolean hasModifiers) { myEditor = editor; myParameters = parameters; myHandler = handler; @@ -123,11 +123,17 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement ApplicationManager.getApplication().assertIsDispatchThread(); registerItself(); - if (!ApplicationManager.getApplication().isUnitTestMode() && !lookup.isShown()) { + if (ApplicationManager.getApplication().isUnitTestMode()) { + return; + } + + if (!lookup.isShown()) { scheduleAdvertising(); } - trackModifiers(); + if (hasModifiers) { + trackModifiers(); + } } public OffsetMap getOffsetMap() { @@ -251,9 +257,7 @@ public class CompletionProgressIndicator extends ProgressIndicatorBase implement } private void trackModifiers() { - if (isAutopopupCompletion()) { - return; - } + assert !isAutopopupCompletion(); final JComponent contentComponent = myEditor.getContentComponent(); contentComponent.addKeyListener(new KeyAdapter() {