Bug 32460 Restoring type hierarchy on startup taking for ever
Build 20030221 See below an explanation of a long startup time when opening an old workspace with one hierarchy view opened and index format changed in the meantime. No progress, actually no UI shows up for 5 minutes (it is reindexing the entire world). 2.0 workspaces are likely going to be in this exact mode. I believe the hierarchy computation should time out after 5 seconds of indexes not being available (during hierarchy restoration). "ModalContext" prio=5 tid=0x13966020 nid=0x5e8 runnable [14eaf000..14eafd8c] at org.eclipse.jdt.internal.core.index.impl.Field.<init>(Field.java:48) at org.eclipse.jdt.internal.core.index.impl.Block.<init>(Block.java:34) at org.eclipse.jdt.internal.core.index.impl.IndexBlock.<init> (IndexBlock.java:22) at org.eclipse.jdt.internal.core.index.impl.GammaCompressedIndexBlock.<init> (GammaCompressedIndexBlock.java:25) at org.eclipse.jdt.internal.core.index.impl.BlocksIndexInput.getIndexBlock (BlocksIndexInput.java:104) at org.eclipse.jdt.internal.core.index.impl.BlocksIndexInput.queryEntriesPrefixedBy (BlocksIndexInput.java:281) at org.eclipse.jdt.internal.core.search.matching.SuperTypeReferencePattern.findInde xMatches(SuperTypeReferencePattern.java:129) at org.eclipse.jdt.internal.core.search.SubTypeSearchJob.search (SubTypeSearchJob.java:90) at org.eclipse.jdt.internal.core.search.PatternSearchJob.execute (PatternSearchJob.java:93) at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob (JobManager.java:267) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.searchAllPoss ibleSubTypes(IndexBasedHierarchyBuilder.java:517) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.determinePoss ibleSubTypes(IndexBasedHierarchyBuilder.java:384) at org.eclipse.jdt.internal.core.hierarchy.IndexBasedHierarchyBuilder.build (IndexBasedHierarchyBuilder.java:154) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.compute (TypeHierarchy.java:322) at org.eclipse.jdt.internal.core.hierarchy.TypeHierarchy.refresh (TypeHierarchy.java:1368) at org.eclipse.jdt.internal.core.CreateTypeHierarchyOperation.executeOperation (CreateTypeHierarchyOperation.java:78) at org.eclipse.jdt.internal.core.JavaModelOperation.execute (JavaModelOperation.java:365) at org.eclipse.jdt.internal.core.JavaModelOperation.run (JavaModelOperation.java:681) at org.eclipse.jdt.internal.core.JavaElement.runOperation (JavaElement.java:553) at org.eclipse.jdt.internal.core.BinaryType.newTypeHierarchy (BinaryType.java:469) at org.eclipse.jdt.internal.core.BinaryType.newTypeHierarchy (BinaryType.java:458) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.doHierarchyRefr esh(TypeHierarchyLifeCycle.java:152) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.access$0 (TypeHierarchyLifeCycle.java:137) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle$1.run (TypeHierarchyLifeCycle.java:109) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:95) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x13936D78 nid=0x5d4 in Object.wait() [14def000..14defd8c] at java.lang.Object.wait(Native Method) - waiting on <04259690> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run (AbstractReconciler.java:161) - locked <04259690> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "org.eclipse.jdt.internal.ui.text.JavaReconciler" daemon prio=2 tid=0x1388B000 nid=0x3a4 in Object.wait() [14adf000..14adfd8c] at java.lang.Object.wait(Native Method) - waiting on <03FAC298> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run (AbstractReconciler.java:161) - locked <03FAC298> (a org.eclipse.jface.text.reconciler.DirtyRegionQueue) "Java indexing" daemon prio=4 tid=0x1353E7F0 nid=0x614 waiting on condition [1429f000..1429fd8c] at java.lang.Thread.sleep(Native Method) at org.eclipse.jdt.internal.core.search.processing.JobManager.run (JobManager.java:334) at java.lang.Thread.run(Thread.java:536) "Signal Dispatcher" daemon prio=10 tid=0x00904228 nid=0x4f0 runnable [0..0] "Finalizer" daemon prio=9 tid=0x008FDCD0 nid=0x4ec in Object.wait() [133cf000..133cfd8c] at java.lang.Object.wait(Native Method) - waiting on <03950138> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:111) - locked <03950138> (a java.lang.ref.ReferenceQueue$Lock) at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:127) at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159) "Reference Handler" daemon prio=10 tid=0x0023D3B0 nid=0x630 in Object.wait() [1338f000..1338fd8c] at java.lang.Object.wait(Native Method) - waiting on <039501A0> (a java.lang.ref.Reference$Lock) at java.lang.Object.wait(Object.java:426) at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:113) - locked <039501A0> (a java.lang.ref.Reference$Lock) "main" prio=5 tid=0x00234CF8 nid=0x640 runnable [6e000..6fc40] at org.eclipse.swt.internal.win32.OS.WaitMessage(Native Method) at org.eclipse.swt.widgets.Display.sleep(Display.java:2064) at org.eclipse.jface.operation.ModalContext$ModalContextThread.block (ModalContext.java:131) at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:255) at org.eclipse.jface.window.ApplicationWindow$1.run (ApplicationWindow.java:431) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.jface.window.ApplicationWindow.run (ApplicationWindow.java:428) at org.eclipse.ui.internal.WorkbenchWindow.run (WorkbenchWindow.java:1363) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyLifeCycle.ensureRefreshed TypeHierarchy(TypeHierarchyLifeCycle.java:121) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.updateInput (TypeHierarchyViewPart.java:458) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.setInputElement (TypeHierarchyViewPart.java:439) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.restoreState (TypeHierarchyViewPart.java:1344) at org.eclipse.jdt.internal.ui.typehierarchy.TypeHierarchyViewPart.createPartContro l(TypeHierarchyViewPart.java:773) at org.eclipse.ui.internal.PartPane$4.run(PartPane.java:138) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:867) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.PartPane.createChildControl (PartPane.java:134) at org.eclipse.ui.internal.ViewPane.createChildControl (ViewPane.java:202) at org.eclipse.ui.internal.PartPane.createControl(PartPane.java:183) at org.eclipse.ui.internal.ViewPane.createControl(ViewPane.java:181) at org.eclipse.ui.internal.PartTabFolder.createPartTab (PartTabFolder.java:251) at org.eclipse.ui.internal.PartTabFolder.createControl (PartTabFolder.java:223) at org.eclipse.ui.internal.PartSashContainer.createControl (PartSashContainer.java:191) at org.eclipse.ui.internal.PerspectivePresentation.activate (PerspectivePresentation.java:96) at org.eclipse.ui.internal.Perspective.onActivate(Perspective.java:715) at org.eclipse.ui.internal.WorkbenchPage.onActivate (WorkbenchPage.java:1777) at org.eclipse.ui.internal.WorkbenchWindow$7.run (WorkbenchWindow.java:1474) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.WorkbenchWindow.setActivePage (WorkbenchWindow.java:1461) at org.eclipse.ui.internal.WorkbenchWindow.restoreState (WorkbenchWindow.java:1342) at org.eclipse.ui.internal.Workbench.restoreState(Workbench.java:1132) at org.eclipse.ui.internal.Workbench.access$9(Workbench.java:1092) at org.eclipse.ui.internal.Workbench$10.run(Workbench.java:1010) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:867) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.Workbench.openPreviousWorkbenchState (Workbench.java:962) at org.eclipse.ui.internal.Workbench.init(Workbench.java:742) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1242) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539) "VM Thread" prio=5 tid=0x008DD950 nid=0x5e0 runnable "VM Periodic Task Thread" prio=10 tid=0x009046F0 nid=0x634 waiting on condition "Suspend Checker Thread" prio=10 tid=0x008FDAB0 nid=0x300 runnable Startup complete: 192857ms
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/typehierarchy/TypeHierarchyViewPart.java
}
	}	
	
	private IType getSelectableType(IJavaElement elem) {
		if (elem.getElementType() != IJavaElement.TYPE) {
			return null; 
		} else {
			return (IType) elem;
		}
	}
	
	private void internalSelectType(IMember elem, boolean reveal) {	
		TypeHierarchyViewer viewer= getCurrentViewer();
		viewer.removeSelectionChangedListener(fSelectionChangedListener);
		viewer.setSelection(elem != null ? new StructuredSelection(elem) : StructuredSelection.EMPTY, reveal);
		viewer.addSelectionChangedListener(fSelectionChangedListener);
	}
		
	/**
	 * When the input changed or the hierarchy pane becomes visible,
	 * <code>updateHierarchyViewer<code> brings up the correct view and refreshes
	 * the current tree
	 */
	private void updateHierarchyViewer(final boolean doExpand) {
		if (fInputElement == null) {
			fPagebook.showPage(fNoHierarchyShownLabel);
		} else {
			if (getCurrentViewer().containsElements() != null) {
				Runnable runnable= new Runnable() {
					public void run() {