Bug 11314 Replace package name fragments should always be smaller
Build 20020214 If you enter "2~." in the 'Replace package name fragments with:' field in the preferences (Java->Work in progress), com.ibm.foobar is replaced with co~.ib~.foobar. I believe that package name compression should only replace a fragment if the compressed name is actually smaller. Thus com. would not be replaced in this example, since co~. is the same length, and contains less info.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/JavaElementLabels.java
/**
	 * Appends the label for a package fragment to a StringBuffer. Considers the P_* flags.
	 */	
	public static void getPackageFragmentLabel(IPackageFragment pack, int flags, StringBuffer buf) {
		if (getFlag(flags, P_QUALIFIED)) {
			getPackageFragmentRootLabel((IPackageFragmentRoot) pack.getParent(), ROOT_QUALIFIED, buf);
			buf.append('/');
		}
		if (pack.isDefaultPackage()) {
			buf.append(JavaUIMessages.getString("JavaElementLabels.default_package")); 
		} else if (getFlag(flags, P_COMPRESSED)) {
				String name= pack.getElementName();
				refreshPackageNamePattern();
				int start= 0;
				int dot= name.indexOf('.', start);
				while (dot > 0) {
					buf.append(fgPkgNamePrefix);
					if (fgPkgNameChars > 0)
						buf.append(name.substring(start, Math.min(start+ fgPkgNameChars, dot)));
					buf.append(fgPkgNamePostfix);
					start= dot + 1;
					dot= name.indexOf('.', start);
				}
				buf.append(name.substring(start));
		} else {
			buf.append(pack.getElementName());
		}
		if (getFlag(flags, P_POST_QUALIFIED)) {
			buf.append(CONCAT_STRING);
			getPackageFragmentRootLabel((IPackageFragmentRoot) pack.getParent(), ROOT_QUALIFIED, buf);