Lines 3715-3720
Link Here
|
3715 |
} |
3715 |
} |
3716 |
|
3716 |
|
3717 |
/* |
3717 |
/* |
|
|
3718 |
* Ensures that renaming a .jar file and updating the classpath in a PRE_BUILD event doesn't leave markers |
3719 |
* (regression test for bug 177922 FlexibleProjectContainer refresh logic sporadically leaves project with "missing library" error on rename/delete) |
3720 |
*/ |
3721 |
public void testRenameJar() throws CoreException { |
3722 |
IResourceChangeListener listener = null; |
3723 |
try { |
3724 |
final IJavaProject p = createJavaProject("P", new String[0], new String[] {"/P/lib/test1.jar"}, ""); |
3725 |
createFolder("/P/lib"); |
3726 |
createFile("/P/lib/test1.jar", ""); |
3727 |
// at this point no markers exist |
3728 |
|
3729 |
// register a listener that updates the classpath in a PRE_BUILD event |
3730 |
listener = new IResourceChangeListener(){ |
3731 |
public void resourceChanged(IResourceChangeEvent event) { |
3732 |
try { |
3733 |
p.setRawClasspath(new IClasspathEntry[] {JavaCore.newLibraryEntry(new Path("/P/lib/test2.jar"), null, null)}, null); |
3734 |
} catch (JavaModelException e) { |
3735 |
e.printStackTrace(); |
3736 |
} |
3737 |
} |
3738 |
}; |
3739 |
getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.PRE_BUILD); |
3740 |
|
3741 |
// rename .jar |
3742 |
getFile("/P/lib/test1.jar").move(new Path("/P/lib/test2.jar"), false, null); |
3743 |
assertMarkers("Unexpected markers", "", p); |
3744 |
} finally { |
3745 |
if (listener != null) |
3746 |
getWorkspace().removeResourceChangeListener(listener); |
3747 |
deleteProject("P"); |
3748 |
} |
3749 |
} |
3750 |
|
3751 |
/* |
3718 |
* Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten. |
3752 |
* Ensures that unknown classpath attributes in a .classpath file are not lost when read and rewritten. |
3719 |
* (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) |
3753 |
* (regression test for bug 101425 Classpath persistence should be resilient with unknown attributes) |
3720 |
*/ |
3754 |
*/ |