metaData.setDescription(description);
metaData.setCacheable(cacheable);
metaData.setCategory(category);
XStream xstream = new XStream(new DomDriver());
xstream.alias(TMLMetadataInfo.XSTREAM_ALIAS, TMLMetadataInfo.class);
Writer writer = null;
try {
if (!_metadataFolder.exists()) {
_metadataFolder.create(true, true, new NullProgressMonitor());
_metadataFile = _metadataFolder.getFile(_tmlFile.getName().substring(0, _tmlFile.getName().length() - _tmlFile.getFileExtension().length()) + "metadata.xml");
}
writer = new OutputStreamWriter(new FileOutputStream(_metadataFile.getLocation().toFile()), _fileEncoding);
xstream.toXML(metaData, writer);
} catch (CoreException e) {
IOException ioe = new IOException("Unable to save metadata file '" + _metadataFile.getLocation() + "'.");
ioe.setStackTrace(e.getStackTrace());
throw ioe;
} finally {
if (writer != null) {
try {
writer.close();
} catch (IOException e) {
}
try {
if(_metadataFile!=null){
_metadataFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());