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 34
34
import java .nio .file .Files ;
35
35
import java .nio .file .Path ;
36
36
import java .util .Comparator ;
37
+ import java .util .function .Consumer ;
37
38
import java .util .stream .Stream ;
38
39
39
40
import org .apposed .appose .Appose ;
55
56
@ Plugin (type = Command .class , label = "Rebuild Python environment" )
56
57
public class RebuildEnvironment implements Command {
57
58
59
+ private static final int _PROGRESS_LENGTH = 80 ;
60
+
58
61
@ Parameter
59
62
private AppService appService ;
60
63
@@ -70,6 +73,8 @@ public class RebuildEnvironment implements Command {
70
73
@ Parameter (required = false )
71
74
private UIService uiService ;
72
75
76
+ private int progressPrinted = 0 ;
77
+
73
78
// -- OptionsPython methods --
74
79
75
80
@ Override
@@ -150,12 +155,25 @@ public void run() {
150
155
}
151
156
152
157
private void reportErr (String s ) {
153
- if (s .isEmpty ()) System .err .print ("." );
154
- else log .error (s );
158
+ report (s , log ::error );
155
159
}
156
160
157
161
private void reportMsg (String s ) {
158
- if (s .isEmpty ()) System .err .print ("." );
159
- else log .info (s );
162
+ report (s , log ::info );
160
163
}
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
+ }
161
179
}
You can’t perform that action at this time.
0 commit comments