if (_metadataFolder.members().length == 0) {
_metadataFolder.delete(false, new NullProgressMonitor());
}
reload();
} catch (CoreException e) {
IOException ioe = new IOException("Unable to delete meta data file '" + _metadataFile.getLocation() + "'.");
ioe.setStackTrace(e.getStackTrace());
throw ioe;
}
}
} else {
TMLMetadataInfo metaData = new TMLMetadataInfo();
metaData.setDirectAccess(directAccess);
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();