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); }