Bug 12101 NewTypeWizardPage.createType crashes in non-ui thread
When performing the IRunnableWithProgress from NewTypeWizardPage.getRunnable, I get the stack-trace shown below. This is caused by a creation of the JavaTextTools object. Currently, my workaround is to call JavaPlugin.getDefault().getJavaTextTools() in the constructor of the class that I derive from NewTypeWizardPage. Stack trace: java/lang/Throwable.<init>()V java/lang/Throwable.<init>(Ljava/lang/String;)V java/lang/NullPointerException.<init>(Ljava/lang/String;)V org/eclipse/jdt/internal/ui/text/JavaColorManager.getColor(Lorg/eclipse/swt/graphics/RGB;)Lorg/eclipse/swt/graphics/Color; org/eclipse/jdt/internal/ui/text/JavaColorManager.getColor(Ljava/lang/String;)Lorg/eclipse/swt/graphics/Color; org/eclipse/jdt/internal/ui/text/AbstractJavaScanner.addToken(Ljava/lang/String;Ljava/lang/String;)V org/eclipse/jdt/internal/ui/text/AbstractJavaScanner.initialize()V org/eclipse/jdt/internal/ui/text/java/JavaCodeScanner.<init>(Lorg/eclipse/jdt/ui/text/IColorManager;Lorg/eclipse/jface/preference/IPreferenceStore;)V org/eclipse/jdt/ui/text/JavaTextTools.<init>(Lorg/eclipse/jface/preference/IPreferenceStore;)V org/eclipse/jdt/internal/ui/JavaPlugin.getJavaTextTools()Lorg/eclipse/jdt/ui/text/JavaTextTools; org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider$BufferFactory.internalCreateDocument(Lorg/eclipse/ui/IFileEditorInput;)Lorg/eclipse/jface/text/IDocument; org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider$BufferFactory.internalGetDocument(Lorg/eclipse/ui/IFileEditorInput;)Lorg/eclipse/jface/text/IDocument; org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider$BufferFactory.createBuffer(Lorg/eclipse/jdt/core/IOpenable;)Lorg/eclipse/jdt/core/IBuffer; org/eclipse/jdt/internal/core/CompilationUnit.getWorkingCopy(Lorg/eclipse/core/runtime/IProgressMonitor;Lorg/eclipse/jdt/core/IBufferFactory;)Lorg/eclipse/jdt/core/IJavaElement; org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider.createElementInfo(Ljava/lang/Object;)Lorg/eclipse/ui/texteditor/AbstractDocumentProvider$ElementInfo; org/eclipse/ui/texteditor/AbstractDocumentProvider.connect(Ljava/lang/Object;)V org/eclipse/jdt/internal/corext/textmanipulation/TextBufferFactory.acquire(Lorg/eclipse/core/resources/IFile;)Lorg/eclipse/jdt/internal/corext/textmanipulation/TextBuffer; org/eclipse/jdt/internal/corext/textmanipulation/TextBuffer.acquire(Lorg/eclipse/core/resources/IFile;)Lorg/eclipse/jdt/internal/corext/textmanipulation/TextBuffer; org/eclipse/jdt/internal/corext/codemanipulation/ImportsStructure.aquireTextBuffer()Lorg/eclipse/jdt/internal/corext/textmanipulation/TextBuffer; org/eclipse/jdt/internal/corext/codemanipulation/ImportsStructure.create(ZLorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/ui/wizards/NewTypeWizardPage.createType(Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jdt/ui/wizards/NewTypeWizardPage$1.run(Lorg/eclipse/core/runtime/IProgressMonitor;)V com/ibm/ive/jxe/buildfile/RunnableActionExecutor.run(Lorg/eclipse/core/runtime/IProgressMonitor;)V org/eclipse/jface/operation/ModalContext$ModalContextThread.run()V
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/wizards/NewTypeWizardPage.java
if (root == null) {
			return null;
		}
		
		IJavaSearchScope scope= SearchEngine.createJavaSearchScope(new IJavaElement[] { root });
			
		TypeSelectionDialog dialog= new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.TYPE, scope);
		dialog.setTitle(NewWizardMessages.getString("NewTypeWizardPage.ChooseEnclosingTypeDialog.title")); 
		dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.ChooseEnclosingTypeDialog.description")); 
		if (fCurrEnclosingType != null) {
			dialog.setInitialSelections(new Object[] { fCurrEnclosingType });
			dialog.setFilter(fCurrEnclosingType.getElementName().substring(0, 1));
		}
		
		if (dialog.open() == dialog.OK) {	
			return (IType) dialog.getFirstResult();
		}
		return null;
	}	
	
	private IType chooseSuperType() {
		IPackageFragmentRoot root= getPackageFragmentRoot();
		if (root == null) {
			return null;
		}	
		IJavaElement[] elements= new IJavaElement[] { root.getJavaProject() };
		IJavaSearchScope scope= SearchEngine.createJavaSearchScope(elements);
		TypeSelectionDialog dialog= new TypeSelectionDialog(getShell(), getWizard().getContainer(), IJavaSearchConstants.CLASS, scope);
		dialog.setTitle(NewWizardMessages.getString("NewTypeWizardPage.SuperClassDialog.title")); 
		dialog.setMessage(NewWizardMessages.getString("NewTypeWizardPage.SuperClassDialog.message"));