* This framework method may be overridden, although this is typically
* unnecessary.
* </p>
*/
protected void loadDialogSettings() {
dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
// bug 69387: The instance area should not be created (in the call to
// #getStateLocation) if -data @none or -data @noDefault was used
IPath dataLocation = getStateLocationOrNull();
if (dataLocation != null) {
// try r/w state area in the local file system
String readWritePath = dataLocation.append(FN_DIALOG_SETTINGS)
.toOSString();
File settingsFile = new File(readWritePath);
if (settingsFile.exists()) {
try {
dialogSettings.load(readWritePath);
} catch (IOException e) {
// load failed so ensure we have an empty settings
dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
}
return;
}
}
// otherwise look for bundle specific dialog settings
URL dsURL = BundleUtility.find(getBundle(), FN_DIALOG_SETTINGS);
if (dsURL == null) {
return;
}
InputStream is = null;
try {
is = dsURL.openStream();
BufferedReader reader = new BufferedReader(
new InputStreamReader(is, "utf-8")); //$NON-NLS-1$
dialogSettings.load(reader);
} catch (IOException e) {
// load failed so ensure we have an empty settings
dialogSettings = new DialogSettings("Workbench"); //$NON-NLS-1$
} finally {
try {
if (is != null) {
is.close();
}