use of org.eclipse.core.resources.IEncodedStorage in project xtext-eclipse by eclipse.
the class XtextDocumentProvider method getEncoding.
@Override
public String getEncoding(Object element) {
String encoding = super.getEncoding(element);
if (encoding == null && element instanceof IStorageEditorInput) {
try {
IStorage storage = ((IStorageEditorInput) element).getStorage();
URI uri = storage2UriMapper.getUri(storage);
if (uri != null) {
encoding = encodingProvider.getEncoding(uri);
} else if (storage instanceof IEncodedStorage) {
encoding = ((IEncodedStorage) storage).getCharset();
}
} catch (CoreException e) {
throw new WrappedException(e);
}
}
if (encoding == null) {
if (isWorkspaceExternalEditorInput(element))
encoding = getWorkspaceExternalEncoding((IURIEditorInput) element);
else
encoding = getWorkspaceOrDefaultEncoding();
}
return encoding;
}
Aggregations