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
imports= new ImportsStructure(parentCU, prefOrder, threshold, false);
			
			String content= constructTypeStub(imports, lineDelimiter, parentCU);
			createdType= parentCU.createType(content, null, false, new SubProgressMonitor(monitor, 3));
		} else {
			IType enclosingType= getEnclosingType();
			
			
			
			IType workingCopy= (IType) EditorUtility.getWorkingCopy(enclosingType);
			if (workingCopy != null) {
				enclosingType= workingCopy;
			}
			ICompilationUnit parentCU= enclosingType.getCompilationUnit();
			imports= new ImportsStructure(parentCU, prefOrder, threshold, true);
			
			lineDelimiter= StubUtility.getLineDelimiterUsed(enclosingType);
			String content= constructTypeStub(imports, lineDelimiter, parentCU);
			IJavaElement[] elems= enclosingType.getChildren();
			IJavaElement sibling= elems.length > 0 ? elems[0] : null;
			
			createdType= enclosingType.createType(content, sibling, false, new SubProgressMonitor(monitor, 1));
		
			indent= StubUtility.getIndentUsed(enclosingType) + 1;
		}
		
		
		imports.create(!isInnerClass, new SubProgressMonitor(monitor, 1));
		
		createTypeMembers(createdType, imports, new SubProgressMonitor(monitor, 1));