|
Lines 6747-6751
Link Here
|
| 6747 |
ContainerInitializer.setInitializer(null); |
6747 |
ContainerInitializer.setInitializer(null); |
| 6748 |
} |
6748 |
} |
| 6749 |
} |
6749 |
} |
|
|
6750 |
//https://bugs.eclipse.org/bugs/show_bug.cgi?id=309788 |
| 6751 |
public void testBug309788() throws Exception { |
| 6752 |
|
| 6753 |
try { |
| 6754 |
IJavaProject p = this.createJavaProject("P", new String[] {}, "bin"); |
| 6755 |
// Create new user library "SomeUserLibrary" |
| 6756 |
ClasspathContainerInitializer initializer= JavaCore.getClasspathContainerInitializer(JavaCore.USER_LIBRARY_CONTAINER_ID); |
| 6757 |
String libraryName = "SomeUserLibrary"; |
| 6758 |
IPath containerPath = new Path(JavaCore.USER_LIBRARY_CONTAINER_ID); |
| 6759 |
UserLibraryClasspathContainer containerSuggestion = new UserLibraryClasspathContainer(libraryName); |
| 6760 |
initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); |
| 6761 |
|
| 6762 |
addExternalLibrary(p, getExternalResourcePath("lib1.jar"), new String[0], |
| 6763 |
new String[] { |
| 6764 |
"META-INF/MANIFEST.MF", |
| 6765 |
"Manifest-Version: 1.0\n" + |
| 6766 |
"Class-Path: lib2.jar\n", |
| 6767 |
}, |
| 6768 |
JavaCore.VERSION_1_4); |
| 6769 |
|
| 6770 |
// Modify user library |
| 6771 |
IEclipsePreferences preferences = new InstanceScope().getNode(JavaCore.PLUGIN_ID); |
| 6772 |
String propertyName = JavaModelManager.CP_USERLIBRARY_PREFERENCES_PREFIX+"SomeUserLibrary"; |
| 6773 |
StringBuffer propertyValue = new StringBuffer("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n<userlibrary systemlibrary=\"false\" version=\"1\">\r\n<archive"); |
| 6774 |
propertyValue.append(" path=\"" + getExternalResourcePath("lib1.jar")); |
| 6775 |
propertyValue.append("\"/>\r\n</userlibrary>\r\n"); |
| 6776 |
preferences.put(propertyName, propertyValue.toString()); |
| 6777 |
preferences.flush(); |
| 6778 |
|
| 6779 |
createExternalFile("lib2.jar", ""); |
| 6780 |
initializer.requestClasspathContainerUpdate(containerPath.append(libraryName), null, containerSuggestion); |
| 6781 |
|
| 6782 |
IClasspathEntry[] entries = new IClasspathEntry[1]; |
| 6783 |
entries[0] = JavaCore.newContainerEntry(containerSuggestion.getPath()); |
| 6784 |
p.setRawClasspath(entries, null); |
| 6785 |
IClasspathEntry[] resolvedClasspath = p.getResolvedClasspath(true); |
| 6786 |
assertClasspathEquals(resolvedClasspath, |
| 6787 |
""+ getExternalPath() + "lib2.jar[CPE_LIBRARY][K_BINARY][isExported:false]\n" + |
| 6788 |
""+ getExternalPath() + "lib1.jar[CPE_LIBRARY][K_BINARY][isExported:false]"); |
| 6789 |
|
| 6790 |
} finally { |
| 6791 |
deleteProject("P"); |
| 6792 |
ContainerInitializer.setInitializer(null); |
| 6793 |
} |
| 6794 |
} |
| 6750 |
|
6795 |
|
| 6751 |
} |
6796 |
} |