Bug 116199 [render] Easy-to-read .jar file reference
In the "Package Explorer" one often ends up with complicated or long paths to the jar files that are rererenced, and because of this the file name often ends up outside the viewable area, the explorer being relatively narrow. The idea here is simply to replace the label text with "shortname (path)" in stead of "path/shortname". I.e. in stead of the current label text that might be M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar Use jarfile.jar (M2_REPO/junit/junit/3.8.1) or jarfile.jar (M2_REPO/junit/junit/3.8.1/junit-3.8.1.jar) This way, one can always see the name of the jar file in the browser.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/JavaElementLabels.java
private static final boolean getFlag(long flags, long flag) {
		return (flags & flag) != 0;
	}
	
	/**
	 * Returns the label of the given object. The object must be of type {@link IJavaElement} or adapt to {@link IWorkbenchAdapter}. The empty string is returned
	 * if the element type is not known.
	 * @param obj Object to get the label from.
	 * @param flags The rendering flags
	 * @return Returns the label or the empty string if the object type is not supported.
	 */
	public static String getTextLabel(Object obj, long flags) {
		if (obj instanceof IJavaElement) {
			return getElementLabel((IJavaElement) obj, flags);
		} else if (obj instanceof IAdaptable) {
			IWorkbenchAdapter wbadapter= (IWorkbenchAdapter) ((IAdaptable)obj).getAdapter(IWorkbenchAdapter.class);
			if (wbadapter != null) {
				return wbadapter.getLabel(obj);
			}
		}
		return ""; 
	}
				
	/**
	 * Returns the label for a Java element with the flags as defined by this class.
	 * @param element The element to render.
	 * @param flags The rendering flags.
	 * @return the label of the Java element
	 */
	public static String getElementLabel(IJavaElement element, long flags) {