Set<String> (@NotNull List<ServiceViewContributor<?>> toExclude, @Nullable Collection<ServiceViewContributor<?>> services) { if (toExclude.isEmpty()) return Collections.emptySet(); Set<String> toolWindowIds = new HashSet<>(); if (services != null) { services.removeAll(toExclude); if (services.isEmpty()) { unregisterToolWindow(ToolWindowId.SERVICES); } } for (ServiceViewContributor<?> contributor : toExclude) { unregisterActivateByContributorActions(contributor); ServiceViewToolWindowDescriptor descriptor = getContributorToolWindowDescriptor(contributor); String toolWindowId = descriptor.getToolWindowId(); Collection<ServiceViewContributor<?>> contributors = myGroups.computeIfAbsent(toolWindowId, __ -> ConcurrentCollectionFactory.createConcurrentSet()); if (contributors.isEmpty()) { toolWindowIds.add(toolWindowId); } contributors.add(contributor); } return toolWindowIds; }