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
getTypeLabel(field.getDeclaringType(), T_FULLY_QUALIFIED, buf);
				buf.append('.');
			}
			buf.append(field.getElementName());
			
			if (getFlag(flags, F_APP_TYPE_SIGNATURE) && field.exists()) {
				buf.append(DECL_STRING);
				buf.append(Signature.toString(field.getTypeSignature()));
			}
			
			
			if (getFlag(flags, F_POST_QUALIFIED)) {
				buf.append(CONCAT_STRING);
				getTypeLabel(field.getDeclaringType(), T_FULLY_QUALIFIED, buf);
			}
			
		} catch (JavaModelException e) {
			JavaPlugin.log(e); 
		}			
	}
	/**
	 * Appends the label for a initializer to a StringBuffer. Considers the I_* flags.
	 */	
	public static void getInitializerLabel(IInitializer initializer, int flags, StringBuffer buf) {
		
		if (getFlag(flags, I_FULLY_QUALIFIED)) {
			getTypeLabel(initializer.getDeclaringType(), T_FULLY_QUALIFIED, buf);
			buf.append('.');
		}
		buf.append(JavaUIMessages.getString("JavaElementLabels.initializer"));