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
if (root != null && getFlag(flags, APPEND_ROOT_PATH)) {
			buf.append(CONCAT_STRING);
			getPackageFragmentRootLabel(root, ROOT_QUALIFIED, buf);
		}
	}
	/**
	 * Appends the label for a method to a StringBuffer. Considers the M_* flags.
	 */		
	public static void getMethodLabel(IMethod method, int flags, StringBuffer buf) {
		try {
			
			if (getFlag(flags, M_PRE_RETURNTYPE) && method.exists() && !method.isConstructor()) {
				buf.append(Signature.getSimpleName(Signature.toString(method.getReturnType())));
				buf.append(' ');
			}
			
			
			if (getFlag(flags, M_FULLY_QUALIFIED)) {
				getTypeLabel(method.getDeclaringType(), T_FULLY_QUALIFIED, buf);
				buf.append('.');
			}
				
			buf.append(method.getElementName());
			
			
			if (getFlag(flags, M_PARAMETER_TYPES | M_PARAMETER_NAMES)) {
				buf.append('(');
				
				String[] types= getFlag(flags, M_PARAMETER_TYPES) ? method.getParameterTypes() : null;
				String[] names= (getFlag(flags, M_PARAMETER_NAMES) && method.exists()) ? method.getParameterNames() : null;