void (@NotNull ServiceViewContributor<?> extension, @NotNull PluginDescriptor pluginDescriptor) { addToGroup(extension); String toolWindowId = getToolWindowId(extension.getClass()); boolean register = myGroups.get(toolWindowId).size() == 1; ServiceEvent e = ServiceEvent.createResetEvent(extension.getClass()); myModel.handle(e).onSuccess(o -> { if (register) { ServiceViewItem eventRoot = ContainerUtil.find(myModel.getRoots(), root -> { return extension.getClass().isInstance(root.getRootContributor()); }); assert toolWindowId != null; registerToolWindow(getContributorToolWindowDescriptor(extension), eventRoot != null); } else { eventHandled(e); } if (ToolWindowId.SERVICES.equals(toolWindowId)) { AppUIExecutor.onUiThread().expireWith(myProject) .submit(() -> registerActivateByContributorActions(myProject, new SmartList<>(extension))); } }); }