Bug 142376 Set initial AggregateOn selection based on group level of data item
Create a table with a group. The following is the most common operation sequence for a user to insert an aggregate into the header of that group: (1) Insert a data item to the header of the group (2) In the ensuring "Select Data Binding" dialog, insert a new data binding and then edit the expression to create the aggregate. Note that in Step (2), the "AggregateOn" field is currently initially set at "None", which is almost certainly wrong since the user is creating an expression to be used in a header element. The user must then manually set the AggregateOn field to match the group level of the data item using the new expression. This is rather inconvenient. Desirable behavior for the "Select Data Binding" dialog when the user inserts a new expression: * If the dialog is invoked to select a data binding for a Data Item placed in the header or footer of a group G, the new expression's AggregateOn field should be initially set to group G. * If the dialog is invoked to select a data binding for a Data Item placed in the table/list header or footer, the new expression's AggregateOn field should be initially set to "Overall". * In all other cases, the initial AggregateOn should be "None" (as it is today)
UI/org.eclipse.birt.report.designer.core/src/org/eclipse/birt/report/designer/util/DEUtil.java
* @return the level between the holder and the base element, or -1 if the
	 *         element is not a children of the holder
	 */
	public static int getBindingLevel( DesignElementHandle holder,
			DesignElementHandle baseElement )
	{
		int level = 0;
		for ( DesignElementHandle elementHandle = baseElement; elementHandle.getContainer( ) != null; elementHandle = getBindingHolder( elementHandle ).getContainer( ), level++ )
		{
			DesignElementHandle bindingHolder = getBindingHolder( elementHandle );
			if ( bindingHolder == holder )
			{
				return level;
			}
			if ( holder instanceof GroupHandle
					&& bindingHolder == holder.getContainer( ) )
			{
				return level;
			}
		}
		return -1;
	}
	/**
	 * Check if the given element is linked from a library or not.
	 * 
	 * @param handle
	 *            the handle of the element to check
	 * @return true if it is linked from a library ,or false if else;
	 * 
	 */