From 55533e435b5ed53d930bb3b26c0b4d382be01861 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Wed, 16 Aug 2017 14:33:05 +0300 Subject: [PATCH] explicit assertion for starting find usages from within write action --- .../src/com/intellij/usages/impl/UsageViewManagerImpl.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java index 81ce351e64b4..5661d05c0ffa 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java @@ -128,6 +128,9 @@ public class UsageViewManagerImpl extends UsageViewManager { @NotNull final UsageViewPresentation presentation, @NotNull final FindUsagesProcessPresentation processPresentation, @Nullable final UsageViewStateListener listener) { + if (ApplicationManager.getApplication().isWriteAccessAllowed()) { + throw new IllegalStateException("Can't start find usages from under write action. Please consider Application.invokeLater() it instead."); + } final SearchScope searchScopeToWarnOfFallingOutOf = getMaxSearchScopeToWarnOfFallingOutOf(searchFor); final AtomicReference usageViewRef = new AtomicReference<>(); long start = System.currentTimeMillis();