View | Details | Raw Unified | Return to bug 175849 | Differences between
and this patch

Collapse All | Expand All

(-)model/org/eclipse/jdt/internal/core/JavaModelManager.java (-2 lines)
Lines 518-525 Link Here
518
		if (container == null)
518
		if (container == null)
519
			return false;
519
			return false;
520
		IJavaProject project = projects[0];
520
		IJavaProject project = projects[0];
521
		if (!containerInitializationInProgress(project).contains(containerPath))
522
			return false;
523
		IClasspathContainer previousSessionContainer = getPreviousSessionContainer(containerPath, project);
521
		IClasspathContainer previousSessionContainer = getPreviousSessionContainer(containerPath, project);
524
		final IClasspathEntry[] newEntries = container.getClasspathEntries();
522
		final IClasspathEntry[] newEntries = container.getClasspathEntries();
525
		if (previousSessionContainer == null) 
523
		if (previousSessionContainer == null) 
(-)src/org/eclipse/jdt/core/tests/model/ClasspathInitializerTests.java (+50 lines)
Lines 812-817 Link Here
812
		deleteProject("P1");
812
		deleteProject("P1");
813
	}
813
	}
814
}
814
}
815
816
/* 
817
 * Ensures that no resource deta is reported if a container is initialized right after startup  to the same value it had before shutdown.
818
 * (regression test for bug )
819
 */
820
public void testContainerInitializer17() throws CoreException {
821
	IResourceChangeListener listener = new IResourceChangeListener() {
822
		StringBuffer buffer = new StringBuffer();
823
		public void resourceChanged(IResourceChangeEvent event) {
824
			this.buffer.append(event.getDelta().findMember(new Path("/P2")));
825
		}
826
		public String toString() {
827
			return this.buffer.toString();
828
		}
829
	};
830
	try {
831
		createProject("P1");
832
		createFile("/P1/lib.jar", "");
833
		ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
834
		IJavaProject p2 = createJavaProject(
835
				"P2", 
836
				new String[] {}, 
837
				new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, 
838
				"");
839
				
840
				
841
		// simulate state on startup
842
		simulateExitRestart();
843
		
844
		getWorkspace().addResourceChangeListener(listener, IResourceChangeEvent.POST_CHANGE);
845
		
846
		// simulate concurrency (another thread is initializing all containers in parallel and thus this flag is set to false)
847
		JavaModelManager.getJavaModelManager().deltaState.rootsAreStale = false;
848
		
849
		// initialize to the same value
850
		ContainerInitializer.setInitializer(new DefaultContainerInitializer(new String[] {"P2", "/P1/lib.jar"}));
851
		ContainerInitializer.initializer.initialize(new Path("org.eclipse.jdt.core.tests.model.TEST_CONTAINER"), p2);
852
853
		assertEquals(
854
			"Unexpected resource delta on container initialization", 
855
			"",
856
			listener.toString()
857
		);
858
	} finally {
859
		getWorkspace().removeResourceChangeListener(listener);
860
		deleteProject("P1");
861
		deleteProject("P2");
862
	}
863
}
864
815
public void testVariableInitializer01() throws CoreException {
865
public void testVariableInitializer01() throws CoreException {
816
	try {
866
	try {
817
		createProject("P1");
867
		createProject("P1");

Return to bug 175849