Community
Participate
Working Groups
org.eclipse.ui.plugin.AbstractUIPlugin.loadDialogSettings() is using URLgetFile() this will fail when the install directory is not local see initializePluginPreferences for an example of using a stream NOTES:
Posted the following in response to a questoin on EC Thank you Mazen. You are correct in your diagnosis. This is a know bug #2046 I am curious to know why you want to use a default DialogSettings file and how you created it. Since we have not published a spec for this file we are wondering if the correct "fix" is to fix the code or change the spec for loadDialogSettings(). You can ofcourse override this method in you own plugin. Here is some source that does what the comment claims protected void loadDialogSettings() { dialogSettings = new DialogSettings("Workbench");//$NON-NLS-1$ // try r/w state area in the local file system String readWritePath = getStateLocation().append(FN_DIALOG_SETTINGS).toOSString (); File settingsFile = new File(readWritePath); if (settingsFile.exists()) { try { dialogSettings.load(readWritePath); } catch (IOException e) { dialogSettings = new DialogSettings("Workbench"); // load failed so ensure we have an empty settings//$NON-NLS-1$ } } else { // not found - use installed defaults if available URL baseURL = getDescriptor().getInstallURL(); URL dsURL = null; try { dsURL = new URL(baseURL, FN_DIALOG_SETTINGS); } catch (MalformedURLException e) { return; } InputStream is = null; try { is = dsURL.openStream(); InputStreamReader reader = new InputStreamReader(is, "utf-8"); dialogSettings.load(reader); } catch (IOException e) { dialogSettings = new DialogSettings("Workbench"); // load failed so ensure we have an empty settings//$NON-NLS-1$ } finally { try { if (is != null) is.close(); } catch (IOException e) {} } } }
Reply from EC Randy, the specs are great :-) so please don't change them.... The only missing piece is the DTD for the dialog_settings.xml file. What I did is I ran my Wizard once, this generates the dialog_settings.xml in the r/w directory of my plugin. I then shutdown, copied the generated dialog_settings.xml file to my plugin's install directory, edited the values, deleted the initial dialog_settings.xml in the r/w directory and relaunched Eclipse, hopping to see my Wizard populated. I want to be able to ship default Wizard settings (similar to Preference Store hardcoded defaults values versus Preferences.ini). It's not must, I can hard code defaults, but it is nice to have. regards, Mazen...
PRODUCT VERSION: 106
fixed > 20020319