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
buf.append(CONCAT_STRING);
				buf.append(root.getParent().getElementName());
			}
		}		
	}	
	private static void refreshPackageNamePattern() {
		String pattern= WorkInProgressPreferencePage.getPkgNamePatternForPackagesView();
		if (pattern.equals(fgPkgNamePattern))
			return;
		fgPkgNamePattern= pattern;
		int i= 0;
		fgPkgNameChars= 0;
		fgPkgNamePrefix= "";
		fgPkgNamePostfix= "";
		while (i < pattern.length()) {
			char ch= pattern.charAt(i);
			if (Character.isDigit(ch)) {
				fgPkgNameChars= ch-48;
				if (i > 0 && i < pattern.length() - 1)
					fgPkgNamePrefix= pattern.substring(0, i);
				if (i >= 0 && i < pattern.length())
					fgPkgNamePostfix= pattern.substring(i+1);
				return;
			}
			i++;
		}
		fgPkgNamePrefix= pattern;
	}
}