use of com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManager.ExternalProjectsStateProvider in project intellij-community by JetBrains.
the class ExternalSystemTaskActivator method moveTasks.
public void moveTasks(@NotNull Collection<TaskActivationEntry> entries, int increment) {
LOG.assertTrue(increment == -1 || increment == 1);
final ExternalProjectsStateProvider stateProvider = ExternalProjectsManager.getInstance(myProject).getStateProvider();
for (TaskActivationEntry activationEntry : entries) {
final TaskActivationState taskActivationState = stateProvider.getTasksActivation(activationEntry.systemId, activationEntry.projectPath);
final List<String> tasks = taskActivationState.getTasks(activationEntry.phase);
final int i1 = tasks.indexOf(activationEntry.taskName);
final int i2 = i1 + increment;
if (i1 != -1 && tasks.size() > i2 && i2 >= 0) {
Collections.swap(tasks, i1, i2);
}
}
}
use of com.intellij.openapi.externalSystem.service.project.manage.ExternalProjectsManager.ExternalProjectsStateProvider in project intellij-community by JetBrains.
the class ExternalSystemTaskActivator method moveProjects.
public void moveProjects(@NotNull ProjectSystemId systemId, @NotNull List<String> projectsPathsToMove, @Nullable Collection<String> pathsGroup, int increment) {
LOG.assertTrue(increment == -1 || increment == 1);
final ExternalProjectsStateProvider stateProvider = ExternalProjectsManager.getInstance(myProject).getStateProvider();
final Map<String, TaskActivationState> activationMap = stateProvider.getProjectsTasksActivationMap(systemId);
final List<String> currentPaths = ContainerUtil.newArrayList(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 = ContainerUtil.newLinkedHashMap();
for (String path : currentPaths) {
rearrangedMap.put(path, activationMap.get(path));
activationMap.remove(path);
}
activationMap.putAll(rearrangedMap);
}
Aggregations