protected String getMimeTypeByFileName() {
   String mimeType = null;
   Path path = fResource.getPath();
   String extension = path.getFileExtension();
   if (extension != null) {
     String fileName = path.getFileName();
     mimeType = fDetector.getMimeTypeByExtension(fileName);
   }
   return mimeType;
 }
 protected String getMimeTypeByContent() throws IOException {
   IContentAdapter content = fResource.getAdapter(IContentAdapter.class);
   InputStream input = content.getContentInput();
   try {
     if (!input.markSupported()) {
       input = new BufferedInputStream(input);
     }
     String mimeType = fDetector.getMimeType(input);
     if (mimeType != null) {
       int idx = mimeType.lastIndexOf(';');
       if (idx > 0) {
         mimeType = mimeType.substring(0, idx);
       }
     }
     return mimeType;
   } finally {
     input.close();
   }
 }