title: Why does the GWT generator does not save my file to disk when I create a new one with context.tryCreateResource?
body: <p>I tried to generate a java file and a ui.xml file containing many buttons with the GWT deferred binding generator.</p>
  
  <p>My java file gets generated and written to my -gen location well. But the <strong>corresponding ui.xml file is not in my -gen folder</strong>, and I do not know why.</p>
  
  <p>my function crating the ui.xml file looks like:</p>
  
  <pre><code>public String generate(TreeLogger logger, GeneratorContext context,
        String typeName) throws UnableToCompleteException {
  
      try {
        SourceWriter sw = getSourceWriter(typeName, context, logger);
        assert(sw != null);
        // after the file got created, I write the class content
        /* ... */ UiBinder Java code
  
        createUiXMLFile(typeName, context, logger);
  
        sw.commit(logger); 
        // after this command the java class file is written is to -gen folder
        System.out.println("class '" + typeName +  "Generated' was created succesfully");
        return typeName + "Generated";
      } catch(Exception e) {
        e.printStackTrace();
        return null;
      }
  }
  
  
  public void createUiXMLFile(String typeName, GeneratorContext context, 
          TreeLogger logger) throws Exception {
  
      // gets the type given by the String typeName
      JClassType classType = context.getTypeOracle().getType(typeName);
      // gets the package in which the new class should get created
      String packageName = classType.getPackage().getName();
      // gets the name of the class without the package name
      String simpleName = classType.getSimpleSourceName();
      simpleName = simpleName + "Generated";
      // for us to see what classes were generated by this generator
  
      OutputStream os = context.tryCreateResource(logger, 
            packageName.replace(".", "/")+"/"+simpleName+".ui.xml");
      // it does also not work if I just use
      // context.tryCreateResource(logger, simpleName+".ui.xml");
  
      ByteArrayOutputStream baus = new ByteArrayOutputStream();
      // just for testing, that I wrote the XML code into the PrintWriter
      PrintWriter pw = new PrintWriter(baus);
  
      pw.println("&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;");
      /* the UiBinder XML code ... */
      pw.println("&lt;/ui:UiBinder&gt;");
      pw.flush();
  
      FileOutputStream fout = new FileOutputStream("C:\\...\\view\\UnicodeCharViewGenerated.ui.xml");
      fout.write(baus.toByteArray());
      fout.close();
  
      os.write(baus.toByteArray());
      context.commitResource(logger, os);
      // even after doing the commit the file is not written to the -gen location
  }
  </code></pre>
  
  <p>I guess that I forgot to call any function to add the new file to the Oracle; but I do not know what method I should call.</p>
  
  <p>If I use the FileOutputStream and write the ui.xml file direct into my Eclipse workspace, than it works. But if I comment this line out, than the compiler cannot find the .ui.xml file and
  deferred binding failed.</p>