project tasks: notify even for empty task list execution

This commit is contained in:
Vladislav.Soroka
2016-09-30 17:12:10 +03:00
parent 1ffd4ab88a
commit 9e0eb402e1
@@ -131,6 +131,11 @@ public class ProjectTaskManagerImpl extends ProjectTaskManager {
};
visitTasks(projectTask instanceof ProjectTaskList ? (ProjectTaskList)projectTask : Collections.singleton(projectTask), taskClassifier);
if (toRun.isEmpty()) {
sendSuccessNotify(callback);
return;
}
AtomicInteger inProgressCounter = new AtomicInteger(toRun.size());
AtomicInteger errorsCounter = new AtomicInteger();
AtomicInteger warningsCounter = new AtomicInteger();
@@ -150,7 +155,20 @@ public class ProjectTaskManagerImpl extends ProjectTaskManager {
}
};
toRun.forEach(pair -> pair.first.run(myProject, context, chunkStatusNotification, pair.second));
toRun.forEach(pair -> {
if (pair.second.isEmpty()) {
sendSuccessNotify(chunkStatusNotification);
}
else {
pair.first.run(myProject, context, chunkStatusNotification, pair.second);
}
});
}
private static void sendSuccessNotify(@Nullable ProjectTaskNotification notification) {
if (notification != null) {
notification.finished(new ProjectTaskResult(false, 0, 0));
}
}
private static void visitTasks(@NotNull Collection<? extends ProjectTask> tasks,