public void addNotationInfo(RootContainer rootContainer, IEditorInput input) {
   try {
     IFile file = getNotationInfoFile(((FileEditorInput) input).getFile());
     if (file.exists()) {
       Element notationInfo =
           documentBuilderFactory
               .newDocumentBuilder()
               .parse(file.getContents())
               .getDocumentElement();
       Element changedInfo = convertCheck(notationInfo);
       processRootContainer(rootContainer, changedInfo == null ? notationInfo : changedInfo);
       if (changedInfo != null) {
         file.setContents(
             new ByteArrayInputStream(toNotationInfoXml(rootContainer).getBytes()),
             true,
             true,
             null);
       }
     } else {
       file.create(
           new ByteArrayInputStream(createInitialNotationInfo().toString().getBytes()),
           true,
           null);
     }
   } catch (Exception e) {
     Logger.logError("Problem adding notation info", e);
     throw new RuntimeException(e);
   }
 }
 private void createNotationInfoFile(IFile notationInfoFile) {
   try {
     notationInfoFile.create(
         new ByteArrayInputStream(createInitialNotationInfo().toString().getBytes()), true, null);
   } catch (CoreException e) {
     Logger.logError(e);
   }
 }
 private void write(RootContainer rootContainer, Writer writer) {
   try {
     Document document = documentBuilderFactory.newDocumentBuilder().newDocument();
     Element root = document.createElement("root-container");
     document.appendChild(root);
     write(rootContainer, root);
     DOMSource domSource = new DOMSource(root);
     Transformer transformer = transformerFactory.newTransformer();
     transformer.setOutputProperty(OutputKeys.INDENT, "yes");
     StreamResult streamResult = new StreamResult(writer);
     transformer.transform(domSource, streamResult);
     //			transformer.transform(domSource, new StreamResult(System.out));
   } catch (Exception e) {
     Logger.logError("Problem while saving to disk", e);
   }
 }
 public boolean saveToInput(IEditorInput input, RootContainer rootContainer) {
   boolean result = true;
   try {
     IFile file = getNotationInfoFile(((IFileEditorInput) input).getFile());
     Element notationInfo =
         documentBuilderFactory
             .newDocumentBuilder()
             .parse(file.getContents())
             .getDocumentElement();
     if (upToDateCheck(notationInfo)) {
       getNotationInfoFile(((IFileEditorInput) input).getFile())
           .setContents(
               new ByteArrayInputStream(toNotationInfoXml(rootContainer).getBytes()),
               true,
               true,
               null);
     } else {
       result = false;
     }
   } catch (Exception e) {
     Logger.logError("Problem while saving the input.", e);
   }
   return result;
 }