mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[find in files] IJPL-194101 Refactor UsageViewContentManagerImpl init to handle duplicate tool window registrations
Fixes an issue where the service would fail to initialize on the frontend because the Find tool window had already been registered via the backend. GitOrigin-RevId: a788870ecb054e732aee7ee1afcd42ef36635480
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4a309b4ffc
commit
f6cb12945c
+19
-9
@@ -50,15 +50,7 @@ public final class UsageViewContentManagerImpl extends UsageViewContentManager {
|
||||
@NonInjectable
|
||||
public UsageViewContentManagerImpl(@NotNull Project project,
|
||||
@NotNull ToolWindowManager toolWindowManager) {
|
||||
ToolWindow toolWindow = toolWindowManager.registerToolWindow(
|
||||
ToolWindowId.FIND,
|
||||
builder -> {
|
||||
builder.stripeTitle = UIBundle.messagePointer("tool.window.name.find");
|
||||
builder.icon = AllIcons.Toolwindows.ToolWindowFind;
|
||||
builder.shouldBeAvailable = false;
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
);
|
||||
ToolWindow toolWindow = getOrRegisterFindToolWindow(toolWindowManager);
|
||||
toolWindow.setHelpId(UsageViewImpl.HELP_ID);
|
||||
toolWindow.setToHideOnEmptyContent(true);
|
||||
|
||||
@@ -130,6 +122,24 @@ public final class UsageViewContentManagerImpl extends UsageViewContentManager {
|
||||
});
|
||||
}
|
||||
|
||||
private static @NotNull ToolWindow getOrRegisterFindToolWindow(@NotNull ToolWindowManager toolWindowManager) {
|
||||
if (toolWindowManager.getToolWindowIdSet().contains(ToolWindowId.FIND)) {
|
||||
ToolWindow toolWindow = toolWindowManager.getToolWindow(ToolWindowId.FIND);
|
||||
if (toolWindow != null) return toolWindow;
|
||||
else //noinspection deprecation
|
||||
toolWindowManager.unregisterToolWindow(ToolWindowId.FIND);
|
||||
}
|
||||
return toolWindowManager.registerToolWindow(
|
||||
ToolWindowId.FIND,
|
||||
builder -> {
|
||||
builder.stripeTitle = UIBundle.messagePointer("tool.window.name.find");
|
||||
builder.icon = AllIcons.Toolwindows.ToolWindowFind;
|
||||
builder.shouldBeAvailable = false;
|
||||
return Unit.INSTANCE;
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
@Override
|
||||
public @NotNull Content addContent(@NotNull String contentName,
|
||||
boolean reusable,
|
||||
|
||||
Reference in New Issue
Block a user