Lines 12-19
Link Here
|
12 |
|
12 |
|
13 |
import org.eclipse.core.resources.*; |
13 |
import org.eclipse.core.resources.*; |
14 |
import org.eclipse.core.runtime.CoreException; |
14 |
import org.eclipse.core.runtime.CoreException; |
|
|
15 |
import org.eclipse.core.runtime.IPath; |
16 |
import org.eclipse.core.runtime.NullProgressMonitor; |
17 |
import org.eclipse.core.runtime.OperationCanceledException; |
15 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
18 |
import org.eclipse.core.runtime.jobs.ISchedulingRule; |
16 |
import org.eclipse.jdt.core.*; |
19 |
import org.eclipse.jdt.core.*; |
|
|
20 |
import org.eclipse.jdt.core.tests.model.ClasspathInitializerTests.DefaultContainerInitializer; |
17 |
|
21 |
|
18 |
import junit.framework.Test; |
22 |
import junit.framework.Test; |
19 |
/** |
23 |
/** |
Lines 518-523
Link Here
|
518 |
JavaCore.initializeAfterLoad(null); |
522 |
JavaCore.initializeAfterLoad(null); |
519 |
} |
523 |
} |
520 |
|
524 |
|
|
|
525 |
/* |
526 |
* Ensures that JavaCore#initializeAfterLoad() can be canceled |
527 |
* (regression test for bug 179529 Stop Eclipse takes a lot of time in case of big workspace) |
528 |
*/ |
529 |
public void testInitializeAfterLoad2() throws CoreException { |
530 |
try { |
531 |
createJavaProject( |
532 |
"P1", |
533 |
new String[] {}, |
534 |
new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, |
535 |
""); |
536 |
createFile("/P1/lib.jar", ""); |
537 |
createJavaProject( |
538 |
"P2", |
539 |
new String[] {}, |
540 |
new String[] {"org.eclipse.jdt.core.tests.model.TEST_CONTAINER"}, |
541 |
""); |
542 |
createFile("/P2/lib.jar", ""); |
543 |
|
544 |
simulateExitRestart(); |
545 |
final NullProgressMonitor progressMonitor = new NullProgressMonitor(); |
546 |
class CancellingInitializer extends DefaultContainerInitializer { |
547 |
int count = 1; |
548 |
public CancellingInitializer(String[] values) { |
549 |
super(values); |
550 |
} |
551 |
public void initialize(IPath containerPath, IJavaProject project) throws CoreException { |
552 |
super.initialize(containerPath, project); |
553 |
if (--count == 0) |
554 |
progressMonitor.setCanceled(true); |
555 |
else |
556 |
assertFalse("Should have canceled initializeAfterLoad()", true); |
557 |
|
558 |
} |
559 |
} |
560 |
CancellingInitializer initializer = new CancellingInitializer(new String[] {"P1", "/P1/lib.jar", "P2", "/P2/lib.jar"}); |
561 |
ContainerInitializer.setInitializer(initializer); |
562 |
try { |
563 |
JavaCore.initializeAfterLoad(progressMonitor); |
564 |
} catch (OperationCanceledException e) { |
565 |
// expected |
566 |
} |
567 |
} finally { |
568 |
deleteProject("P1"); |
569 |
deleteProject("P2"); |
570 |
} |
571 |
} |
572 |
|
521 |
/** |
573 |
/** |
522 |
* Ensures that a registered pre-processing resource changed listener is correctly called. |
574 |
* Ensures that a registered pre-processing resource changed listener is correctly called. |
523 |
* @deprecated since using deprecated API |
575 |
* @deprecated since using deprecated API |