From 3fc0b28e6350d2d1469e8aca46aa8d073147dd7a Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 6 Mar 2017 14:47:08 +0100 Subject: [PATCH] don't auto-import after root change if it really can't complete without indices (EA-98316 - INRE: FileBasedIndexImpl.handleDumbMode) --- .../AddExternalLibraryToDependenciesQuickFix.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExternalLibraryToDependenciesQuickFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExternalLibraryToDependenciesQuickFix.java index 2b225f0065b4..d6d54c41c7b3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExternalLibraryToDependenciesQuickFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/AddExternalLibraryToDependenciesQuickFix.java @@ -17,8 +17,10 @@ package com.intellij.codeInsight.daemon.impl.quickfix; import com.intellij.openapi.application.Result; import com.intellij.openapi.application.WriteAction; +import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.module.Module; +import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.openapi.roots.DependencyScope; import com.intellij.openapi.roots.ExternalLibraryDescriptor; @@ -34,6 +36,7 @@ import org.jetbrains.annotations.Nullable; * @author nik */ class AddExternalLibraryToDependenciesQuickFix extends AddOrderEntryFix { + private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.daemon.impl.quickfix.AddExternalLibraryToDependenciesQuickFix"); private final Module myCurrentModule; private final ExternalLibraryDescriptor myLibraryDescriptor; private final String myQualifiedClassName; @@ -74,7 +77,12 @@ class AddExternalLibraryToDependenciesQuickFix extends AddOrderEntryFix { .addDependency(myCurrentModule, myLibraryDescriptor, scope) .done(aVoid -> new WriteAction() { protected void run(@NotNull final Result result) { - importClass(myCurrentModule, editor, myReference, myQualifiedClassName); + try { + importClass(myCurrentModule, editor, myReference, myQualifiedClassName); + } + catch (IndexNotReadyException e) { + LOG.info(e); + } } }.execute()); }