@@ -110,8 +110,9 @@ static boolean download(URL source, File dest, ProgressMonitor progress) {
110110 // Hiding stack trace. An error has been shown where needed.
111111// ioe.printStackTrace();
112112 }
113- if (progress != null )
113+ if (progress != null ) {
114114 progress .finished ();
115+ }
115116 return success ;
116117 }
117118
@@ -154,8 +155,9 @@ public void run() {
154155 contribListing .replaceContribution (ad , contribution );
155156 if (contribution .getType () == ContributionType .MODE ) {
156157 ArrayList <ModeContribution > contribModes = editor .getBase ().getModeContribs ();
157- if (!contribModes .contains (contribution ))
158+ if (!contribModes .contains (contribution )) {
158159 contribModes .add ((ModeContribution ) contribution );
160+ }
159161 }
160162 refreshInstalled (editor );
161163 }
@@ -232,8 +234,9 @@ public void run() {
232234 contribModes .add ((ModeContribution ) contribution );
233235 }
234236 }
235- if (base .getActiveEditor () != null )
237+ if (base .getActiveEditor () != null ) {
236238 refreshInstalled (base .getActiveEditor ());
239+ }
237240 }
238241
239242 contribZip .delete ();
@@ -243,13 +246,12 @@ public void run() {
243246 } catch (Exception e ) {
244247// Chuck the stack trace. The user might have no idea why it is appearing, or what (s)he did wrong...
245248// e.printStackTrace();
246- System . out . println ( "Error during download and install of "
247- + ad .getName ());
249+ String arg = "contrib.startup.errors.download_install" ;
250+ System . err . println ( Language . interpolate ( arg , ad .getName () ));
248251 }
249252 } catch (IOException e ) {
250- System .err
251- .println ("Could not write to temporary directory during download and install of "
252- + ad .getName ());
253+ String arg = "contrib.startup.errors.temp_dir" ;
254+ System .err .println (Language .interpolate (arg , ad .getName ()));
253255 }
254256 }
255257 }, "Contribution Installer" ).start ();
@@ -288,8 +290,8 @@ public boolean accept(File dir, String file) {
288290 } catch (IOException e ) {
289291// Again, forget about the stack trace. The user ain't done wrong
290292// e.printStackTrace();
291- System . err . println ( "The unupdated contribution marker seems to not like "
292- + ac .getName () + ". You may have to install it manually to update..." );
293+ String arg = "contrib.startup.errors.new_marker" ;
294+ System . err . println ( Language . interpolate ( arg , ac .getName ()) );
293295 }
294296
295297 }
@@ -311,12 +313,17 @@ public static void downloadAndInstallOnImport(final Base base,
311313 // during pre-processing
312314 base .getActiveEditor ().getTextArea ().setEditable (false );
313315 base .getActiveEditor ().getConsole ().clear ();
314-
316+
315317 ArrayList <String > installedLibList = new ArrayList <String >();
316318
319+ // boolean variable to check if previous lib was installed successfully,
320+ // to give the user an idea about progress being made.
321+ boolean isPrevDone = false ;
322+
317323 for (AvailableContribution ad : aList ) {
318- if (ad .getType () != ContributionType .LIBRARY )
324+ if (ad .getType () != ContributionType .LIBRARY ) {
319325 continue ;
326+ }
320327 try {
321328 URL url = new URL (ad .link );
322329 String filename = url .getFile ();
@@ -332,55 +339,63 @@ public static void downloadAndInstallOnImport(final Base base,
332339 // one install is completed and the next download has begun without
333340 // interfereing with occur status messages that may arise in the meanwhile
334341 String statusMsg = base .getActiveEditor ().getStatusMessage ();
335- if (statusMsg .contains ("has been installed" ))
336- base .getActiveEditor ().statusNotice (statusMsg + " "
337- + "Downloading "
338- + ad .name + "..." );
339- else
340- base .getActiveEditor ().statusNotice ("Downloading " + ad .name
341- + "..." );
342+ if (isPrevDone ) {
343+ String status = statusMsg + " "
344+ + Language .interpolate ("contrib.import.progress.download" , ad .name );
345+ base .getActiveEditor ().statusNotice (status );
346+ }
347+ else {
348+ String arg = "contrib.import.progress.download" ;
349+ String status = Language .interpolate (arg , ad .name );
350+ base .getActiveEditor ().statusNotice (status );
351+ }
352+
353+ isPrevDone = false ;
342354
343355 download (url , contribZip , null );
344356
345- base . getActiveEditor ()
346- . statusNotice ("Installing " + ad .name + "..." );
357+ String arg = "contrib.import.progress.install" ;
358+ base . getActiveEditor (). statusNotice (Language . interpolate ( arg , ad .name ) );
347359 LocalContribution contribution = ad .install (base , contribZip ,
348360 false , null );
349361
350362 if (contribution != null ) {
351363 contribListing .replaceContribution (ad , contribution );
352- if (base .getActiveEditor () != null )
364+ if (base .getActiveEditor () != null ) {
353365 refreshInstalled (base .getActiveEditor ());
366+ }
354367 }
355368
356369 contribZip .delete ();
357370
358371 installedLibList .add (ad .name );
359- base .getActiveEditor ().statusNotice (ad .name
360- + " has been installed." );
372+ isPrevDone = true ;
373+
374+ arg = "contrib.import.progress.done" ;
375+ base .getActiveEditor ().statusNotice (Language .interpolate (arg ,ad .name ));
361376
362377 } catch (Exception e ) {
363- System . out . println ( "Error during download and install of "
364- + ad .getName ());
378+ String arg = "contrib.startup.errors.download_install" ;
379+ System . err . println ( Language . interpolate ( arg , ad .getName () ));
365380 }
366381 } catch (IOException e ) {
367- System .err
368- .println ("Could not write to temporary directory during download and install of "
369- + ad .getName ());
382+ String arg = "contrib.startup.errors.temp_dir" ;
383+ System .err .println (Language .interpolate (arg ,ad .getName ()));
370384 }
371385 } catch (MalformedURLException e1 ) {
372- System .err .println ("Error: The library " + ad . getName ()
373- + " has a weird looking download link." );
386+ System .err .println (Language . interpolate ( "contrib.import.errors.link" ,
387+ ad . getName ()) );
374388 }
375389 }
376390 base .getActiveEditor ().getTextArea ().setEditable (true );
377391 base .getActiveEditor ().statusEmpty ();
378- System .out .println ("The following libraries have been installed:" );
392+ System .out .println (Language . text ( "contrib.import.progress.final_list" ) );
379393 for (String l : installedLibList ) {
380- System .out .println (" • " + l );
394+ System .out .println (" * " + l );
381395 }
382396 }
383397
398+
384399 static public void refreshInstalled (Editor e ) {
385400
386401 Iterator <Editor > iter = e .getBase ().getEditors ().iterator ();
0 commit comments