Rename isDependentsSucceeded to isDependentSucceeded
This commit is contained in:
@@ -106,7 +106,7 @@ public class AddAuthlibInjectorServerPane extends StackPane implements DialogAwa
|
|||||||
|
|
||||||
Task.of(() -> {
|
Task.of(() -> {
|
||||||
serverBeingAdded = AuthlibInjectorServer.locateServer(url);
|
serverBeingAdded = AuthlibInjectorServer.locateServer(url);
|
||||||
}).whenComplete(Schedulers.javafx(), (isDependentsSucceeded, exception) -> {
|
}).whenComplete(Schedulers.javafx(), (isDependentSucceeded, exception) -> {
|
||||||
addServerPane.setDisable(false);
|
addServerPane.setDisable(false);
|
||||||
nextPane.hideSpinner();
|
nextPane.hideSpinner();
|
||||||
|
|
||||||
|
|||||||
@@ -128,7 +128,7 @@ public final class VersionsPage extends BorderPane implements WizardPage, Refres
|
|||||||
@Override
|
@Override
|
||||||
public void refresh() {
|
public void refresh() {
|
||||||
transitionHandler.setContent(spinner, ContainerAnimations.FADE.getAnimationProducer());
|
transitionHandler.setContent(spinner, ContainerAnimations.FADE.getAnimationProducer());
|
||||||
executor = versionList.refreshAsync(gameVersion, downloadProvider).whenComplete((isDependentsSucceeded, exception) -> {
|
executor = versionList.refreshAsync(gameVersion, downloadProvider).whenComplete((isDependentSucceeded, exception) -> {
|
||||||
if (isDependentsSucceeded) {
|
if (isDependentsSucceeded) {
|
||||||
List<VersionsPageItem> items = loadVersions();
|
List<VersionsPageItem> items = loadVersions();
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ public final class ModListPage extends Control {
|
|||||||
modManager.refreshMods();
|
modManager.refreshMods();
|
||||||
return new LinkedList<>(modManager.getMods());
|
return new LinkedList<>(modManager.getMods());
|
||||||
}
|
}
|
||||||
}).whenComplete(Schedulers.javafx(), (list, isDependentsSucceeded, exception) -> {
|
}).whenComplete(Schedulers.javafx(), (list, isDependentSucceeded, exception) -> {
|
||||||
loadingProperty().set(false);
|
loadingProperty().set(false);
|
||||||
if (isDependentsSucceeded)
|
if (isDependentsSucceeded)
|
||||||
FXUtils.onWeakChangeAndOperate(parentTab.getSelectionModel().selectedItemProperty(), newValue -> {
|
FXUtils.onWeakChangeAndOperate(parentTab.getSelectionModel().selectedItemProperty(), newValue -> {
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class WorldListPage extends ListPage<WorldListItem> {
|
|||||||
|
|
||||||
setLoading(true);
|
setLoading(true);
|
||||||
Task.ofResult(() -> World.getWorlds(savesDir).parallel().collect(Collectors.toList()))
|
Task.ofResult(() -> World.getWorlds(savesDir).parallel().collect(Collectors.toList()))
|
||||||
.whenComplete(Schedulers.javafx(), (result, isDependentsSucceeded, exception) -> {
|
.whenComplete(Schedulers.javafx(), (result, isDependentSucceeded, exception) -> {
|
||||||
setLoading(false);
|
setLoading(false);
|
||||||
if (isDependentsSucceeded)
|
if (isDependentsSucceeded)
|
||||||
itemsProperty().setAll(result.stream().map(WorldListItem::new).collect(Collectors.toList()));
|
itemsProperty().setAll(result.stream().map(WorldListItem::new).collect(Collectors.toList()));
|
||||||
|
|||||||
@@ -70,8 +70,8 @@ public class DefaultGameBuilder extends GameBuilder {
|
|||||||
libraryTask = libraryTask.thenCompose(dependencyManager.installLibraryAsync(remoteVersion));
|
libraryTask = libraryTask.thenCompose(dependencyManager.installLibraryAsync(remoteVersion));
|
||||||
|
|
||||||
return libraryTask;
|
return libraryTask;
|
||||||
}).whenComplete((isDependentsSucceeded, exception) -> {
|
}).whenComplete((isDependentSucceeded, exception) -> {
|
||||||
if (!isDependentsSucceeded)
|
if (!isDependentSucceeded)
|
||||||
dependencyManager.getGameRepository().getVersionRoot(name).delete();
|
dependencyManager.getGameRepository().getVersionRoot(name).delete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -354,7 +354,8 @@ public abstract class Task {
|
|||||||
*
|
*
|
||||||
* <p>When this task is complete, the given action is invoked, a boolean
|
* <p>When this task is complete, the given action is invoked, a boolean
|
||||||
* value represents the execution status of this task, and the exception
|
* 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
|
* is completed when the action returns. If the supplied action itself
|
||||||
* encounters an exception, then the returned task exceptionally completes
|
* encounters an exception, then the returned task exceptionally completes
|
||||||
* with this exception unless this task also completed exceptionally.
|
* with this exception unless this task also completed exceptionally.
|
||||||
@@ -415,8 +416,8 @@ public abstract class Task {
|
|||||||
* @return the new Task
|
* @return the new Task
|
||||||
*/
|
*/
|
||||||
public final <E1 extends Exception, E2 extends Exception> Task whenComplete(Scheduler scheduler, ExceptionalRunnable<E1> success, ExceptionalConsumer<Exception, E2> failure) {
|
public final <E1 extends Exception, E2 extends Exception> Task whenComplete(Scheduler scheduler, ExceptionalRunnable<E1> success, ExceptionalConsumer<Exception, E2> failure) {
|
||||||
return whenComplete(scheduler, (isDependentsSucceeded, exception) -> {
|
return whenComplete(scheduler, (isDependentSucceeded, exception) -> {
|
||||||
if (isDependentsSucceeded) {
|
if (isDependentSucceeded) {
|
||||||
if (success != null)
|
if (success != null)
|
||||||
try {
|
try {
|
||||||
success.run();
|
success.run();
|
||||||
@@ -497,7 +498,7 @@ public abstract class Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface FinalizedCallback {
|
public interface FinalizedCallback {
|
||||||
void execute(boolean isDependentsSucceeded, Exception exception) throws Exception;
|
void execute(boolean isDependentSucceeded, Exception exception) throws Exception;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getCaller() {
|
static String getCaller() {
|
||||||
|
|||||||
@@ -211,7 +211,7 @@ public abstract class TaskResult<T> extends Task {
|
|||||||
* @return the new Task
|
* @return the new Task
|
||||||
*/
|
*/
|
||||||
public Task whenComplete(Scheduler scheduler, FinalizedCallback<T> action) {
|
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> {
|
private class Subtask<R> extends TaskResult<R> {
|
||||||
@@ -242,6 +242,6 @@ public abstract class TaskResult<T> extends Task {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public interface FinalizedCallback<V> {
|
public interface FinalizedCallback<V> {
|
||||||
void execute(V result, boolean isDependentsSucceeded, Exception exception) throws Exception;
|
void execute(V result, boolean isDependentSucceeded, Exception exception) throws Exception;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user