Lines 7-13
Link Here
|
7 |
* http://www.sun.com/ |
7 |
* http://www.sun.com/ |
8 |
* |
8 |
* |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
9 |
* The Original Code is NetBeans. The Initial Developer of the Original |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2005 Sun |
10 |
* Code is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun |
11 |
* Microsystems, Inc. All Rights Reserved. |
11 |
* Microsystems, Inc. All Rights Reserved. |
12 |
*/ |
12 |
*/ |
13 |
|
13 |
|
Lines 69-74
Link Here
|
69 |
|
69 |
|
70 |
/** Holds value of property localizing bundle in update center declaration. */ |
70 |
/** Holds value of property localizing bundle in update center declaration. */ |
71 |
private String localizingBundleName; |
71 |
private String localizingBundleName; |
|
|
72 |
|
73 |
private boolean valid = true; |
72 |
|
74 |
|
73 |
/** Creates new XMLAutoupdateType */ |
75 |
/** Creates new XMLAutoupdateType */ |
74 |
public XMLAutoupdateType() { |
76 |
public XMLAutoupdateType() { |
Lines 248-253
Link Here
|
248 |
return sb.toString(); |
250 |
return sb.toString(); |
249 |
} |
251 |
} |
250 |
|
252 |
|
|
|
253 |
boolean isValid () { |
254 |
return valid; |
255 |
} |
256 |
|
251 |
/** What to replace by what in URL string |
257 |
/** What to replace by what in URL string |
252 |
*/ |
258 |
*/ |
253 |
protected String getReplacement(String whatToReplace) { |
259 |
protected String getReplacement(String whatToReplace) { |
Lines 291-306
Link Here
|
291 |
return NbBundle.getBundle (XMLAutoupdateType.class); |
297 |
return NbBundle.getBundle (XMLAutoupdateType.class); |
292 |
} |
298 |
} |
293 |
|
299 |
|
294 |
private static ResourceBundle getBundleFromName (String name) { |
300 |
private static ResourceBundle getBundleFromName (String name) throws MissingResourceException { |
295 |
ResourceBundle bundle = null; |
301 |
ResourceBundle bundle = null; |
296 |
if (name == null) { |
302 |
if (name == null) { |
297 |
bundle = getOldLocalizingBundle (); |
303 |
bundle = getOldLocalizingBundle (); |
298 |
} else { |
304 |
} else { |
299 |
try { |
305 |
bundle = NbBundle.getBundle (name); |
300 |
bundle = NbBundle.getBundle (name); |
|
|
301 |
} catch (MissingResourceException mre) { |
302 |
ErrorManager.getDefault ().notify (mre); |
303 |
} |
304 |
} |
306 |
} |
305 |
return bundle; |
307 |
return bundle; |
306 |
} |
308 |
} |
Lines 320-331
Link Here
|
320 |
|
322 |
|
321 |
protected String getDefaultURL() { |
323 |
protected String getDefaultURL() { |
322 |
if ( defaultURL == null ) { |
324 |
if ( defaultURL == null ) { |
323 |
ResourceBundle remoteBundle = getBundleFromName (localizingBundleName); |
325 |
ResourceBundle remoteBundle = null; |
324 |
assert remoteBundle != null : "remoteBundle cannot be null for localizingBundleName: " + localizingBundleName; |
|
|
325 |
try { |
326 |
try { |
|
|
327 |
remoteBundle = getBundleFromName (localizingBundleName); |
326 |
defaultURL = url_key != null ? remoteBundle.getString( url_key ) : remoteBundle.getString( "URL_Default_N" ); |
328 |
defaultURL = url_key != null ? remoteBundle.getString( url_key ) : remoteBundle.getString( "URL_Default_N" ); |
327 |
} catch (MissingResourceException mre) { |
329 |
} catch (MissingResourceException mre) { |
328 |
defaultURL = "http://"; // XXX What set if the key is not in any bundle |
330 |
// non-existent localizingBundleName |
|
|
331 |
// the module which did this setting declaration, was removed |
332 |
// return null and ignore this setting |
333 |
this.valid = false; |
334 |
return null; |
329 |
} |
335 |
} |
330 |
//System.out.println(localizingBundleName + " for <" + url_key + "> returns " + defaultURL); |
336 |
//System.out.println(localizingBundleName + " for <" + url_key + "> returns " + defaultURL); |
331 |
} |
337 |
} |
Lines 346-351
Link Here
|
346 |
ClassNotFoundException { |
352 |
ClassNotFoundException { |
347 |
URL u = null; |
353 |
URL u = null; |
348 |
try { |
354 |
try { |
|
|
355 |
// initialy is valid |
356 |
valid = true; |
357 |
|
349 |
u = (URL)in.readObject(); |
358 |
u = (URL)in.readObject(); |
350 |
String display = (String)in.readObject(); |
359 |
String display = (String)in.readObject(); |
351 |
if (display != null) |
360 |
if (display != null) |
Lines 370-379
Link Here
|
370 |
throw ode; |
379 |
throw ode; |
371 |
} |
380 |
} |
372 |
|
381 |
|
373 |
if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" )) // NOI18N |
382 |
if ( u == null || u.toString().startsWith("http://www.netbeans.org/updates/31_" )) { // NOI18N |
374 |
setURL(new URL( getDefaultURL() )); |
383 |
String urlSpec = getDefaultURL (); |
375 |
else |
384 |
if (urlSpec != null) { |
376 |
setURL(u); |
385 |
setURL(new URL( urlSpec )); |
|
|
386 |
} |
387 |
} else { |
388 |
setURL(u); |
389 |
} |
390 |
|
391 |
if (! isValid ()) { |
392 |
setEnabled (false); |
393 |
displayName = NbBundle.getMessage (XMLAutoupdateType.class, "XMLAutoupdateType_InvalidSetting", displayName); // NOI18N |
394 |
} |
395 |
|
377 |
} |
396 |
} |
378 |
|
397 |
|
379 |
} |
398 |
} |