<core:FragmentDefinition xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
	xmlns:core="sap.ui.core"
	xmlns="sap.m"
	xmlns:mdc="sap.ui.mdc"
	template:require="{
			CORE: 'sap/fe/core/AnnotationHelper',
			MODEL: 'sap/ui/model/odata/v4/AnnotationHelper'
	}">

		<!-- TODO: get rid of contexts manager logic here we shall be able to check the instance annotations -->

		<template:with path="dataField>Action" helper="CORE.getActionContext" var="actionContext">
		<template:with path="dataField>Action" helper="CORE.getPathToBoundActionOverload" var="isBound">
			<template:if test="{= ${this>onCallAction} &amp;&amp; !(${dataField>./@com.sap.vocabularies.UI.v1.Hidden} === true) &amp;&amp; (${isBound>$IsBound} !== true || ${actionContext>@Org.OData.Core.V1.OperationAvailable} !== false) }">
				<Button
						class="{this>class}"
						text="{dataField>Label}"
						press="{= ${this>onCallAction} + '(\'' + ${dataField>Action} + '\',
													{ contexts: ${$source>/}.getBindingContext(),
													invocationGrouping : \'' + (${dataField>InvocationGrouping/$EnumMember} === 'com.sap.vocabularies.UI.v1.OperationGroupingType/ChangeSet' ? 'ChangeSet' : 'Isolated') + '\',
													label: \'' + ${dataField>Label} + '\'})'}"
						enabled="{= ${isBound>$IsBound} !== true
													? 'true'
													: ${actionContext>@Org.OData.Core.V1.OperationAvailable} === null
														? '{= !${#' + ${dataField>Action} + '} ? false : true }'
														: ${actionContext>@Org.OData.Core.V1.OperationAvailable/$Path}
															? '{= $' + ${actionContext>@Org.OData.Core.V1.OperationAvailable@@MODEL.format} + '}'
															: 'true' }"
				/>
		</template:if>
		</template:with>
		</template:with>

</core:FragmentDefinition>
