Lines 14-19
Link Here
|
14 |
package org.netbeans.updater; |
14 |
package org.netbeans.updater; |
15 |
|
15 |
|
16 |
import java.awt.*; |
16 |
import java.awt.*; |
|
|
17 |
import java.util.Locale; |
17 |
import javax.swing.*; |
18 |
import javax.swing.*; |
18 |
import java.io.*; |
19 |
import java.io.*; |
19 |
import java.beans.PropertyChangeListener; |
20 |
import java.beans.PropertyChangeListener; |
Lines 56-62
Link Here
|
56 |
private static Window splashWindow; |
57 |
private static Window splashWindow; |
57 |
|
58 |
|
58 |
/** For external running Updater without GUI */ |
59 |
/** For external running Updater without GUI */ |
59 |
private static boolean nongui = false; |
60 |
private static boolean noSplash = false; |
60 |
|
61 |
|
61 |
/** Creates new form UpdaterFrame */ |
62 |
/** Creates new form UpdaterFrame */ |
62 |
public UpdaterFrame() { |
63 |
public UpdaterFrame() { |
Lines 181-191
Link Here
|
181 |
* @param args the command line arguments |
182 |
* @param args the command line arguments |
182 |
*/ |
183 |
*/ |
183 |
public static void main (String args[]) { |
184 |
public static void main (String args[]) { |
184 |
if ( args.length > 0 && args[0].equals( "-nodisplay" ) ) // NOI18N |
185 |
if (args.length > 0) { |
185 |
nongui = true; |
186 |
cli (args); |
186 |
else { |
187 |
} |
|
|
188 |
|
189 |
if (!noSplash) { |
187 |
panel = new UpdaterFrame (); |
190 |
panel = new UpdaterFrame (); |
188 |
showSplash(); |
191 |
showSplash (); |
189 |
} |
192 |
} |
190 |
|
193 |
|
191 |
mu = new ModuleUpdater(); |
194 |
mu = new ModuleUpdater(); |
Lines 239-245
Link Here
|
239 |
|
242 |
|
240 |
static void setLabel( final String text ) { |
243 |
static void setLabel( final String text ) { |
241 |
|
244 |
|
242 |
if ( nongui ) return; |
245 |
if (noSplash) return; |
243 |
|
246 |
|
244 |
final javax.swing.JLabel label = panel.textLabel; |
247 |
final javax.swing.JLabel label = panel.textLabel; |
245 |
|
248 |
|
Lines 254-260
Link Here
|
254 |
|
257 |
|
255 |
static void setProgressRange( final long min, final long max ) { |
258 |
static void setProgressRange( final long min, final long max ) { |
256 |
|
259 |
|
257 |
if ( nongui ) return; |
260 |
if (noSplash) return; |
258 |
|
261 |
|
259 |
bigBounds = max > 0xFFFF; |
262 |
bigBounds = max > 0xFFFF; |
260 |
|
263 |
|
Lines 272-278
Link Here
|
272 |
|
275 |
|
273 |
static void setProgressValue( final long value ) { |
276 |
static void setProgressValue( final long value ) { |
274 |
|
277 |
|
275 |
if ( nongui ) return; |
278 |
if (noSplash) return; |
276 |
|
279 |
|
277 |
final javax.swing.JProgressBar progressBar = panel.progressBar; |
280 |
final javax.swing.JProgressBar progressBar = panel.progressBar; |
278 |
final boolean bb = bigBounds; |
281 |
final boolean bb = bigBounds; |
Lines 393-398
Link Here
|
393 |
public java.awt.Dimension getPreferredSize () { |
396 |
public java.awt.Dimension getPreferredSize () { |
394 |
return stringToDimension("UpdaterFrame.Splash.PreferredSize", new Dimension (400, 280)); |
397 |
return stringToDimension("UpdaterFrame.Splash.PreferredSize", new Dimension (400, 280)); |
395 |
} |
398 |
} |
|
|
399 |
} |
400 |
|
401 |
// copied from core/CLIOptions |
402 |
|
403 |
private static boolean isOption (String value, String optionName) { |
404 |
if (value == null) return false; |
405 |
|
406 |
if (value.startsWith ("--")) { |
407 |
return value.substring (2).equals (optionName); |
408 |
} else if (value.startsWith ("-")) { |
409 |
return value.substring (1).equals (optionName); |
410 |
} |
411 |
return false; |
412 |
} |
413 |
|
414 |
private static int cli(String[] args) { |
415 |
// let's go through the command line |
416 |
for (int i = 0; i < args.length; i++) { |
417 |
if (args[i] == null) { |
418 |
continue; |
419 |
} |
420 |
if (isOption (args[i], "nosplash")) { // NOI18N |
421 |
UpdaterFrame.noSplash = true; |
422 |
} else if (isOption (args[i], "locale")) { // NOI18N |
423 |
args[i] = null; |
424 |
String localeParam = args[++i]; |
425 |
String language; |
426 |
String country = ""; // NOI18N |
427 |
String variant = ""; // NOI18N |
428 |
int index1 = localeParam.indexOf(":"); // NOI18N |
429 |
if (index1 == -1) |
430 |
language = localeParam; |
431 |
else { |
432 |
language = localeParam.substring(0, index1); |
433 |
int index2 = localeParam.indexOf(":", index1+1); // NOI18N |
434 |
if (index2 != -1) { |
435 |
country = localeParam.substring(index1+1, index2); |
436 |
variant = localeParam.substring(index2+1); |
437 |
} |
438 |
else |
439 |
country = localeParam.substring(index1+1); |
440 |
} |
441 |
Locale.setDefault(new Locale(language, country, variant)); |
442 |
} else if (isOption (args[i], "branding")) { // NOI18N |
443 |
args[i] = null; |
444 |
if (++i == args.length) { |
445 |
System.err.println("Option --branding requires one argument."); |
446 |
return 2; |
447 |
} |
448 |
String branding = args[i]; |
449 |
if (branding.equals("-")) branding = null; // NOI18N |
450 |
try { |
451 |
Localization.setBranding(branding); |
452 |
} catch (IllegalArgumentException iae) { |
453 |
iae.printStackTrace(); |
454 |
return 1; |
455 |
} |
456 |
} |
457 |
} |
458 |
|
459 |
return 0; |
396 |
} |
460 |
} |
397 |
|
461 |
|
398 |
} |
462 |
} |