Rename isDependentsSucceeded to isDependentSucceeded

This commit is contained in:
huanghongxun
2019-02-24 17:00:17 +08:00
parent b22e724a3f
commit 8007f1958e
7 changed files with 13 additions and 12 deletions

View File

@@ -106,7 +106,7 @@ public class AddAuthlibInjectorServerPane extends StackPane implements DialogAwa
Task.of(() -> {
serverBeingAdded = AuthlibInjectorServer.locateServer(url);
}).whenComplete(Schedulers.javafx(), (isDependentsSucceeded, exception) -> {
}).whenComplete(Schedulers.javafx(), (isDependentSucceeded, exception) -> {
addServerPane.setDisable(false);
nextPane.hideSpinner();

View File

@@ -128,7 +128,7 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
@Override
public void refresh() {
transitionHandler.setContent(spinner, ContainerAnimations.FADE.getAnimationProducer());
executor = versionList.refreshAsync(gameVersion, downloadProvider).whenComplete((isDependentsSucceeded, exception) -> {
executor = versionList.refreshAsync(gameVersion, downloadProvider).whenComplete((isDependentSucceeded, exception) -> {
if (isDependentsSucceeded) {
List<VersionsPageItem> items = loadVersions();

View File

@@ -91,7 +91,7 @@ public final class ModListPage extends Control {
modManager.refreshMods();
return new LinkedList<>(modManager.getMods());
}
}).whenComplete(Schedulers.javafx(), (list, isDependentsSucceeded, exception) -> {
}).whenComplete(Schedulers.javafx(), (list, isDependentSucceeded, exception) -> {
loadingProperty().set(false);
if (isDependentsSucceeded)
FXUtils.onWeakChangeAndOperate(parentTab.getSelectionModel().selectedItemProperty(), newValue -> {

View File

@@ -51,7 +51,7 @@ public class WorldListPage extends ListPage<WorldListItem> {
setLoading(true);
Task.ofResult(() -> World.getWorlds(savesDir).parallel().collect(Collectors.toList()))
.whenComplete(Schedulers.javafx(), (result, isDependentsSucceeded, exception) -> {
.whenComplete(Schedulers.javafx(), (result, isDependentSucceeded, exception) -> {
setLoading(false);
if (isDependentsSucceeded)
itemsProperty().setAll(result.stream().map(WorldListItem::new).collect(Collectors.toList()));

View File

@@ -70,8 +70,8 @@ public class DefaultGameBuilder extends GameBuilder {
libraryTask = libraryTask.thenCompose(dependencyManager.installLibraryAsync(remoteVersion));
return libraryTask;
}).whenComplete((isDependentsSucceeded, exception) -> {
if (!isDependentsSucceeded)
}).whenComplete((isDependentSucceeded, exception) -> {
if (!isDependentSucceeded)
dependencyManager.getGameRepository().getVersionRoot(name).delete();
});
}

View File

@@ -354,7 +354,8 @@ public abstract class Task {
*
* <p>When this task is complete, the given action is invoked, a boolean
* value represents the execution status of this task, and the exception
* (or {@code null} if none) of this task as arguments. The returned task
* (or {@code null} if none, which means when isDependentSucceeded is false,
* exception may be null) of this task as arguments. The returned task
* is completed when the action returns. If the supplied action itself
* encounters an exception, then the returned task exceptionally completes
* with this exception unless this task also completed exceptionally.
@@ -415,8 +416,8 @@ public abstract class Task {
* @return the new Task
*/
public final <E1 extends Exception, E2 extends Exception> Task whenComplete(Scheduler scheduler, ExceptionalRunnable<E1> success, ExceptionalConsumer<Exception, E2> failure) {
return whenComplete(scheduler, (isDependentsSucceeded, exception) -> {
if (isDependentsSucceeded) {
return whenComplete(scheduler, (isDependentSucceeded, exception) -> {
if (isDependentSucceeded) {
if (success != null)
try {
success.run();
@@ -497,7 +498,7 @@ public abstract class Task {
}
public interface FinalizedCallback {
void execute(boolean isDependentsSucceeded, Exception exception) throws Exception;
void execute(boolean isDependentSucceeded, Exception exception) throws Exception;
}
static String getCaller() {

View File

@@ -211,7 +211,7 @@ public abstract class TaskResult<T> extends Task {
* @return the new Task
*/
public Task whenComplete(Scheduler scheduler, FinalizedCallback<T> action) {
return whenComplete(scheduler, ((isDependentsSucceeded, exception) -> action.execute(getResult(), isDependentsSucceeded, exception)));
return whenComplete(scheduler, ((isDependentSucceeded, exception) -> action.execute(getResult(), isDependentSucceeded, exception)));
}
private class Subtask<R> extends TaskResult<R> {
@@ -242,6 +242,6 @@ public abstract class TaskResult<T> extends Task {
}
public interface FinalizedCallback<V> {
void execute(V result, boolean isDependentsSucceeded, Exception exception) throws Exception;
void execute(V result, boolean isDependentSucceeded, Exception exception) throws Exception;
}
}