Bug 24168 [Dialogs] XML dialog settings cannot start with a comment
I created a dialog_settings.xml for my plugin, and entered on the very first line a comment: the settings then fail to load with ClassCastException. An easy workaround is to push the comment down into the XML tree. org.eclipse.jface.dialogs.DialogSettings line 181: Element root = (Element) document.getFirstChild(); If the first child is not an element (e.g. a comment), ClassCastException is thrown.
bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/DialogSettings.java
items.put(key,value);
}
/* (non-Javadoc)
 * Method declared on IDialogSettings.
 */
public void put(String key,boolean value) {
	put(key,String.valueOf(value));
}
/* (non-Javadoc)
 * Method declared on IDialogSettings.
 */
public void save(Writer writer) throws IOException {
	Document document = new DocumentImpl();
	save(document, (Node) document);
	OutputFormat format = new OutputFormat();
	Serializer serializer = SerializerFactory.getSerializerFactory("xml").makeSerializer(writer, format);
	serializer.asDOMSerializer().serialize(document);
}
/* (non-Javadoc)
 * Method declared on IDialogSettings.
 */
public void save(String fileName) throws IOException {
	FileOutputStream stream = new FileOutputStream(fileName);
	OutputStreamWriter writer = new OutputStreamWriter(stream, "utf-8");
	save(writer);
	writer.close();
}
/* (non-Javadoc)
 * Save the settings in the <code>document</code>.
 */