From 71e211afd9151004d61d633581315c081bc464e7 Mon Sep 17 00:00:00 2001 From: Henry Wylde Date: Tue, 11 Nov 2025 11:24:00 +1300 Subject: [PATCH] RUBY-34869 wrap `CodeInsightTestFixtureImpl` call to `createUsageView` with `invokeAndWait` This allows the method to be called by tests that aren't run on the EDT by default GitOrigin-RevId: 29bef00dd220e26c41fd143e378445c64979abbe --- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 4ed08629d269..4999d42436c8 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1089,10 +1089,16 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig @Override public @NotNull String getUsageViewTreeTextRepresentation(@NotNull @Unmodifiable List usageTargets, @NotNull Collection usages) { - UsageViewImpl usageView = (UsageViewImpl)UsageViewManager.getInstance(getProject()) - .createUsageView(usageTargets.toArray(UsageTarget.EMPTY_ARRAY), usages.toArray(Usage.EMPTY_ARRAY), new UsageViewPresentation(), null); + final Ref usageViewRef = new Ref<>(); + ApplicationManager.getApplication().invokeAndWait(() -> { + UsageView usageView = UsageViewManager.getInstance(getProject()) + .createUsageView(usageTargets.toArray(UsageTarget.EMPTY_ARRAY), usages.toArray(Usage.EMPTY_ARRAY), new UsageViewPresentation(), + null); - return getUsageViewTreeTextRepresentation(usageView); + usageViewRef.set((UsageViewImpl)usageView); + }); + + return getUsageViewTreeTextRepresentation(usageViewRef.get()); } @Override