public void addImport(String packageName, String typeName) { String fullTypeName= JavaModelUtility.concatenateName(packageName, typeName); IImportDeclaration decl= fCompilationUnit.getImport(fullTypeName);  PackageEntry bestMatch= findBestMatch(packageName); if (bestMatch == null) { PackageEntry packEntry= new PackageEntry(packageName, -1); packEntry.add(decl); fPackageEntries.add(packEntry); } else { int cmp= packageName.compareTo(bestMatch.getName()); if (cmp == 0) { bestMatch.sortIn(decl); } else {  PackageEntry packEntry= new PackageEntry(packageName, bestMatch.getCategory()); packEntry.add(decl); int index= fPackageEntries.indexOf(bestMatch); if (cmp < 0) { fPackageEntries.add(index, packEntry); } else { fPackageEntries.add(index + 1, packEntry); } } }
public void addImport(String qualifiedTypeName) { String packName= Signature.getQualifier(qualifiedTypeName); String typeName= Signature.getSimpleName(qualifiedTypeName); addImport(packName, typeName);
	public void addImport(String packageName, String typeName) {		String fullTypeName= JavaModelUtility.concatenateName(packageName, typeName);		IImportDeclaration decl= fCompilationUnit.getImport(fullTypeName);					PackageEntry bestMatch= findBestMatch(packageName);		if (bestMatch == null) {			PackageEntry packEntry= new PackageEntry(packageName, -1);			packEntry.add(decl);			fPackageEntries.add(packEntry);		} else {			int cmp= packageName.compareTo(bestMatch.getName());			if (cmp == 0) {				bestMatch.sortIn(decl);			} else {				// create a new packageentry				PackageEntry packEntry= new PackageEntry(packageName, bestMatch.getCategory());				packEntry.add(decl);				int index= fPackageEntries.indexOf(bestMatch);				if (cmp < 0) { 	// sort in ahead of best match					fPackageEntries.add(index, packEntry);				} else {		// sort in after best match					fPackageEntries.add(index + 1, packEntry);				}			}		}	}