/** @generated */
 public static void setCharset(IFile file) {
   if (file == null) {
     return;
   }
   try {
     file.setCharset("UTF-8", new NullProgressMonitor()); // $NON-NLS-1$
   } catch (CoreException e) {
     SubsumptionDiagramEditorPlugin.getInstance()
         .logError("Unable to set charset for file " + file.getFullPath(), e); // $NON-NLS-1$
   }
 }
 /** @generated */
 public static void setCharset(IFile file) {
   if (file == null) {
     return;
   }
   try {
     file.setCharset("UTF-8", new NullProgressMonitor()); // $NON-NLS-1$
   } catch (CoreException e) {
     edu.toronto.cs.se.modelepedia.statemachine_mavo.diagram.part
         .StateMachine_MAVODiagramEditorPlugin.getInstance()
         .logError("Unable to set charset for file " + file.getFullPath(), e); // $NON-NLS-1$
   }
 }
 private void createFile(
     final IProject project, final IPath fileName, final String content, final IProgressMonitor mo)
     throws CoreException {
   try {
     IFile file = project.getFile(fileName);
     // file may exist if project is created from source version control
     if (!file.exists()) {
       InputStream is = new ByteArrayInputStream(content.getBytes(FileUtil.UTF8));
       IProgressMonitor monitor = new SubProgressMonitor(mo, 1);
       file.create(is, true, monitor);
       file.setCharset(FileUtil.UTF8, mo);
     }
   } catch (UnsupportedEncodingException uex) {
     HaskellCorePlugin.log(uex);
   }
 }
 private void saveContent(
     PackageFragment dest, String destName, TextEdit edits, String sourceEncoding, IFile destFile)
     throws JavaModelException {
   try {
     // TODO (frederic) remove when bug 67606 will be fixed (bug 67823)
     // fix bug 66898
     if (sourceEncoding != null) destFile.setCharset(sourceEncoding, this.progressMonitor);
     // end todo
   } catch (CoreException ce) {
     // use no encoding
   }
   // when the file was copied, its read-only flag was preserved -> temporary set it to false
   // note this doesn't interfere with repository providers as this is a new resource that cannot
   // be under
   // version control yet
   Util.setReadOnly(destFile, false);
   ICompilationUnit destCU = dest.getCompilationUnit(destName);
   applyTextEdit(destCU, edits);
   destCU.save(getSubProgressMonitor(1), this.force);
 }
 // TODO We just copy the content properties encoding to current resource's
 // encoding for now. May improve the UI later by setting an informational
 // message and/or disable the content properties encoding field.
 // TODO make priviate if needed, else remove
 void migrateContentPropertiesEncoding(String encoding) throws CoreException {
   if (fIFile != null) fIFile.setCharset(encoding, null);
   final IFile file = fIFile;
   final String charset = encoding;
   // TODO: externalize string later
   Job migrater = new Job(SSECoreMessages.Migrate_Charset) { // $NON-NLS-1$
         protected IStatus run(IProgressMonitor monitor) {
           if (file != null) {
             try {
               file.setCharset(charset, null);
             } catch (CoreException e) {
               Logger.logException(e);
             }
           }
           return Status.OK_STATUS;
         }
       };
   migrater.setSystem(true);
   migrater.schedule();
 }