Bug 36554 JDT/UI plugin activation fails when activated in non UI thread
2.1 Activating the JDT/UI plug-in in a non UI thread fails with an SWT.Error. The stack trace is: org.eclipse.swt.SWTException: Invalid thread access at org.eclipse.swt.SWT.error(SWT.java:2332) at org.eclipse.swt.SWT.error(SWT.java:2262) at org.eclipse.swt.widgets.Widget.error(Widget.java:385) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:246) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:237) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:190) at org.eclipse.swt.widgets.Shell.<init>(Shell.java:128) at org.eclipse.jface.resource.FontRegistry.defaultFont (FontRegistry.java:293) at org.eclipse.jface.resource.FontRegistry.get(FontRegistry.java:370) at org.eclipse.jface.resource.JFaceResources.getFont (JFaceResources.java:183) at org.eclipse.jdt.internal.ui.JavaPlugin.startup(JavaPlugin.java:241) at org.eclipse.core.internal.plugins.PluginDescriptor$1.run (PluginDescriptor.java:728) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:889) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation (PluginDescriptor.java:740) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation (PluginDescriptor.java:188) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin (PluginClassLoader.java:112) at org.eclipse.core.internal.plugins.PluginClassLoader.internalFindClassParentsSel f(PluginClassLoader.java:185) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassParentsSelf (DelegatingURLClassLoader.java:490) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:882) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.access$0 (DelegatingURLClassLoader.java:876) at org.eclipse.core.internal.boot.DelegatingURLClassLoader$DelegateLoader.loadClas s(DelegatingURLClassLoader.java:90) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassPrerequisites (DelegatingURLClassLoader.java:554) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:890) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:862) at java.lang.ClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClassInternal(Unknown Source) at java.lang.Class.getDeclaredConstructors0(Native Method) at java.lang.Class.privateGetDeclaredConstructors(Unknown Source) at java.lang.Class.getConstructor0(Unknown Source) at java.lang.Class.getConstructor(Unknown Source) at org.eclipse.core.internal.plugins.PluginDescriptor.internalDoPluginActivation (PluginDescriptor.java:701) at org.eclipse.core.internal.plugins.PluginDescriptor.doPluginActivation (PluginDescriptor.java:188) at org.eclipse.core.internal.plugins.PluginClassLoader.activatePlugin (PluginClassLoader.java:112) at org.eclipse.core.internal.plugins.PluginClassLoader.internalFindClassParentsSel f(PluginClassLoader.java:185) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.findClassParentsSelf (DelegatingURLClassLoader.java:485) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:882) at org.eclipse.core.internal.boot.DelegatingURLClassLoader.loadClass (DelegatingURLClassLoader.java:862) at java.lang.ClassLoader.loadClass(Unknown Source) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:130) at org.eclipse.core.internal.plugins.PluginDescriptor.createExecutableExtension (PluginDescriptor.java:167) at org.eclipse.core.internal.plugins.ConfigurationElement.createExecutableExtensio n(ConfigurationElement.java:103) at org.eclipse.core.internal.events.BuildManager.instantiateBuilder (BuildManager.java:555) at org.eclipse.core.internal.events.BuildManager.initializeBuilder (BuildManager.java:509) at org.eclipse.core.internal.events.BuildManager.getBuilder (BuildManager.java:359) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:170) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:191) at org.eclipse.core.internal.events.BuildManager$1.run (BuildManager.java:151) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:889) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.core.internal.events.BuildManager.basicBuild (BuildManager.java:165) at org.eclipse.core.internal.events.BuildManager.basicBuildLoop (BuildManager.java:243) at org.eclipse.core.internal.events.BuildManager.build (BuildManager.java:212) at org.eclipse.core.internal.resources.Workspace.endOperation (Workspace.java:884) at org.eclipse.core.internal.resources.Workspace.run (Workspace.java:1600) at org.eclipse.ui.actions.WorkspaceModifyOperation.run (WorkspaceModifyOperation.java:85) at org.eclipse.jface.operation.ModalContext$ModalContextThread.run (ModalContext.java:101)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/JavaPlugin.java
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.IContextMenuConstants;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.PreferenceConstants;
import org.eclipse.jdt.ui.text.JavaTextTools;
import org.eclipse.jdt.internal.corext.javadoc.JavaDocLocations;
import org.eclipse.jdt.internal.ui.browsing.LogicalPackage;
import org.eclipse.jdt.internal.ui.javaeditor.ClassFileDocumentProvider;
import org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider;
import org.eclipse.jdt.internal.ui.javaeditor.WorkingCopyManager;
import org.eclipse.jdt.internal.ui.preferences.MembersOrderPreferenceCache;
import org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverDescriptor;
import org.eclipse.jdt.internal.ui.viewsupport.ImageDescriptorRegistry;
import org.eclipse.jdt.internal.ui.viewsupport.ProblemMarkerManager;
/**
 * Represents the java plugin. It provides a series of convenience methods such as
 * access to the workbench, keeps track of elements shared by all editors and viewers
 * of the plugin such as document providers and find-replace-dialogs.
 */
public class JavaPlugin extends AbstractUIPlugin {