File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
src/main/java/org/scijava/plugins/scripting/python Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 3434import java .nio .file .Files ;
3535import java .nio .file .Path ;
3636import java .util .Comparator ;
37+ import java .util .function .Consumer ;
3738import java .util .stream .Stream ;
3839
3940import org .apposed .appose .Appose ;
5556@ Plugin (type = Command .class , label = "Rebuild Python environment" )
5657public class RebuildEnvironment implements Command {
5758
59+ private static final int _PROGRESS_LENGTH = 80 ;
60+
5861 @ Parameter
5962 private AppService appService ;
6063
@@ -70,6 +73,8 @@ public class RebuildEnvironment implements Command {
7073 @ Parameter (required = false )
7174 private UIService uiService ;
7275
76+ private int progressPrinted = 0 ;
77+
7378 // -- OptionsPython methods --
7479
7580 @ Override
@@ -150,12 +155,25 @@ public void run() {
150155 }
151156
152157 private void reportErr (String s ) {
153- if (s .isEmpty ()) System .err .print ("." );
154- else log .error (s );
158+ report (s , log ::error );
155159 }
156160
157161 private void reportMsg (String s ) {
158- if (s .isEmpty ()) System .err .print ("." );
159- else log .info (s );
162+ report (s , log ::info );
160163 }
164+
165+ private void report (String s , Consumer <String > reporter ) {
166+ if (s .isEmpty ()) {
167+ System .err .print ("." );
168+ progressPrinted ++;
169+ if (progressPrinted >= _PROGRESS_LENGTH ) {
170+ System .err .println ();
171+ progressPrinted = 0 ;
172+ }
173+ }
174+ else {
175+ progressPrinted = 0 ;
176+ reporter .accept (s );
177+ }
178+ }
161179}
You can’t perform that action at this time.
0 commit comments