Lines 21-26
Link Here
|
21 |
import javax.xml.parsers.ParserConfigurationException; |
21 |
import javax.xml.parsers.ParserConfigurationException; |
22 |
import org.eclipse.core.runtime.IPath; |
22 |
import org.eclipse.core.runtime.IPath; |
23 |
import org.eclipse.core.runtime.Path; |
23 |
import org.eclipse.core.runtime.Path; |
|
|
24 |
import org.eclipse.jdt.core.IAccessRule; |
25 |
import org.eclipse.jdt.core.IClasspathAttribute; |
24 |
import org.eclipse.jdt.core.IClasspathEntry; |
26 |
import org.eclipse.jdt.core.IClasspathEntry; |
25 |
import org.eclipse.jdt.core.JavaCore; |
27 |
import org.eclipse.jdt.core.JavaCore; |
26 |
import org.eclipse.jdt.internal.core.util.Messages; |
28 |
import org.eclipse.jdt.internal.core.util.Messages; |
Lines 61-67
Link Here
|
61 |
public boolean isSystemLibrary() { |
63 |
public boolean isSystemLibrary() { |
62 |
return this.isSystemLibrary; |
64 |
return this.isSystemLibrary; |
63 |
} |
65 |
} |
64 |
|
66 |
|
65 |
/* (non-Javadoc) |
67 |
/* (non-Javadoc) |
66 |
* @see java.lang.Object#equals(java.lang.Object) |
68 |
* @see java.lang.Object#equals(java.lang.Object) |
67 |
*/ |
69 |
*/ |
Lines 105-121
Link Here
|
105 |
xmlWriter.printTag(TAG_USERLIBRARY, library, true, true, false); |
107 |
xmlWriter.printTag(TAG_USERLIBRARY, library, true, true, false); |
106 |
|
108 |
|
107 |
for (int i = 0; i < this.entries.length; ++i) { |
109 |
for (int i = 0; i < this.entries.length; ++i) { |
108 |
IClasspathEntry curr= this.entries[i]; |
110 |
ClasspathEntry cpEntry = (ClasspathEntry) this.entries[i]; |
109 |
|
111 |
|
110 |
HashMap archive = new HashMap(); |
112 |
HashMap archive = new HashMap(); |
111 |
archive.put(TAG_PATH, curr.getPath().toString()); |
113 |
archive.put(TAG_PATH, cpEntry.getPath().toString()); |
112 |
IPath sourceAttach= curr.getSourceAttachmentPath(); |
114 |
IPath sourceAttach= cpEntry.getSourceAttachmentPath(); |
113 |
if (sourceAttach != null) |
115 |
if (sourceAttach != null) |
114 |
archive.put(TAG_SOURCEATTACHMENT, sourceAttach); |
116 |
archive.put(TAG_SOURCEATTACHMENT, sourceAttach); |
115 |
IPath sourceAttachRoot= curr.getSourceAttachmentRootPath(); |
117 |
IPath sourceAttachRoot= cpEntry.getSourceAttachmentRootPath(); |
116 |
if (sourceAttachRoot != null) |
118 |
if (sourceAttachRoot != null) |
117 |
archive.put(TAG_SOURCEATTACHMENTROOT, sourceAttachRoot); |
119 |
archive.put(TAG_SOURCEATTACHMENTROOT, sourceAttachRoot); |
118 |
xmlWriter.printTag(TAG_ARCHIVE, archive, true, true, true); |
120 |
|
|
|
121 |
boolean hasExtraAttributes = cpEntry.extraAttributes != null && cpEntry.extraAttributes.length != 0; |
122 |
boolean hasRestrictions = cpEntry.getAccessRuleSet() != null; // access rule set is null if no access rules |
123 |
xmlWriter.printTag(TAG_ARCHIVE, archive, true, true, !(hasExtraAttributes || hasRestrictions)); |
124 |
|
125 |
// write extra attributes if necessary |
126 |
if (hasExtraAttributes) { |
127 |
cpEntry.encodeExtraAttributes(xmlWriter, true, true); |
128 |
} |
129 |
|
130 |
// write extra attributes and restriction if necessary |
131 |
if (hasRestrictions) { |
132 |
cpEntry.encodeAccessRules(xmlWriter, true, true); |
133 |
} |
134 |
|
135 |
// write archive end tag if necessary |
136 |
if (hasExtraAttributes || hasRestrictions) { |
137 |
xmlWriter.endTag(TAG_ARCHIVE, true); |
138 |
} |
119 |
} |
139 |
} |
120 |
xmlWriter.endTag(TAG_USERLIBRARY, true); |
140 |
xmlWriter.endTag(TAG_USERLIBRARY, true); |
121 |
writer.flush(); |
141 |
writer.flush(); |
Lines 157-163
Link Here
|
157 |
String path = element.getAttribute(TAG_PATH); |
177 |
String path = element.getAttribute(TAG_PATH); |
158 |
IPath sourceAttach= element.hasAttribute(TAG_SOURCEATTACHMENT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENT)) : null; |
178 |
IPath sourceAttach= element.hasAttribute(TAG_SOURCEATTACHMENT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENT)) : null; |
159 |
IPath sourceAttachRoot= element.hasAttribute(TAG_SOURCEATTACHMENTROOT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENTROOT)) : null; |
179 |
IPath sourceAttachRoot= element.hasAttribute(TAG_SOURCEATTACHMENTROOT) ? new Path(element.getAttribute(TAG_SOURCEATTACHMENTROOT)) : null; |
160 |
res.add(JavaCore.newLibraryEntry(new Path(path), sourceAttach, sourceAttachRoot)); |
180 |
IClasspathAttribute[] extraAttributes = ClasspathEntry.decodeExtraAttributes(element); |
|
|
181 |
IAccessRule[] accessRules = ClasspathEntry.decodeAccessRules(element); |
182 |
IClasspathEntry entry = JavaCore.newLibraryEntry(new Path(path), sourceAttach, sourceAttachRoot, accessRules, extraAttributes, false/*not exported*/); |
183 |
res.add(entry); |
161 |
} |
184 |
} |
162 |
} |
185 |
} |
163 |
} |
186 |
} |