}
}
public static IClasspathEntry elementDecode(Element element, IJavaProject project, Map unknownElements) {
IPath projectPath = project.getProject().getFullPath();
NamedNodeMap attributes = element.getAttributes();
NodeList children = element.getChildNodes();
boolean[] foundChildren = new boolean[children.getLength()];
String kindAttr = removeAttribute(TAG_KIND, attributes);
String pathAttr = removeAttribute(TAG_PATH, attributes);
// ensure path is absolute
IPath path = new Path(pathAttr);
int kind = kindFromString(kindAttr);
if (kind != IClasspathEntry.CPE_VARIABLE && kind != IClasspathEntry.CPE_CONTAINER && !path.isAbsolute()) {
path = projectPath.append(path);
}
// source attachment info (optional)
IPath sourceAttachmentPath =
element.hasAttribute(TAG_SOURCEPATH)
? new Path(removeAttribute(TAG_SOURCEPATH, attributes))
: null;
if (kind != IClasspathEntry.CPE_VARIABLE && sourceAttachmentPath != null && !sourceAttachmentPath.isAbsolute()) {
sourceAttachmentPath = projectPath.append(sourceAttachmentPath);
}
IPath sourceAttachmentRootPath =
element.hasAttribute(TAG_ROOTPATH)
? new Path(removeAttribute(TAG_ROOTPATH, attributes))
: null;
// exported flag (optional)
boolean isExported = removeAttribute(TAG_EXPORTED, attributes).equals("true"); //$NON-NLS-1$
// inclusion patterns (optional)
IPath[] inclusionPatterns = decodePatterns(attributes, TAG_INCLUDING);
if (inclusionPatterns == null) inclusionPatterns = INCLUDE_ALL;
// exclusion patterns (optional)
IPath[] exclusionPatterns = decodePatterns(attributes, TAG_EXCLUDING);
if (exclusionPatterns == null) exclusionPatterns = EXCLUDE_NONE;
// access rules (optional)
NodeList attributeList = getChildAttributes(TAG_ACCESS_RULES, children, foundChildren);
IAccessRule[] accessRules = decodeAccessRules(attributeList);
// backward compatibility
if (accessRules == null) {
accessRules = getAccessRules(inclusionPatterns, exclusionPatterns);
}
// combine access rules (optional)
boolean combineAccessRestrictions = !removeAttribute(TAG_COMBINE_ACCESS_RULES, attributes).equals("false"); //$NON-NLS-1$
// extra attributes (optional)
attributeList = getChildAttributes(TAG_ATTRIBUTES, children, foundChildren);
IClasspathAttribute[] extraAttributes = decodeExtraAttributes(attributeList);
// custom output location
IPath outputLocation = element.hasAttribute(TAG_OUTPUT) ? projectPath.append(removeAttribute(TAG_OUTPUT, attributes)) : null;
String[] unknownAttributes = null;
ArrayList unknownChildren = null;
if (unknownElements != null) {