From e2e7a7cce2a55cd5501702ade409ea4a746fa0e4 Mon Sep 17 00:00:00 2001 From: tobias <tobias.ullerich@icloud.com> Date: Thu, 14 Jul 2016 08:34:02 +0200 Subject: [PATCH] Change UpdateRegistry#lookupUpdates --- .../src/de/tobias/playpad/PlayPadMain.java | 33 +++++++++---------- PlayWall/src/de/tobias/playpad/Strings.java | 6 ++-- .../option/UpdateTabViewController.java | 8 +---- .../playpad/update/UpdateRegistery.java | 12 ++++--- 4 files changed, 27 insertions(+), 32 deletions(-) diff --git a/PlayWall/src/de/tobias/playpad/PlayPadMain.java b/PlayWall/src/de/tobias/playpad/PlayPadMain.java index 8f61c53d..5831f9a0 100644 --- a/PlayWall/src/de/tobias/playpad/PlayPadMain.java +++ b/PlayWall/src/de/tobias/playpad/PlayPadMain.java @@ -5,7 +5,6 @@ import java.io.IOException; import java.io.InputStreamReader; import java.io.PrintWriter; import java.net.MalformedURLException; -import java.net.URISyntaxException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; @@ -339,25 +338,23 @@ public class PlayPadMain extends Application implements LocalizationDelegate, Pl if (newProfile.getProfileSettings().isAutoUpdate()) { Worker.runLater(() -> { - try { - UpdateRegistery.lookupUpdates(newProfile.getProfileSettings().getUpdateChannel()); - if (!UpdateRegistery.getAvailableUpdates().isEmpty()) { - Platform.runLater(() -> + UpdateRegistery.lookupUpdates(newProfile.getProfileSettings().getUpdateChannel()); + if (!UpdateRegistery.getAvailableUpdates().isEmpty()) { + Platform.runLater(() -> + { + Alert alert = new Alert(AlertType.CONFIRMATION); + alert.setHeaderText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Header)); + alert.setContentText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Content)); + alert.showAndWait().filter(item -> item == ButtonType.OK).ifPresent(result -> { - Alert alert = new Alert(AlertType.CONFIRMATION); - alert.setHeaderText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Header)); - alert.setContentText(Localization.getString(Strings.UI_Dialog_AutoUpdate_Content)); - alert.showAndWait().filter(item -> item == ButtonType.OK).ifPresent(result -> - { - try { - Updates.startUpdate(); - } catch (IOException e) { - e.printStackTrace(); - } - }); + try { + Updates.startUpdate(); + } catch (IOException e) { + e.printStackTrace(); + } }); - } - } catch (IOException | URISyntaxException e) {} + }); + } }); } } diff --git a/PlayWall/src/de/tobias/playpad/Strings.java b/PlayWall/src/de/tobias/playpad/Strings.java index 6a84f43d..57939d09 100644 --- a/PlayWall/src/de/tobias/playpad/Strings.java +++ b/PlayWall/src/de/tobias/playpad/Strings.java @@ -197,7 +197,7 @@ public class Strings { // Update Channel - Basename public static final String Update_Channel_BaseName = "UpdateChannel."; - + // Error - Layout public static final String Error_Layout_Load = "Error.Layout.Load"; @@ -206,7 +206,7 @@ public class Strings { public static final String UI_Window_Settings_Updates_CurrentVersion = "UI.Window.Settings.Updates.CurrentVersion"; // Error - Update - Downlaod - public static final String Error_Update_Download = "Error.Update.Download"; + @Deprecated public static final String Error_Update_Download = "Error.Update.Download"; // Layout public static final String Layout_Modern_Name = "Layout.Modern.Name"; @@ -219,7 +219,7 @@ public class Strings { // TriggerPoint - Enum public static final String TriggerPoint_BaseName = "TriggerPoint."; - + // Drag and Drop Mode public static final String DnDMode_Move = "DnDMode.Move"; public static final String DnDMode_Replace = "DnDMode.Replace"; diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/UpdateTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/UpdateTabViewController.java index 0363dcfc..0bf463e7 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/UpdateTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/UpdateTabViewController.java @@ -1,7 +1,6 @@ package de.tobias.playpad.viewcontroller.option; import java.io.IOException; -import java.net.URISyntaxException; import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.Strings; @@ -99,12 +98,7 @@ public class UpdateTabViewController extends SettingsTabViewController { Worker.runLater(() -> { // Search for updates - try { - UpdateRegistery.lookupUpdates(profile.getProfileSettings().getUpdateChannel()); - } catch (IOException | URISyntaxException e) { - e.printStackTrace(); - showErrorMessage(Localization.getString(Strings.Error_Update_Download, e.getLocalizedMessage())); - } + UpdateRegistery.lookupUpdates(profile.getProfileSettings().getUpdateChannel()); Platform.runLater(() -> { diff --git a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java index 59a56819..9b2274c4 100644 --- a/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java +++ b/PlayWallCore/src/de/tobias/playpad/update/UpdateRegistery.java @@ -25,12 +25,16 @@ public class UpdateRegistery { return availableUpdates; } - public static List<Updatable> lookupUpdates(UpdateChannel channel) throws IOException, URISyntaxException { + public static List<Updatable> lookupUpdates(UpdateChannel channel) { availableUpdates.clear(); for (Updatable updatable : UpdateRegistery.updatables) { - updatable.loadInformation(channel); - if (updatable.isUpdateAvailable()) { - availableUpdates.add(updatable); + try { + updatable.loadInformation(channel); + if (updatable.isUpdateAvailable()) { + availableUpdates.add(updatable); + } + } catch (IOException | URISyntaxException e) { + } } return availableUpdates; -- GitLab