Bug 9737 Invalid thread access initializing JavaPlugin
Build 20020212 - I opened a self hosting workspace from the previous build, with only the resources perspective operation - The default installed JRE was a J9 VM - I caused a build to happen, and it looks like the PDE builder caused a whole chain of plugin activations, including JavaPlugin (strange that a core plugin caused a UI plugin to load). - JavaPlugin initialization tries to access the Display, but is in the wrong thread so it fails to activate. Stack trace: 4 org.eclipse.core.runtime 2 Plugin org.eclipse.jdt.ui was unable to instantiate class org.eclipse.jdt.internal.ui.JavaPlugin. java.lang.reflect.InvocationTargetException: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:1887) at org.eclipse.swt.SWT.error(SWT.java:1819) at org.eclipse.swt.widgets.Display.checkDevice(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.checkDevice(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.disposeExec(Display.java:416) at org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry.hookDisplay(Imag eDescriptorRegistry.java:78) at org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry.<init>(ImageDesc riptorRegistry.java:42) at org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry.<init>(ImageDesc riptorRegistry.java:30) at org.eclipse.jdt.internal.ui.JavaPlugin.<init>(JavaPlugin.java:186) at java.lang.reflect.Constructor.newInstance(Native Method) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(Pl uginDescriptor.java:687) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDesc riptor.java:184) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLo ader.java:52) at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0(DelegatingURLCl assLoader.java:765) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites(D elegatingURLClassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites(D elegatingURLClassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at org.eclipse.jdt.internal.debug.ui.JDIDebugUIPlugin.<init>(JDIDebugUIPlugin.java: 63) at java.lang.reflect.Constructor.newInstance(Native Method) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(Pl uginDescriptor.java:687) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDesc riptor.java:184) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLo ader.java:52) at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu ginDescriptor.java:128) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu ginDescriptor.java:165) at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension (ConfigurationElement.java:96) at org.eclipse.jdt.launching.JavaRuntime.initializeVMTypes(JavaRuntime.java:135) at org.eclipse.jdt.launching.JavaRuntime.getDefaultVMId(JavaRuntime.java:258) at org.eclipse.jdt.launching.JavaRuntime.getDefaultVMInstall(JavaRuntime.java:245) at org.eclipse.jdt.launching.JavaRuntime.initializeJREVariables(JavaRuntime.java:55 6) at org.eclipse.pde.internal.PDEPlugin$1.run(PDEPlugin.java:315) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1232) at org.eclipse.pde.internal.PDEPlugin.startup(PDEPlugin.java:320) at org.eclipse.core.internal.plugins.PluginDescriptor$1.run(PluginDescriptor.java:7 01) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:817 ) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation(Pl uginDescriptor.java:713) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation(PluginDesc riptor.java:184) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin(PluginClassLo ader.java:52) at org.eclipse.core.internal.plugins.PluginClassLoader.findClassParentsSelf(PluginC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass(DelegatingURLC lassLoader.java(Compiled Code)) at java.lang.ClassLoader.loadClass(ClassLoader.java(Compiled Code)) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu ginDescriptor.java:128) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension(Plu ginDescriptor.java:165) at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtension (ConfigurationElement.java:96) at org.eclipse.core.internal.events.BuildManager.instantiateBuilder(BuildManager.ja va:489) at org.eclipse.core.internal.events.BuildManager.getBuilder(BuildManager.java:321) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:152) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:184) at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:133) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:817 ) at org.eclipse.core.runtime.Platform.run(Platform.java:395) at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:147) at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:230) at org.eclipse.core.internal.resources.Project.build(Project.java:105) at org.eclipse.ui.actions.BuildAction.invokeOperation(BuildAction.java:151) at org.eclipse.ui.actions.WorkspaceAction.execute(WorkspaceAction.java:111) at org.eclipse.ui.actions.WorkspaceAction$1.execute(WorkspaceAction.java:268) at org.eclipse.ui.actions.WorkspaceModifyOperation$1.run(WorkspaceModifyOperation.j ava:64) at org.eclipse.core.internal.resources.Workspace.run(Workspace.java:1232) at org.eclipse.ui.actions.WorkspaceModifyOperation.run(WorkspaceModifyOperation.jav a:78) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.jav a:98)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
public static IWorkbenchWindow getActiveWorkbenchWindow() {
		return getDefault().getWorkbench().getActiveWorkbenchWindow();
	}
	
	public static Shell getActiveWorkbenchShell() {
		return getActiveWorkbenchWindow().getShell();
	}
	
	/**
	 * Returns an array of all editors that have an unsaved content. If the identical content is 
	 * presented in more than one editor, only one of those editor parts is part of the result.
	 * 
	 * @return an array of all dirty editor parts.
	 */
	public static IEditorPart[] getDirtyEditors() {
		Set inputs= new HashSet(7);
		List result= new ArrayList(0);
		IWorkbench workbench= getDefault().getWorkbench();
		IWorkbenchWindow[] windows= workbench.getWorkbenchWindows();
		for (int i= 0; i < windows.length; i++) {
			IWorkbenchPage[] pages= windows[i].getPages();
			for (int x= 0; x < pages.length; x++) {
				IEditorPart[] editors= pages[x].getEditors();
				for (int z= 0; z < editors.length; z++) {
					IEditorPart editor= editors[z];
					IEditorInput input= editor.getEditorInput();
					if (editor.isDirty() && !inputs.contains(input)) {
						inputs.add(input);
						result.add(editor);
					}