Bug 48999 Anonym type can have field as parent
JavaElementLabels does only the 'is parent method' test
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/JavaElementLabels.java
private JavaElementLabels() {
	}
	private static boolean getFlag(int flags, int flag) {
		return (flags & flag) != 0;
	}
	
	public static String getTextLabel(Object obj, int 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. Flags as defined above.
	 */
	public static String getElementLabel(IJavaElement element, int flags) {
		StringBuffer buf= new StringBuffer(60);
		getElementLabel(element, flags, buf);
		return buf.toString();
	}
	
	/**
	 * Returns the label for a Java element. Flags as defined above.
	 */