select in project view: when in dumb mode and getOriginalElement fails, try to select...
authorpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 16:29:20 +0000 (17:29 +0100)
committerpeter <peter@jetbrains.com>
Wed, 18 Feb 2015 16:38:31 +0000 (17:38 +0100)
platform/lang-impl/src/com/intellij/ide/impl/ProjectViewSelectInTarget.java

index 85890642c3b5314ed56f34e29fdea302d37e3159..acb8a717b8d349b9f0e92f149e29e5a5d12c8f8e 100644 (file)
@@ -27,6 +27,7 @@ import com.intellij.ide.projectView.impl.ProjectViewPane;
 import com.intellij.openapi.application.ApplicationManager;
 import com.intellij.openapi.extensions.Extensions;
 import com.intellij.openapi.project.DumbService;
+import com.intellij.openapi.project.IndexNotReadyException;
 import com.intellij.openapi.project.Project;
 import com.intellij.openapi.util.ActionCallback;
 import com.intellij.openapi.vfs.VirtualFile;
@@ -150,7 +151,13 @@ public abstract class ProjectViewSelectInTarget extends SelectInTargetPsiWrapper
       }
     }
     if (toSelect == null) return;
-    PsiElement originalElement = toSelect.getOriginalElement();
+    PsiElement originalElement;
+    try {
+      originalElement = toSelect.getOriginalElement();
+    }
+    catch (IndexNotReadyException e) {
+      originalElement = toSelect;
+    }
     final VirtualFile virtualFile = PsiUtilBase.getVirtualFile(originalElement);
     select(originalElement, virtualFile, requestFocus);
   }