void (@NotNull ProjectSystemId systemId, @NotNull List<String> projectsPathsToMove, @Nullable Collection<String> pathsGroup, int increment) { LOG.assertTrue(increment == -1 || increment == 1); final ExternalProjectsStateProvider stateProvider = ExternalProjectsManagerImpl.getInstance(myProject).getStateProvider(); final Map<String, TaskActivationState> activationMap = stateProvider.getProjectsTasksActivationMap(systemId); final List<String> currentPaths = new ArrayList<>(activationMap.keySet()); if (pathsGroup != null) { currentPaths.retainAll(pathsGroup); } for (String path : projectsPathsToMove) { final int i1 = currentPaths.indexOf(path); final int i2 = i1 + increment; if (i1 != -1 && currentPaths.size() > i2 && i2 >= 0) { Collections.swap(currentPaths, i1, i2); } } Map<String, TaskActivationState> rearrangedMap = new LinkedHashMap<>(); for (String path : currentPaths) { rearrangedMap.put(path, activationMap.get(path)); activationMap.remove(path); } activationMap.putAll(rearrangedMap); }