Example #1
0
  private void copyActions(List<Action> actions) {
    if (actions.isEmpty()) return;

    ICSpecXMLFactory factory = ICSpecXMLFactory.eINSTANCE;
    IActionsType at = factory.createActionsType();
    xmlSpec.getActions().add(at);
    for (Action action : actions) {
      IAction xmlAction = factory.createAction();
      copyAction(action, xmlAction);
      if (action.isPublic()) at.getPublic().add(xmlAction);
      else at.getPrivate().add(xmlAction);
    }
  }
Example #2
0
  private void copyAction(Action attr, IAction xmlAttr) {
    copyAttribute(attr, xmlAttr);
    xmlAttr.setFilter(attr.getFilter());

    if (!attr.getPrerequisites().isEmpty()) {
      IPrerequisites xps = ICSpecXMLFactory.eINSTANCE.createPrerequisites();
      xmlAttr.getPrerequisites().add(xps);
      xps.setAlias(attr.getPrerequisitesAlias());
      xps.setRebase(createStringFromPath(attr.getPrerequisitesRebase()));
      copyPrerequisites(attr.getPrerequisites(), xps.getAttribute());
    }
    IProductsType pt = ICSpecXMLFactory.eINSTANCE.createProductsType();
    xmlAttr.getProducts().add(pt);
    PathGroup product = attr.getProduct();
    if (product != null) {
      pt.setBase(createStringFromPath(product.getBase()));
      copyPathGroup(product, pt);
    } else {
      for (ActionAttribute aa : attr.getProducts()) {
        IActionArtifact xmlAa = ICSpecXMLFactory.eINSTANCE.createActionArtifact();
        xmlAa.setAlias(aa.getAlias());
        copyArtifact(aa, xmlAa);
        if (aa.isPublic()) pt.getPublic().add(xmlAa);
        else pt.getPrivate().add(xmlAa);
      }
    }
    pt.setAlias(attr.getProductAlias());
    pt.setFileCount(attr.getProductFileCount());
    pt.setUpToDatePolicy(
        org.eclipse.buckminster.cspecxml.UpToDatePolicy.valueOf(
            attr.getUpToDatePolicy().getName()));
    pt.setPattern(attr.getPattern());
    pt.setReplacement(attr.getReplacement());
  }