if (_metadataFolder.exists()) {
_metadataFile = _metadataFolder.getFile(_tmlFile.getName().substring(0, _tmlFile.getName().length() - _tmlFile.getFileExtension().length()) + "metadata.xml");
if (_metadataFile.exists()) {
XStream xstream = new XStream(new DomDriver());
xstream.alias(TMLMetadataInfo.XSTREAM_ALIAS, TMLMetadataInfo.class);
Reader reader = null;
try {
if(!_metadataFile.isSynchronized(IResource.DEPTH_ZERO)){
_metadataFile.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
}
reader = new InputStreamReader(_metadataFile.getContents(), _fileEncoding);
TMLMetadataInfo metaData = (TMLMetadataInfo) xstream.fromXML(reader);
directAccess = metaData.isDirectAccess();
cacheable = metaData.isCacheable();
description = metaData.getDescription();
category = metaData.getCategory();
} catch (CoreException e) {
IOException ioe = new IOException("Unable to read metadata file of tml resource '" + _tmlFile.getLocation() + "'.");
ioe.setStackTrace(e.getStackTrace());
throw ioe;
} finally {
if (reader != null) {
try {
reader.close();
} catch (IOException e) {
}
}
}
}