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
StatusInfo status= new StatusInfo();
		fPackageDialogField.enableButton(getPackageFragmentRoot() != null);
		
		String packName= getPackageText();
		if (packName.length() > 0) {
			IStatus val= JavaConventions.validatePackageName(packName);
			if (val.getSeverity() == IStatus.ERROR) {
				status.setError(NewWizardMessages.getFormattedString("NewTypeWizardPage.error.InvalidPackageName", val.getMessage())); 
				return status;
			} else if (val.getSeverity() == IStatus.WARNING) {
				status.setWarning(NewWizardMessages.getFormattedString("NewTypeWizardPage.warning.DiscouragedPackageName", val.getMessage())); 
				
			}
		}
		
		IPackageFragmentRoot root= getPackageFragmentRoot();
		if (root != null) {
			if (root.getJavaProject().exists() && packName.length() > 0) {
				try {
					IPath rootPath= root.getPath();
					IPath outputPath= root.getJavaProject().getOutputLocation();
					if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
						
						
						IPath packagePath= rootPath.append(packName.replace('.', '/'));
						if (outputPath.isPrefixOf(packagePath)) {
							status.setError(NewWizardMessages.getString("NewTypeWizardPage.error.ClashOutputLocation")); 
							return status;
						}
					}