public static URL getLibraryJavadocLocation(IClasspathEntry entry) {
    if (entry == null) {
      throw new IllegalArgumentException("Entry must not be null"); // $NON-NLS-1$
    }

    int kind = entry.getEntryKind();
    if (kind != IClasspathEntry.CPE_LIBRARY && kind != IClasspathEntry.CPE_VARIABLE) {
      throw new IllegalArgumentException(
          "Entry must be of kind CPE_LIBRARY or CPE_VARIABLE"); //$NON-NLS-1$
    }

    IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
    for (int i = 0; i < extraAttributes.length; i++) {
      IClasspathAttribute attrib = extraAttributes[i];
      if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attrib.getName())) {
        return parseURL(attrib.getValue());
      }
    }
    return null;
  }
 private static IClasspathEntry getConvertedEntry(
     IClasspathEntry entry, IJavaProject project, Map<IPath, String> oldLocationMap) {
   IPath path = null;
   switch (entry.getEntryKind()) {
     case IClasspathEntry.CPE_SOURCE:
     case IClasspathEntry.CPE_PROJECT:
       return null;
     case IClasspathEntry.CPE_CONTAINER:
       convertContainer(entry, project, oldLocationMap);
       return null;
     case IClasspathEntry.CPE_LIBRARY:
       path = entry.getPath();
       break;
     case IClasspathEntry.CPE_VARIABLE:
       path = JavaCore.getResolvedVariablePath(entry.getPath());
       break;
     default:
       return null;
   }
   if (path == null) {
     return null;
   }
   IClasspathAttribute[] extraAttributes = entry.getExtraAttributes();
   for (int i = 0; i < extraAttributes.length; i++) {
     if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(
         extraAttributes[i].getName())) {
       return null;
     }
   }
   String libraryJavadocLocation = oldLocationMap.get(path);
   if (libraryJavadocLocation != null) {
     CPListElement element = CPListElement.createFromExisting(entry, project);
     element.setAttribute(CPListElement.JAVADOC, libraryJavadocLocation);
     return element.getClasspathEntry();
   }
   return null;
 }
  protected IClasspathEntry createClasspathEntry(
      IPath entryPath, IPath sourcePath, String javadocURL) {
    IPath sourceRootPath = null;
    IAccessRule[] rules = new IAccessRule[] {};
    IClasspathAttribute[] attrs = new IClasspathAttribute[] {};

    final ClasspathDecorations dec =
        cpDecorations.getDecorations(
            getDecorationManagerKey(javaProject.getProject(), getPath().toString()),
            entryPath.toString());

    if (dec != null) {
      sourcePath = dec.getSourceAttachmentPath();
      sourceRootPath = dec.getSourceAttachmentRootPath();
      attrs = dec.getExtraAttributes();
    }

    if (javadocURL != null) {
      if (CoreUtil.empty(attrs)) {
        attrs = new IClasspathAttribute[] {newJavadocAttr(javadocURL)};
      } else {
        List<IClasspathAttribute> newAttrs = new ArrayList<IClasspathAttribute>();

        for (IClasspathAttribute attr : attrs) {
          if (IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME.equals(attr.getName())) {
            newAttrs.add(newJavadocAttr(javadocURL));
          } else {
            newAttrs.add(attr);
          }
        }

        attrs = newAttrs.toArray(new IClasspathAttribute[0]);
      }
    }

    return JavaCore.newLibraryEntry(entryPath, sourcePath, sourceRootPath, rules, attrs, false);
  }