Example usage for org.eclipse.jdt.internal.core ClasspathEntry TAG_ATTRIBUTE_NAME

List of usage examples for org.eclipse.jdt.internal.core ClasspathEntry TAG_ATTRIBUTE_NAME

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.core ClasspathEntry TAG_ATTRIBUTE_NAME.

Prototype

String TAG_ATTRIBUTE_NAME

To view the source code for org.eclipse.jdt.internal.core ClasspathEntry TAG_ATTRIBUTE_NAME.

Click Source Link

Usage

From source file:io.sarl.eclipse.util.JavaClasspathParser.java

License:Apache License

@SuppressWarnings("checkstyle:innerassignment")
private static IClasspathAttribute[] decodeExtraAttributes(NodeList attributes) {
    if (attributes == null) {
        return ClasspathEntry.NO_EXTRA_ATTRIBUTES;
    }//from  w  w w . j  a  v a2 s  .  c om
    final int length = attributes.getLength();
    if (length == 0) {
        return ClasspathEntry.NO_EXTRA_ATTRIBUTES;
    }
    IClasspathAttribute[] result = new IClasspathAttribute[length];
    int index = 0;
    for (int i = 0; i < length; ++i) {
        final Node node = attributes.item(i);
        if (node.getNodeType() == Node.ELEMENT_NODE) {
            final Element attribute = (Element) node;
            final String name = attribute.getAttribute(ClasspathEntry.TAG_ATTRIBUTE_NAME);
            if (name == null) {
                continue;
            }
            final String value = attribute.getAttribute(ClasspathEntry.TAG_ATTRIBUTE_VALUE);
            if (value == null) {
                continue;
            }
            result[index++] = new ClasspathAttribute(name, value);
        }
    }
    if (index != length) {
        System.arraycopy(result, 0, result = new IClasspathAttribute[index], 0, index);
    }
    return result;
}