if (editorInput instanceof IStorageEditorInput) {
final IStorageEditorInput sei = (IStorageEditorInput) editorInput;
try {
final IStorage storage = sei.getStorage();
if (storage instanceof IEncodedStorage) {
<BUG>final IEncodedStorage encodedStorage = (IEncodedStorage) storage;
return encodedStorage.getCharset();

}</BUG>
} catch (final CoreException e) {

if (editorInput instanceof IStorageEditorInput) {
final IStorageEditorInput sei = (IStorageEditorInput) editorInput;
try {
final IStorage storage = sei.getStorage();
if (storage instanceof IEncodedStorage) {
final IEncodedStorage encodedStorage = (IEncodedStorage) storage;
try {
return Charset.forName(encodedStorage.getCharset());
} catch (Exception e) {
return Charsets.UTF_8;
