From cb37d059b802150ff7890af049a1e66b00aaf838 Mon Sep 17 00:00:00 2001 From: Ben Fry Date: Fri, 6 Aug 2021 20:12:41 -0400 Subject: [PATCH] finish getting pdex files to install, now with actual feedback --- app/src/processing/app/Base.java | 31 ++++++++++++++++++------------- todo.txt | 3 ++- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/app/src/processing/app/Base.java b/app/src/processing/app/Base.java index 07c408570..3fe6d83d3 100644 --- a/app/src/processing/app/Base.java +++ b/app/src/processing/app/Base.java @@ -1358,23 +1358,28 @@ public class Base { "only be installed from trusted sources."); if (result == JOptionPane.YES_OPTION) { - try { - editor.statusNotice("Installing " + baseName + "..."); - editor.startIndeterminate(); + editor.statusNotice("Installing " + baseName + "..."); + editor.startIndeterminate(); - // do the work of the actual install - LocalContribution contrib = - AvailableContribution.install(this, new File(path)); + new Thread(() -> { + try { + // do the work of the actual install + LocalContribution contrib = + AvailableContribution.install(this, new File(path)); - editor.stopIndeterminate(); - editor.statusEmpty(); + EventQueue.invokeLater(() -> { + editor.stopIndeterminate(); - if (contrib == null) { - Messages.showWarning("Error During Installation", "Could not install contrib from " + path); + if (contrib != null) { + editor.statusEmpty(); + } else { + editor.statusError("Could not install " + path); + } + }); + } catch (IOException e) { + EventQueue.invokeLater(() -> Messages.showWarning("Exception During Installation", "Could not install contrib from " + path, e)); } - } catch (IOException e) { - Messages.showWarning("Exception During Installation", "Could not install contrib from " + path, e); - } + }).start(); } } }); diff --git a/todo.txt b/todo.txt index fa778c25b..aa12edf75 100755 --- a/todo.txt +++ b/todo.txt @@ -26,7 +26,8 @@ X update to JDK 11.0.12+7 X rewrite download handler to just use a simple _ remove the rest of the jre downloader code X initial code to install a contrib from a pdex file -_ test to make sure it's behaving properly +X test to make sure it's behaving properly +X finish getting pdex files to install, now with actual feedback o handleNew() returns an Editor object o unlikely to break anything, but it is a signature change X nope, nevermind, not gonna do it