示例#1
0
 void add(@NonNull RenderPreview preview) {
   Configuration configuration = preview.getConfiguration();
   ConfigurationDescription description =
       ConfigurationDescription.fromConfiguration(mProject, configuration);
   // RenderPreviews can have display names that aren't reflected in the configuration
   description.displayName = preview.getDisplayName();
   mList.add(description);
   preview.setDescription(description);
 }
示例#2
0
 private void save(File file) throws IOException {
   // Document document = DomUtilities.createEmptyPlainDocument();
   Document document = DomUtilities.createEmptyDocument();
   if (document != null) {
     for (ConfigurationDescription description : mList) {
       description.toXml(document);
     }
     String xml = EclipseXmlPrettyPrinter.prettyPrint(document, true);
     Files.write(xml, file, Charsets.UTF_8);
   }
 }
示例#3
0
  void load(File file, Collection<Device> deviceList) throws IOException {
    mList.clear();

    String xml = Files.toString(file, Charsets.UTF_8);
    Document document = DomUtilities.parseDocument(xml, true);
    if (document == null || document.getDocumentElement() == null) {
      return;
    }
    List<Element> elements = DomUtilities.getChildren(document.getDocumentElement());
    for (Element element : elements) {
      ConfigurationDescription description =
          ConfigurationDescription.fromXml(mProject, element, deviceList);
      if (description != null) {
        mList.add(description);
      }
    }
  }