View | Details | Raw Unified | Return to bug 88719
Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/ClasspathEntry.java (-5 / +5 lines)
Lines 179-185 Link Here
179
	/*
179
	/*
180
	 * The extra attributes
180
	 * The extra attributes
181
	 */
181
	 */
182
	private IClasspathAttribute[] extraAttributes;
182
	IClasspathAttribute[] extraAttributes;
183
183
184
	/**
184
	/**
185
	 * Creates a class path entry of the specified kind with the given path.
185
	 * Creates a class path entry of the specified kind with the given path.
Lines 274-280 Link Here
274
		return result;
274
		return result;
275
	}
275
	}
276
276
277
	private static IClasspathAttribute[] decodeExtraAttributes(Element element) {
277
	static IClasspathAttribute[] decodeExtraAttributes(Element element) {
278
		Node extra = element.getElementsByTagName(TAG_ATTRIBUTES).item(0);
278
		Node extra = element.getElementsByTagName(TAG_ATTRIBUTES).item(0);
279
		if (extra == null) return NO_EXTRA_ATTRIBUTES;
279
		if (extra == null) return NO_EXTRA_ATTRIBUTES;
280
		NodeList attributes = element.getElementsByTagName(TAG_ATTRIBUTE);
280
		NodeList attributes = element.getElementsByTagName(TAG_ATTRIBUTE);
Lines 299-305 Link Here
299
		return result;
299
		return result;
300
	}
300
	}
301
	
301
	
302
	private static IAccessRule[] decodeAccessRules(Element element) {
302
	static IAccessRule[] decodeAccessRules(Element element) {
303
		Node accessRules = element.getElementsByTagName(TAG_ACCESS_RULES).item(0);
303
		Node accessRules = element.getElementsByTagName(TAG_ACCESS_RULES).item(0);
304
		if (accessRules == null || accessRules.getNodeType() != Node.ELEMENT_NODE) return null;
304
		if (accessRules == null || accessRules.getNodeType() != Node.ELEMENT_NODE) return null;
305
		NodeList list = ((Element) accessRules).getElementsByTagName(TAG_ACCESS_RULE);
305
		NodeList list = ((Element) accessRules).getElementsByTagName(TAG_ACCESS_RULE);
Lines 449-455 Link Here
449
			writer.endTag(TAG_CLASSPATHENTRY, indent);
449
			writer.endTag(TAG_CLASSPATHENTRY, indent);
450
	}
450
	}
451
	
451
	
452
	private void encodeExtraAttributes(XMLWriter writer, boolean indent, boolean newLine) {
452
	void encodeExtraAttributes(XMLWriter writer, boolean indent, boolean newLine) {
453
		writer.startTag(TAG_ATTRIBUTES, indent);
453
		writer.startTag(TAG_ATTRIBUTES, indent);
454
		for (int i = 0; i < this.extraAttributes.length; i++) {
454
		for (int i = 0; i < this.extraAttributes.length; i++) {
455
			IClasspathAttribute attribute = this.extraAttributes[i];
455
			IClasspathAttribute attribute = this.extraAttributes[i];
Lines 461-467 Link Here
461
		writer.endTag(TAG_ATTRIBUTES, indent);
461
		writer.endTag(TAG_ATTRIBUTES, indent);
462
	}
462
	}
463
	
463
	
464
	private void encodeAccessRules(XMLWriter writer, boolean indent, boolean newLine) {
464
	void encodeAccessRules(XMLWriter writer, boolean indent, boolean newLine) {
465
465
466
		writer.startTag(TAG_ACCESS_RULES, indent);
466
		writer.startTag(TAG_ACCESS_RULES, indent);
467
		AccessRule[] rules = getAccessRuleSet().getAccessRules();
467
		AccessRule[] rules = getAccessRuleSet().getAccessRules();
(-)model/org/eclipse/jdt/internal/core/UserLibrary.java (-8 / +31 lines)
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
		}

Return to bug 88719