ICompilationUnit cu= problemPos.getCompilationUnit(); IPackageFragment pack= (IPackageFragment) cu.getParent(); final ICompilationUnit addedCU= pack.getCompilationUnit(addedCUName);
ICompilationUnit addedCU; if (node.isSimpleName()) { addedCU= ((IPackageFragment) cu.getParent()).getCompilationUnit(addedCUName); } else { IPackageFragmentRoot root= (IPackageFragmentRoot) cu.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT); String packName= ASTResolving.getQualifier(node); addedCU= root.getPackageFragment(packName).getCompilationUnit(addedCUName); }
	public static void addNewTypeProposals(String typeName, ProblemPosition problemPos, int kind, ArrayList proposals) {		String addedCUName= typeName + ".java"; //$NON-NLS-1$		if (!JavaConventions.validateCompilationUnitName(addedCUName).matches(IStatus.ERROR)) {			ICompilationUnit cu= problemPos.getCompilationUnit();			IPackageFragment pack= (IPackageFragment) cu.getParent();			final ICompilationUnit addedCU= pack.getCompilationUnit(addedCUName);			if (!addedCU.exists()) {				if ((kind & SimilarElementsRequestor.CLASSES) != 0) {					String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createclassusingwizard.description", typeName); //$NON-NLS-1$		            proposals.add(new NewCUCompletionUsingWizardProposal(label, typeName, true, problemPos, 0));				}				if ((kind & SimilarElementsRequestor.INTERFACES) != 0) {					String label= CorrectionMessages.getFormattedString("UnresolvedElementsSubProcessor.createinterfaceusingwizard.description", typeName); //$NON-NLS-1$		            proposals.add(new NewCUCompletionUsingWizardProposal(label, typeName, false, problemPos, 0));				}							}		}	}