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
This commit is contained in:
Henry Wylde
2025-11-11 05:14:49 +00:00
committed by intellij-monorepo-bot
parent 38419efd50
commit 71e211afd9
@@ -1089,10 +1089,16 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig
@Override
public @NotNull String getUsageViewTreeTextRepresentation(@NotNull @Unmodifiable List<? extends UsageTarget> usageTargets,
@NotNull Collection<? extends Usage> usages) {
UsageViewImpl usageView = (UsageViewImpl)UsageViewManager.getInstance(getProject())
.createUsageView(usageTargets.toArray(UsageTarget.EMPTY_ARRAY), usages.toArray(Usage.EMPTY_ARRAY), new UsageViewPresentation(), null);
final Ref<UsageViewImpl> 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