From 567e265d4e88fffeb9d60f578c60b3da6526e6f1 Mon Sep 17 00:00:00 2001 From: peter Date: Fri, 6 Jul 2012 18:13:51 +0200 Subject: [PATCH] catch INRE (EA-36351) --- .../intellij/find/findUsages/FindUsagesManager.java | 4 ++++ .../com/intellij/openapi/project/DumbServiceImpl.java | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java index 8d535cb4505a..cc9ca4c0bc04 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesManager.java @@ -38,6 +38,7 @@ import com.intellij.openapi.keymap.KeymapUtil; import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.Task; +import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.IndexNotReadyException; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.DialogWrapper; @@ -407,6 +408,9 @@ public class FindUsagesManager implements JDOMExternalizable { try { searcher.processElementUsages(element, processor, options); } + catch (IndexNotReadyException e) { + DumbService.getInstance(element.getProject()).showDumbModeNotification("Find usages is not available during indexing"); + } catch (Exception e) { LOG.error(e); } diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java index 1f105432eb97..138cf398fe7a 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java @@ -221,9 +221,13 @@ public class DumbServiceImpl extends DumbService { @Override public void showDumbModeNotification(final String message) { - final IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(myProject); - StatusBarEx statusBar = (StatusBarEx)ideFrame.getStatusBar(); - statusBar.notifyProgressByBalloon(MessageType.WARNING, message, null, null); + UIUtil.invokeLaterIfNeeded(new Runnable() { + public void run() { + final IdeFrame ideFrame = WindowManager.getInstance().getIdeFrame(myProject); + StatusBarEx statusBar = (StatusBarEx)ideFrame.getStatusBar(); + statusBar.notifyProgressByBalloon(MessageType.WARNING, message, null, null); + } + }); } private static final Ref NULL_ACTION = new Ref(null);