return (String[]) set.toArray(new String[set.size()]);
}
private void initialize() {
this.userLibraries = new HashMap();
IEclipsePreferences instancePreferences = JavaModelManager.getJavaModelManager().getInstancePreferences();
String[] propertyNames;
try {
propertyNames = instancePreferences.keys();
} catch (BackingStoreException e) {
Util.log(e, "Exception while initializing user libraries"); //$NON-NLS-1$
return;
}
boolean preferencesNeedFlush = false;
for (int i = 0, length = propertyNames.length; i < length; i++) {
String propertyName = propertyNames[i];
if (propertyName.startsWith(CP_USERLIBRARY_PREFERENCES_PREFIX)) {
String propertyValue = instancePreferences.get(propertyName, null);
if (propertyValue != null) {
String libName= propertyName.substring(CP_USERLIBRARY_PREFERENCES_PREFIX.length());
StringReader reader = new StringReader(propertyValue);
UserLibrary library;
try {
library = UserLibrary.createFromString(reader);
} catch (IOException e) {
Util.log(e, "Exception while initializing user library " + libName); //$NON-NLS-1$
instancePreferences.remove(propertyName);
preferencesNeedFlush = true;
continue;
}
this.userLibraries.put(libName, library);
}
}
}
if (preferencesNeedFlush) {
try {
instancePreferences.flush();
} catch (BackingStoreException e) {
Util.log(e, "Exception while flusing instance preferences"); //$NON-NLS-1$
}
}
}