Example usage for org.eclipse.jdt.core IClasspathAttribute INDEX_LOCATION_ATTRIBUTE_NAME

List of usage examples for org.eclipse.jdt.core IClasspathAttribute INDEX_LOCATION_ATTRIBUTE_NAME

Introduction

In this page you can find the example usage for org.eclipse.jdt.core IClasspathAttribute INDEX_LOCATION_ATTRIBUTE_NAME.

Prototype

String INDEX_LOCATION_ATTRIBUTE_NAME

To view the source code for org.eclipse.jdt.core IClasspathAttribute INDEX_LOCATION_ATTRIBUTE_NAME.

Click Source Link

Document

Constant for the name of the index location attribute.

Usage

From source file:com.codenvy.ide.ext.java.server.internal.core.ClasspathEntry.java

License:Open Source License

/**
 * This function computes the URL of the index location for this classpath entry. It returns null if the URL is
 * invalid./* w  w w  .j  a  v  a  2 s  . c  o m*/
 */
public URL getLibraryIndexLocation() {
    switch (getEntryKind()) {
    case IClasspathEntry.CPE_LIBRARY:
    case IClasspathEntry.CPE_VARIABLE:
        break;
    default:
        return null;
    }
    if (this.extraAttributes == null)
        return null;
    for (int i = 0; i < this.extraAttributes.length; i++) {
        IClasspathAttribute attrib = this.extraAttributes[i];
        if (IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME.equals(attrib.getName())) {
            String value = attrib.getValue();
            try {
                return new URL(value);
            } catch (MalformedURLException e) {
                return null;
            }
        }
    }
    return null;
}

From source file:org.eclipse.che.jdt.core.launching.JREContainer.java

License:Open Source License

private static IClasspathAttribute[] buildClasspathAttributes(final IVMInstallType vm,
        final LibraryLocation lib, final boolean overrideJavaDoc) {

    List<IClasspathAttribute> classpathAttributes = new LinkedList<IClasspathAttribute>();
    // process the javadoc location
    URL javadocLocation = lib.getJavadocLocation();
    if (overrideJavaDoc && javadocLocation == null) {
        javadocLocation = null; //vm.getJavadocLocation();
    }/*from w  w w.j  a va 2s  .com*/
    if (javadocLocation != null) {
        IClasspathAttribute javadocCPAttribute = JavaCore.newClasspathAttribute(
                IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME, javadocLocation.toExternalForm());
        classpathAttributes.add(javadocCPAttribute);
    }
    // process the index location
    URL indexLocation = lib.getIndexLocation();
    if (indexLocation != null) {
        IClasspathAttribute indexCPLocation = JavaCore.newClasspathAttribute(
                IClasspathAttribute.INDEX_LOCATION_ATTRIBUTE_NAME, indexLocation.toExternalForm());
        classpathAttributes.add(indexCPLocation);
    }
    return classpathAttributes.toArray(new IClasspathAttribute[classpathAttributes.size()]);
}