Bug 28166 Selecting an element in package view is eagerly populating the Java model
Build 20021210 Without even expanding any node, the UI will cause the model to be populated as soon as a node is selected (seems like it is precomputing action to put in the menu). So if simply navigating amongst items in the tree, it will cause lots of activity which is mostly useless. at org.eclipse.jdt.internal.core.PackageFragment.openWhenClosed (PackageFragment.java:313) at org.eclipse.jdt.internal.core.JavaElement.openHierarchy (JavaElement.java:509) at org.eclipse.jdt.internal.core.JavaElement.getElementInfo (JavaElement.java:296) at org.eclipse.jdt.internal.core.JavaElement.getChildren (JavaElement.java:252) at org.eclipse.jdt.internal.core.JavaElement.getChildrenOfType (JavaElement.java:261) at org.eclipse.jdt.internal.core.PackageFragment.getCompilationUnits (PackageFragment.java:190) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.isEnabled (OrganizeImportsAction.java:213) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.selectionChanged (OrganizeImportsAction.java:148) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged (SelectionDispatchAction.java:181) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.selectionChanged (SelectionDispatchAction.java:176) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:148) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1151) at org.eclipse.jface.viewers.StructuredViewer.handleSelect (StructuredViewer.java:540) at org.eclipse.jface.viewers.StructuredViewer$1.widgetSelected (StructuredViewer.java:564) at org.eclipse.jface.util.OpenStrategy.fireSelectionEvent (OpenStrategy.java:172) at org.eclipse.jface.util.OpenStrategy.access$3(OpenStrategy.java:167) at org.eclipse.jface.util.OpenStrategy$1.handleEvent (OpenStrategy.java:302) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1403) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1386) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) 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)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
return false;
	}
	/* (non-Javadoc)
	 * Method declared on SelectionDispatchAction.
	 */
	protected void run(ITextSelection selection) {
		IWorkingCopyManager manager= JavaPlugin.getDefault().getWorkingCopyManager();
		ICompilationUnit cu= manager.getWorkingCopy(fEditor.getEditorInput());
		runOnSingle(cu, true, true);
	}
	
	/* (non-Javadoc)
	 * Method declared on SelectionDispatchAction.
	 */
	protected void run(IStructuredSelection selection) {
		ICompilationUnit[] cus= getCompilationUnits(selection);
		if (cus.length == 1) {
			runOnSingle(cus[0], true, false);
		} else {
			runOnMultiple(cus, true);
		}
	}
	private void runOnMultiple(final ICompilationUnit[] cus, final boolean doResolve) {
		try {
			String message= ActionMessages.getString("OrganizeImportsAction.multi.status.description"); 
			final MultiStatus status= new MultiStatus(JavaUI.ID_PLUGIN, Status.OK, message, null);
			
			ProgressMonitorDialog dialog= new ProgressMonitorDialog(getShell());
			dialog.run(false, true, new WorkbenchRunnableAdapter(new IWorkspaceRunnable() {
				public void run(IProgressMonitor monitor) {