@Override
 public boolean isReadOnly(Object element) {
   IStorage storage = EditorUtils.getStorageFromInput(element);
   if (storage != null) {
     return storage.isReadOnly();
   }
   File file = EditorUtils.getLocalFileFromInput(element);
   if (file != null) {
     return !file.isFile();
   }
   return super.isReadOnly(element);
 }
 protected boolean setDocumentContent(IDocument document, IStorage storage) throws CoreException {
   try {
     InputStream contentStream = storage.getContents();
     try {
       String encoding =
           (storage instanceof IEncodedStorage
               ? ((IEncodedStorage) storage).getCharset()
               : GeneralUtils.getDefaultFileEncoding());
       setDocumentContent(document, contentStream, encoding);
     } finally {
       ContentUtils.close(contentStream);
     }
   } catch (IOException e) {
     throw new CoreException(GeneralUtils.makeExceptionStatus(e));
   }
   return true;
 }