diff --git a/java/src/processing/mode/java/JavaEditor.java b/java/src/processing/mode/java/JavaEditor.java index a30f78ec7..a06f5a052 100644 --- a/java/src/processing/mode/java/JavaEditor.java +++ b/java/src/processing/mode/java/JavaEditor.java @@ -856,11 +856,23 @@ public class JavaEditor extends Editor { conn.setRequestMethod("GET"); conn.connect(); + int length = conn.getContentLength(); +// float size = (length >> 10) / 1024f; + //float size = (length / 1000) / 1000f; +// String msg = +// "Downloading reference (" + PApplet.nf(size, 0, 1) + " MB)… "; + String mb = PApplet.nf((length >> 10) / 1024f, 0, 1); + if (mb.endsWith(".0")) { + mb = mb.substring(0, mb.length() - 2); // don't show .0 + } ProgressMonitorInputStream input = new ProgressMonitorInputStream(this, - "Downloading reference…", conn.getInputStream()); - input.getProgressMonitor().setMaximum(conn.getContentLength()); + "Downloading reference (" + mb + " MB)… ", conn.getInputStream()); + input.getProgressMonitor().setMaximum(length); +// ProgressMonitor monitor = input.getProgressMonitor(); +// monitor.setMaximum(length); PApplet.saveStream(getOfflineReferenceFile(), input); + // reset the internal handling for the reference server useReferenceServer = null; } catch (InterruptedIOException iioe) { diff --git a/todo.txt b/todo.txt index bb9a2f13d..42a2b4ddd 100755 --- a/todo.txt +++ b/todo.txt @@ -11,7 +11,7 @@ _ https://github.com/processing/processing4/wiki/Translations _ https://www.oracle.com/java/technologies/javase/jdk17-suported-locales.html X implement offline reference download X https://github.com/processing/processing-website/releases/download/2022-10-05-1459/reference.zip -_ add a note about the file size to the progress window +X add a note about the file size to the progress window _ document and grab other notes from elsewhere here