JavaModelUtil.reconcile(cu);
synchronized(cu) { cu.reconcile(); }
	public void createType(IProgressMonitor monitor) throws CoreException, InterruptedException {				if (monitor == null) {			monitor= new NullProgressMonitor();		}		monitor.beginTask(NewWizardMessages.getString("NewTypeWizardPage.operationdesc"), 10); //$NON-NLS-1$				ICompilationUnit createdWorkingCopy= null;		try {			IPackageFragmentRoot root= getPackageFragmentRoot();			IPackageFragment pack= getPackageFragment();			if (pack == null) {				pack= root.getPackageFragment(""); //$NON-NLS-1$			}						if (!pack.exists()) {				String packName= pack.getElementName();				pack= root.createPackageFragment(packName, true, null);			}								monitor.worked(1);						String clName= getTypeName();						boolean isInnerClass= isEnclosingTypeSelected();						IType createdType;			ImportsStructure imports;			int indent= 0;				IPreferenceStore store= PreferenceConstants.getPreferenceStore();			String[] prefOrder= JavaPreferencesSettings.getImportOrderPreference(store);			int threshold= JavaPreferencesSettings.getImportNumberThreshold(store);									String lineDelimiter= null;				if (!isInnerClass) {				lineDelimiter= System.getProperty("line.separator", "\n"); //$NON-NLS-1$ //$NON-NLS-2$														ICompilationUnit parentCU= pack.createCompilationUnit(clName + ".java", "", false, new SubProgressMonitor(monitor, 2)); //$NON-NLS-1$ //$NON-NLS-2$				createdWorkingCopy= (ICompilationUnit) parentCU.getSharedWorkingCopy(null, JavaUI.getBufferFactory(), null);											imports= new ImportsStructure(createdWorkingCopy, prefOrder, threshold, false);				// add an import that will be removed again. Having this import solves 14661				imports.addImport(pack.getElementName(), getTypeName());								String typeContent= constructTypeStub(new ImportsManager(imports), lineDelimiter);								String cuContent= constructCUContent(parentCU, typeContent, lineDelimiter);								createdWorkingCopy.getBuffer().setContents(cuContent);								createdType= createdWorkingCopy.getType(clName);			} else {				IType enclosingType= getEnclosingType();								// if we are working on a enclosed type that is open in an editor,				// then replace the enclosing type with its working copy				IType workingCopy= (IType) EditorUtility.getWorkingCopy(enclosingType);				if (workingCopy != null) {					enclosingType= workingCopy;				}					ICompilationUnit parentCU= enclosingType.getCompilationUnit();				imports= new ImportsStructure(parentCU, prefOrder, threshold, true);					// add imports that will be removed again. Having the imports solves 14661				IType[] topLevelTypes= parentCU.getTypes();				for (int i= 0; i < topLevelTypes.length; i++) {					imports.addImport(topLevelTypes[i].getFullyQualifiedName('.'));				}								lineDelimiter= StubUtility.getLineDelimiterUsed(enclosingType);				StringBuffer content= new StringBuffer();				String comment= getTypeComment(parentCU);				if (comment != null) {					content.append(comment);					content.append(lineDelimiter);				}				content.append(constructTypeStub(new ImportsManager(imports), lineDelimiter));				IJavaElement[] elems= enclosingType.getChildren();				IJavaElement sibling= elems.length > 0 ? elems[0] : null;								createdType= enclosingType.createType(content.toString(), sibling, false, new SubProgressMonitor(monitor, 1));							indent= StubUtility.getIndentUsed(enclosingType) + 1;			}						// add imports for superclass/interfaces, so types can be resolved correctly			imports.create(false, new SubProgressMonitor(monitor, 1));				ICompilationUnit cu= createdType.getCompilationUnit();			JavaModelUtil.reconcile(cu);				createTypeMembers(createdType, new ImportsManager(imports), new SubProgressMonitor(monitor, 1));				// add imports			imports.create(false, new SubProgressMonitor(monitor, 1));						JavaModelUtil.reconcile(cu);			ISourceRange range= createdType.getSourceRange();						IBuffer buf= cu.getBuffer();			String originalContent= buf.getText(range.getOffset(), range.getLength());			String formattedContent= StubUtility.codeFormat(originalContent, indent, lineDelimiter);			buf.replace(range.getOffset(), range.getLength(), formattedContent);			if (!isInnerClass) {				String fileComment= getFileComment(cu);				if (fileComment != null && fileComment.length() > 0) {					buf.replace(0, 0, fileComment + lineDelimiter);				}				cu.commit(false, new SubProgressMonitor(monitor, 1));			} else {				monitor.worked(1);			}			fCreatedType= createdType;		} finally {			if (createdWorkingCopy != null) {				createdWorkingCopy.destroy();			}			monitor.done();		}	}	