if (JavaConventions.validateJavaTypeName(text).isOK()) {
if (text != null && JavaConventions.validateJavaTypeName(text).isOK()) {
	protected void initTypePage(IJavaElement elem) {		String initSuperclass= "java.lang.Object"; //$NON-NLS-1$		ArrayList initSuperinterfaces= new ArrayList(5);		IJavaProject project= null;		IPackageFragment pack= null;		IType enclosingType= null;						if (elem != null) {			// evaluate the enclosing type			project= elem.getJavaProject();			pack= (IPackageFragment) elem.getAncestor(IJavaElement.PACKAGE_FRAGMENT);			IType typeInCU= (IType) elem.getAncestor(IJavaElement.TYPE);			if (typeInCU != null) {				if (typeInCU.getCompilationUnit() != null) {					enclosingType= typeInCU;				}			} else {				ICompilationUnit cu= (ICompilationUnit) elem.getAncestor(IJavaElement.COMPILATION_UNIT);				if (cu != null) {					enclosingType= cu.findPrimaryType();				}			}						try {				IType type= null;				if (elem.getElementType() == IJavaElement.TYPE) {					type= (IType)elem;					if (type.exists()) {						String superName= JavaModelUtil.getFullyQualifiedName(type);						if (type.isInterface()) {							initSuperinterfaces.add(superName);						} else {							initSuperclass= superName;						}					}				}			} catch (JavaModelException e) {				JavaPlugin.log(e);				// ignore this exception now			}					}				String typeName= ""; //$NON-NLS-1$				ITextSelection selection= getCurrentTextSelection();		if (selection != null) {			String text= selection.getText();			if (JavaConventions.validateJavaTypeName(text).isOK()) {				typeName= text;			}		}		setPackageFragment(pack, true);		setEnclosingType(enclosingType, true);		setEnclosingTypeSelection(false, true);			setTypeName(typeName, true);		setSuperClass(initSuperclass, true);		setSuperInterfaces(initSuperinterfaces, true);				setAddComments(StubUtility.doAddComments(project), true); // from project or workspace	}		