[services] IDEA-326824 do not show tool window on handling an event from not initialized contributor

GitOrigin-RevId: 7be3654a141cea6c6c1d5e8498a1d87317b8d9b5
This commit is contained in:
Konstantin Aleev
2023-07-31 14:36:30 +02:00
committed by intellij-monorepo-bot
parent 7f880090d2
commit 437dc8d097
2 changed files with 20 additions and 1 deletions

View File

@@ -764,6 +764,7 @@ public final class RunDashboardManagerImpl implements RunDashboardManager, Persi
loadHiddenConfigurations();
syncConfigurations();
initServiceContentListeners();
updateDashboard(true);
}
}

View File

@@ -105,8 +105,14 @@ public final class ServiceViewManagerImpl implements ServiceViewManager, Persist
}
ServiceViewItem eventRoot = ContainerUtil.find(myModel.getRoots(), root -> e.contributorClass.isInstance(root.getRootContributor()));
ServiceViewContributor<?> notInitializedContributor = findNotIntializedContributor(e.contributorClass, eventRoot);
boolean initialized = notInitializedContributor == null;
if (!initialized &&
(e.type == ServiceEventListener.EventType.RESET || e.type == ServiceEventListener.EventType.UNLOAD_SYNC_RESET)) {
myNotInitializedContributors.remove(notInitializedContributor);
}
if (eventRoot != null) {
boolean show = !(eventRoot.getViewDescriptor() instanceof ServiceViewNonActivatingDescriptor);
boolean show = !(eventRoot.getViewDescriptor() instanceof ServiceViewNonActivatingDescriptor) && initialized;
updateToolWindow(toolWindowId, true, show);
}
else {
@@ -116,6 +122,18 @@ public final class ServiceViewManagerImpl implements ServiceViewManager, Persist
}
}
private @Nullable ServiceViewContributor<?> findNotIntializedContributor(Class<?> contributorClass, ServiceViewItem eventRoot) {
if (eventRoot != null) {
return myNotInitializedContributors.contains(eventRoot.getRootContributor()) ? eventRoot.getRootContributor() : null;
}
for (ServiceViewContributor<?> contributor : myNotInitializedContributors) {
if (contributorClass.isInstance(contributor)) {
return contributor;
}
}
return null;
}
private Set<? extends ServiceViewContributor<?>> getActiveContributors() {
return ContainerUtil.map2Set(myModel.getRoots(), ServiceViewItem::getRootContributor);
}