From 1d7cd915f60fcbe8ab4cee56cf27c856f42d6aaa Mon Sep 17 00:00:00 2001 From: Sethur Date: Wed, 15 Feb 2023 12:24:13 +0100 Subject: [PATCH] Added ignoreStatusAndProgressUpdates flag. Added flag for ignoring all subsequent status line and progress bar updates. Useful for calling plugins from other plugins. --- ij/IJ.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/ij/IJ.java b/ij/IJ.java index c9c2e0fc..3f30e153 100644 --- a/ij/IJ.java +++ b/ij/IJ.java @@ -53,6 +53,9 @@ public class IJ { public static boolean debugMode; public static boolean hideProcessStackDialog; + + /** Turn off all status and progress bar updates **/ + public static boolean ignoreStatusAndProgressUpdates = false; public static final char micronSymbol = '\u00B5'; public static final char angstromSymbol = '\u00C5'; @@ -145,6 +148,12 @@ public static void setDebugMode(boolean b) { LogStream.redirectSystem(debugMode); } + /** Turn on/off ignoring of status and progress bar updates.*/ + public static void setIgnoreStatusAndProgressUpdates(boolean b) { + ignoreStatusAndProgressUpdates = b; + LogStream.redirectSystem(ignoreStatusAndProgressUpdates); + } + /** Runs the macro contained in the string macro on the current thread. Returns any string value returned by the macro, null if the macro does not return a value, or @@ -450,6 +459,7 @@ public static java.applet.Applet getApplet() { with '!', subsequent showStatus() calls in the current thread (without "!" in the message) are suppressed. */ public static void showStatus(String s) { + if (ignoreStatusAndProgressUpdates) return; if ((Interpreter.getInstance()==null&&statusBarThread==null) || (statusBarThread!=null&&Thread.currentThread()!=statusBarThread)) protectStatusBar(false); @@ -474,6 +484,7 @@ public static void showStatus(String s) { * See: http://wsr.imagej.net/macros/FlashingStatusMessages.txt */ public static void showStatus(String message, String options) { + if (ignoreStatusAndProgressUpdates) return; showStatus(message); if (options==null) return; @@ -772,6 +783,7 @@ public static void outOfMemory(String name) { updated only if more than 90 ms have passes since the last call. Does nothing if the ImageJ window is not present. */ public static void showProgress(double progress) { + if (ignoreStatusAndProgressUpdates) return; if (progressBar!=null) progressBar.show(progress, false); } @@ -783,6 +795,7 @@ public static void showProgress(double progress) { * 'currentIndex' is negative (example: Plugins/Utilities/Benchmark). */ public static void showProgress(int currentIndex, int finalIndex) { + if (ignoreStatusAndProgressUpdates) return; if (progressBar!=null) { progressBar.show(currentIndex, finalIndex); if (currentIndex==finalIndex)