void (@NotNull String externalProjectConfigPath, @NotNull Collection<? extends ExternalTaskPojo> tasks) { if (tasks.isEmpty()) { return; } ExternalSystemNode<ExternalProjectPojo> moduleNode = findProjectNode(externalProjectConfigPath); if (moduleNode == null) { // LOG.warn(String.format( // "Can't proceed tasks for module which external config path is '%s'. Reason: no such module node is found. Tasks: %s", // externalProjectConfigPath, tasks // )); return; } Set<ExternalTaskExecutionInfo> toAdd = new HashSet<>(); for (ExternalTaskPojo task : tasks) { toAdd.add(buildTaskInfo(task)); } for (int i = 0; i < moduleNode.getChildCount(); i++) { ExternalSystemNode<?> childNode = moduleNode.getChildAt(i); Object element = childNode.getDescriptor().getElement(); if (element instanceof ExternalTaskExecutionInfo) { if (!toAdd.remove(element)) { removeNodeFromParent(childNode); //noinspection AssignmentToForLoopParameter i--; } } } if (!toAdd.isEmpty()) { for (ExternalTaskExecutionInfo taskInfo : toAdd) { insertNodeInto( new ExternalSystemNode<>(descriptor(taskInfo, taskInfo.getDescription(), myUiAware.getTaskIcon())), moduleNode); } } }