Bug 78053 Package Explorer shouldn't fetch any children on startup. [package explorer]
We have a custom classpath container that reads a properties file in a workspace project. A typical workspace has around 50 projects in it. When Eclipse is started it takes a long time to come up with such a workspace on a ClearCase dynamic view. It is slightly better with snapshot views. During debugging/tracing I noticed that initializing the classpath containers in all projects takes an significant amount of time and that this operation is performed in the main thread which prevents the workbench window from coming up. Thread [main] (Suspended) RequiredCartridgeClassPathContainer(CartridgeClassPathContainer).getClasspathEntries() line: 121 ClasspathEntry.validateClasspathEntry(IJavaProject,IClasspathEntry, boolean, boolean) line: 1022 JavaProject.getResolvedClasspath(IClasspathEntry[], IPath, boolean, boolean, Map) line: 1861 DeltaProcessingState$ProjectUpdateInfo.updateProjectReferencesIfNecessary() line: 98 DeltaProcessingState.performClasspathResourceChange(JavaProject, IClasspathEntry[], IClasspathEntry[], IClasspathEntry[], boolean) line: 223 SetClasspathOperation.updateProjectReferencesIfNecessary() line: 771 SetClasspathOperation.executeOperation() line: 246 SetClasspathOperation(JavaModelOperation).run(IProgressMonitor) line: 700 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1673 SetClasspathOperation(JavaModelOperation).runOperation(IProgressMonitor) line: 744 JavaProject.setRawClasspath(IClasspathEntry[], IPath, IProgressMonitor, boolean, IClasspathEntry[], boolean, boolean) line: 2658 JavaCore$3.run(IProgressMonitor) line: 3433 BatchOperation.executeOperation() line: 34 BatchOperation(JavaModelOperation).run(IProgressMonitor) line: 700 Workspace.run(IWorkspaceRunnable, ISchedulingRule, int, IProgressMonitor) line: 1673 JavaCore.run(IWorkspaceRunnable, ISchedulingRule, IProgressMonitor) line: 3246 JavaCore.setClasspathContainer(IPath, IJavaProject[], IClasspathContainer[], IProgressMonitor) line: 3416 BeehiveClassPathInitializer.initialize(IPath, IJavaProject) line: 57 JavaModelManager.initializeContainer(IJavaProject, IPath) line: 1261 JavaModelManager.initializeAllContainers(IJavaProject, IPath) line: 1226 JavaModelManager.getClasspathContainer(IPath, IJavaProject) line: 833 JavaCore.getClasspathContainer(IPath, IJavaProject) line: 1184 JavaProject.getResolvedClasspath(IClasspathEntry[], IPath, boolean, boolean, Map) line: 1889 JavaProject.getResolvedClasspath(boolean, boolean, boolean) line: 1799 PackageFragmentRoot.isOnClasspath() line: 805 PackageFragmentRoot.exists() line: 356 PackageFragmentProvider.getChildren(Object) line: 75 PackageExplorerContentProvider.getChildren(Object) line: 127 PackageExplorerPart$PackageExplorerProblemTreeViewer.isExpandable(Object ) line: 260 PackageExplorerPart$PackageExplorerProblemTreeViewer(AbstractTreeViewer) .updatePlus(Item, Object) line: 1587 PackageExplorerPart$PackageExplorerProblemTreeViewer(AbstractTreeViewer) .createTreeItem(Widget, Object, int) line: 382 AbstractTreeViewer$1.run() line: 361 BusyIndicator.showWhile(Display, Runnable) line: 69 PackageExplorerPart$PackageExplorerProblemTreeViewer(AbstractTreeViewer) .createChildren(Widget) line: 342 AbstractTreeViewer$5.run() line: 787 PackageExplorerPart$PackageExplorerProblemTreeViewer(StructuredViewer).p reservingSelection(Runnable) line: 862 PackageExplorerPart$PackageExplorerProblemTreeViewer(AbstractTreeViewer) .inputChanged(Object, Object) line: 777 PackageExplorerPart$PackageExplorerProblemTreeViewer(ContentViewer).setI nput(Object) line: 238 PackageExplorerPart$PackageExplorerProblemTreeViewer(StructuredViewer).s etInput(Object) line: 1059 PackageExplorerPart.createPartControl(Composite) line: 475 PartPane$2.run() line: 137 InternalPlatform.run(ISafeRunnable) line: 616 Platform.run(ISafeRunnable) line: 747 ViewPane(PartPane).createChildControl() line: 133 ViewPane.createChildControl() line: 135 ViewFactory$1.run() line: 351 InternalPlatform.run(ISafeRunnable) line: 616 Platform.run(ISafeRunnable) line: 747 ViewFactory.busyRestoreView(IViewReference) line: 273 ViewFactory$2.run() line: 530 BusyIndicator.showWhile(Display, Runnable) line: 69 ViewFactory.restoreView(IViewReference) line: 528 ViewFactory$ViewReference.getPart(boolean) line: 102 WorkbenchPage$1.propertyChange(PropertyChangeEvent) line: 132 ViewPane(LayoutPart).setVisible(boolean) line: 268 ViewPane(PartPane).setVisible(boolean) line: 317 ViewPane.setVisible(boolean) line: 568 PresentablePart.setVisible(boolean) line: 122 DefaultViewPresentation(DefaultPartPresentation).selectPart(IPresentable Part) line: 1116 ViewStack(PartStack).refreshPresentationSelection() line: 946 ViewStack(PartStack).createControl(Composite, StackPresentation) line: 467 ViewStack(PartStack).createControl(Composite) line: 367 ViewSashContainer(PartSashContainer).createControl(Composite) line: 432 PerspectiveHelper.activate(Composite) line: 155 Perspective.onActivate() line: 732 WorkbenchPage.onActivate() line: 2063 WorkbenchWindow$4.run() line: 1858 BusyIndicator.showWhile(Display, Runnable) line: 69 WorkbenchWindow.setActivePage(IWorkbenchPage) line: 1845 WorkbenchWindow.restoreState(IMemento, IPerspectiveDescriptor) line: 1409 Workbench.restoreState(IMemento) line: 1224 Workbench.access$10(Workbench, IMemento) line: 1185 Workbench$13.run() line: 1096 InternalPlatform.run(ISafeRunnable) line: 616 Platform.run(ISafeRunnable) line: 747 Workbench.restoreState() line: 1029 WorkbenchConfigurer.restoreState() line: 167 IDEWorkbenchAdvisor(WorkbenchAdvisor).openWindows() line: 652 Workbench.init(Display) line: 819 Workbench.runUI() line: 1325 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 254 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 141 IDEApplication.run(Object) line: 96 PlatformActivator$1.run(Object) line: 335 EclipseStarter.run(Object) line: 273 EclipseStarter.run(String[], Runnable) line: 129 NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method] NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25 Method.invoke(Object, Object[]) line: 324 Main.basicRun(String[]) line: 185 Main.run(String[]) line: 704 Main.main(String[]) line: 688
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java
List fPendingGetChildren;
		
		public PackageExplorerProblemTreeViewer(Composite parent, int style) {
			super(parent, style);
			fPendingGetChildren= Collections.synchronizedList(new ArrayList());
		}
		public void add(Object parentElement, Object[] childElements) {
			if (fPendingGetChildren.contains(parentElement)) 
				return;
			
			
			List l= (List)fAdditionalMappings.get(parentElement);
			if (l == null) {
				super.add(parentElement, childElements);
			} else {
				List stable= new ArrayList(l);
				super.add(parentElement, childElements);
				for (Iterator iter= stable.iterator(); iter.hasNext();) {
					Widget item= (Widget)iter.next();
					super.internalAdd(item, parentElement, childElements);				
				}
			}
		}