Search in sources :

Example 1 with NodeList

use of groovy.util.NodeList in project gradle by gradle.

the class Project method storeProjectLibraries.

private void storeProjectLibraries() {
    Node libraryTable = findOrCreateLibraryTable();
    if (projectLibraries.isEmpty()) {
        getXml().remove(libraryTable);
        return;
    }
    libraryTable.setValue(new NodeList());
    for (ProjectLibrary library : projectLibraries) {
        library.addToNode(libraryTable, pathFactory);
    }
}
Also used : Node(groovy.util.Node) NodeList(groovy.util.NodeList)

Example 2 with NodeList

use of groovy.util.NodeList in project gradle by gradle.

the class WtpFacet method load.

@Override
protected void load(Node xml) {
    NodeList fixed = (NodeList) xml.get("fixed");
    NodeList installed = (NodeList) xml.get("installed");
    for (Object n : fixed) {
        facets.add(new Facet((Node) n));
    }
    for (Object n : installed) {
        facets.add(new Facet((Node) n));
    }
}
Also used : NodeList(groovy.util.NodeList) Node(groovy.util.Node) XmlPersistableConfigurationObject(org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject)

Example 3 with NodeList

use of groovy.util.NodeList in project gradle by gradle.

the class WtpFacet method removeConfigurableDataFromXml.

private void removeConfigurableDataFromXml() {
    Node xml = getXml();
    NodeList fixed = (NodeList) xml.get("fixed");
    NodeList installed = (NodeList) xml.get("installed");
    for (Object n : fixed) {
        xml.remove((Node) n);
    }
    for (Object n : installed) {
        xml.remove((Node) n);
    }
}
Also used : Node(groovy.util.Node) NodeList(groovy.util.NodeList) XmlPersistableConfigurationObject(org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject)

Example 4 with NodeList

use of groovy.util.NodeList in project gradle by gradle.

the class AbstractClasspathEntry method writeEntryAttributes.

public void writeEntryAttributes(Node node) {
    Map<String, Object> effectiveEntryAttrs = Maps.newLinkedHashMap();
    for (String key : entryAttributes.keySet()) {
        Object value = entryAttributes.get(key);
        if (value != null) {
            effectiveEntryAttrs.put(key, value);
        }
    }
    if (effectiveEntryAttrs.isEmpty()) {
        return;
    }
    Node attributesNode;
    NodeList attributesNodes = (NodeList) node.get("attributes");
    if (attributesNodes.size() == 0) {
        attributesNode = node.appendNode("attributes");
    } else {
        attributesNode = (Node) attributesNodes.get(0);
    }
    for (String key : effectiveEntryAttrs.keySet()) {
        Object value = effectiveEntryAttrs.get(key);
        Map<String, Object> attrs = Maps.newLinkedHashMap();
        attrs.put("name", key);
        attrs.put("value", value);
        attributesNode.appendNode("attribute", attrs);
    }
}
Also used : Node(groovy.util.Node) NodeList(groovy.util.NodeList)

Example 5 with NodeList

use of groovy.util.NodeList in project gradle by gradle.

the class AbstractClasspathEntry method readAccessRules.

private Set<AccessRule> readAccessRules(Node node) {
    Set<AccessRule> accessRules = Sets.newLinkedHashSet();
    NodeList accessRulesNodes = (NodeList) node.get("accessrules");
    for (Object accessRulesNode : accessRulesNodes) {
        NodeList accessRuleNodes = (NodeList) ((Node) accessRulesNode).get("accessrule");
        for (Object accessRuleNode : accessRuleNodes) {
            Node ruleNode = (Node) accessRuleNode;
            accessRules.add(new AccessRule((String) ruleNode.attribute("kind"), (String) ruleNode.attribute("pattern")));
        }
    }
    return accessRules;
}
Also used : NodeList(groovy.util.NodeList) Node(groovy.util.Node)

Aggregations

Node (groovy.util.Node)8 NodeList (groovy.util.NodeList)8 XmlPersistableConfigurationObject (org.gradle.plugins.ide.internal.generator.XmlPersistableConfigurationObject)3