Set<String> (@NotNull List<ServiceViewContributor<?>> toInclude, @Nullable Collection<ServiceViewContributor<?>> services) { if (toInclude.isEmpty()) return Collections.emptySet(); Set<String> toolWindowIds = new HashSet<>(); for (ServiceViewContributor<?> contributor : toInclude) { for (Map.Entry<String, Collection<ServiceViewContributor<?>>> entry : myGroups.entrySet()) { if (!ToolWindowId.SERVICES.equals(entry.getKey()) && entry.getValue().remove(contributor)) { if (entry.getValue().isEmpty()) { unregisterToolWindow(entry.getKey()); } break; } } } if (services == null) { Collection<ServiceViewContributor<?>> servicesContributors = ConcurrentCollectionFactory.createConcurrentSet(); servicesContributors.addAll(toInclude); myGroups.put(ToolWindowId.SERVICES, servicesContributors); toolWindowIds.add(ToolWindowId.SERVICES); } else { services.addAll(toInclude); registerActivateByContributorActions(myProject, toInclude); } return toolWindowIds; }