use of org.eclipse.jst.server.core.internal.XMLMemento in project webtools.servertools by eclipse.
the class RuntimeClasspathProviderDelegate method save.
/**
* Save source attachment info.
*/
private synchronized void save() {
List<SourceAttachmentUpdate> srcAttachments = sourceAttachments;
if (srcAttachments == null)
return;
String id = extensionId;
String filename = JavaServerPlugin.getInstance().getStateLocation().append(id + ".xml").toOSString();
try {
XMLMemento memento = XMLMemento.createWriteRoot("classpath");
Iterator iterator = srcAttachments.iterator();
while (iterator.hasNext()) {
SourceAttachmentUpdate sau = (SourceAttachmentUpdate) iterator.next();
IMemento child = memento.createChild("source-attachment");
child.putString("runtime-id", sau.runtimeId);
if (sau.entry != null)
child.putString("entry", sau.entry.toPortableString());
if (sau.sourceAttachmentPath != null)
child.putString("source-attachment-path", sau.sourceAttachmentPath.toPortableString());
if (sau.sourceAttachmentRootPath != null)
child.putString("source-attachment-root-path", sau.sourceAttachmentRootPath.toPortableString());
if (sau.attributes != null) {
for (IClasspathAttribute attr : sau.attributes) {
IMemento attrChild = child.createChild("attribute");
attrChild.putString("name", attr.getName());
attrChild.putString("value", attr.getValue());
}
}
}
memento.saveToFile(filename);
} catch (Exception e) {
if (Trace.SEVERE) {
Trace.trace(Trace.STRING_SEVERE, "Error saving source path info", e);
}
}
}
Aggregations