remove isDependentSucceeded in whenComplete

This commit is contained in:
huanghongxun
2019-02-25 23:59:21 +08:00
parent eeef76594f
commit cae32cff4c
9 changed files with 27 additions and 24 deletions

View File

@@ -106,11 +106,11 @@ public class AddAuthlibInjectorServerPane extends StackPane implements DialogAwa
Task.runAsync(() -> {
serverBeingAdded = AuthlibInjectorServer.locateServer(url);
}).whenComplete(Schedulers.javafx(), (isDependentSucceeded, exception) -> {
}).whenComplete(Schedulers.javafx(), exception -> {
addServerPane.setDisable(false);
nextPane.hideSpinner();
if (isDependentSucceeded) {
if (exception == null) {
lblServerName.setText(serverBeingAdded.getName());
lblServerUrl.setText(serverBeingAdded.getUrl());

View File

@@ -59,7 +59,7 @@ public final class VanillaInstallWizardProvider implements WizardProvider {
if (settings.containsKey("optifine"))
builder.version((RemoteVersion) settings.get("optifine"));
return builder.buildAsync().whenComplete((a, b) -> profile.getRepository().refreshVersions())
return builder.buildAsync().whenComplete(any -> profile.getRepository().refreshVersions())
.thenRun(Schedulers.javafx(), () -> profile.setSelectedVersion(name));
}

View File

@@ -128,8 +128,8 @@ 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((isDependentSucceeded, exception) -> {
if (isDependentSucceeded) {
executor = versionList.refreshAsync(gameVersion, downloadProvider).whenComplete(exception -> {
if (exception == null) {
List<VersionsPageItem> items = loadVersions();
Platform.runLater(() -> {

View File

@@ -91,9 +91,9 @@ public final class ModListPage extends Control {
modManager.refreshMods();
return new LinkedList<>(modManager.getMods());
}
}).whenComplete(Schedulers.javafx(), (list, isDependentSucceeded, exception) -> {
}).whenComplete(Schedulers.javafx(), (list, exception) -> {
loadingProperty().set(false);
if (isDependentSucceeded)
if (exception == null)
FXUtils.onWeakChangeAndOperate(parentTab.getSelectionModel().selectedItemProperty(), newValue -> {
if (newValue != null && newValue.getUserData() == ModListPage.this)
itemsProperty().setAll(list.stream().map(ModListPageSkin.ModInfoObject::new).collect(Collectors.toList()));

View File

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