use of org.eclipse.core.runtime.preferences.PreferenceFilterEntry in project mdw-designer by CenturyLinkCloud.
the class WorkspaceConfigurator method loadPreferences.
/**
* Loads preferences from the workspace setup site.
*
* @return <code>true</code> if the load was successful
*/
protected boolean loadPreferences() {
// import all
IPreferenceFilter[] filters = new IPreferenceFilter[1];
filters[0] = new IPreferenceFilter() {
public String[] getScopes() {
return new String[] { InstanceScope.SCOPE, ConfigurationScope.SCOPE };
}
public Map<String, PreferenceFilterEntry[]> getMapping(String scope) {
return null;
}
};
String baseUrl = getWorkspaceConfig().getMdwSettings().getWorkspaceSetupUrl();
if (!baseUrl.endsWith("/"))
baseUrl += "/";
InputStream is = null;
try {
URL url = new URL(baseUrl + "MdwWorkspaceSetup.epf");
URLConnection connection = url.openConnection();
is = connection.getInputStream();
IPreferencesService service = Platform.getPreferencesService();
IExportedPreferences prefs = service.readPreferences(is);
service.applyPreferences(prefs, filters);
} catch (Exception ex) {
PluginMessages.uiError(getShell(), ex, "Workspace Setup");
return false;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException e) {
// do nothing
}
}
}
return true;
}
Aggregations