<commit_before>/*
 * ! ${copyright}
 */
// Provides control sap.ui.dt.ContextMenu.
/* globals sap */
sap.ui.define([
	'jquery.sap.global',
	'./library',
	'sap/ui/unified/Menu',
	'sap/ui/core/Control',
	'sap/m/Popover',
	'sap/m/VBox',
	'sap/m/HBox',
	'sap/m/Button',
	'sap/m/FlexItemData'
], function (
	jQuery,
	library,
	Menu,
	Control,
	Popover,
	VBox,
	HBox,
	Button,
	FlexItemData
) {
	"use strict";

	/**
	 * Constructor for a new sap.ui.dt.ContextMenu control.
	 *
	 * @param {string} [sId] id for the new control, generated automatically if no id is given
	 * @param {object} [mSettings] initial settings for the new control
	 * @class A simple ContextMenu.
	 * @extends sap.ui.core.Control
	 * @author SAP SE
	 * @version ${version}
	 * @constructor
	 * @private
	 * @experimental
	 * @alias sap.ui.dt.ContextMenu
	 */
	var ContextMenu = Control.extend('sap.ui.dt.ContextMenuControl', {

		metadata: {
			properties: {

				/**
				 * Defines the maximum number of buttons displayed in the non-expanded version of the control.
				 * If more than n buttons are added an overflow button will be displayed instead of the nth button (n = maxButtonsDisplayed).
				 */
				"maxButtonsDisplayed": {
					type: "int",
					defaultValue: 4
				},
				/**
				 * Defines the buttons on the ContextMenu
				 * The objects should have the following properties:
				 * text - for the button text in the expanded version and the tooltip in the non-expanded version
				 * icon - the url of the butons icon
				 * handler - the function to call when the button is pressed
				 */
				"buttons": {
					type: "object[]",
					defaultValue: []
				},
				/**
				 * The Style class which should be added to the ContextMenu
				 */
				styleClass: {
					type: "string"
				}
			},

			events: {
				/**
				 * This event is fired after opening the ContextMenu
				 */
				Opened: {},
				/**
				 * This event is fired after closing the ContextMenu
				 */
				Closed: {},
				/**
				 * This event is fired when the overfow button is pressed
				 */
				OverflowButtonPressed: {}
			}
		},

		/**
		 * initializes the ContextMenu by adding a sap.m.Popover (with a sap.m.Flexbox as a content aggregation) as a Dependent of the ContextMenu
		 */
		init: function () {

			var sPopId = this.getId() + "-popover";

			var oPopover = new Popover(sPopId, {
				showHeader: false,
				verticalScrolling: false,
				horizontalScrolling: false,
				content: new HBox(sPopId + "ContentBox", {
					renderType: "Bare"
				})
			});

			oPopover.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
			oPopover.oPopup.attachClosed(this._popupClosed, this);
			this.addDependent(oPopover);
			oPopover.addStyleClass("sapUiDtContextMenu");

			var sPopExpId = this.getId() + "-popoverExp";

			var oPopoverExpanded = new Popover(sPopExpId, {
				showHeader: false,
				verticalScrolling: false,
				horizontalScrolling: false,
				content: new VBox(sPopExpId + "ContentBox", {
					renderType: "Bare"
				})
			});

			oPopoverExpanded.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
			oPopoverExpanded.oPopup.attachClosed(this._popupClosed, this);<commit_msg>[FIX] sap.ui.dt - contextMenu override popover animationDuration<commit_after>/*
 * ! ${copyright}
 */
// Provides control sap.ui.dt.ContextMenu.
/* globals sap */
sap.ui.define([
	'jquery.sap.global',
	'./library',
	'sap/ui/unified/Menu',
	'sap/ui/core/Control',
	'sap/m/Popover',
	'sap/m/VBox',
	'sap/m/HBox',
	'sap/m/Button',
	'sap/m/FlexItemData'
], function (
	jQuery,
	library,
	Menu,
	Control,
	Popover,
	VBox,
	HBox,
	Button,
	FlexItemData
) {
	"use strict";

	/**
	 * Constructor for a new sap.ui.dt.ContextMenu control.
	 *
	 * @param {string} [sId] id for the new control, generated automatically if no id is given
	 * @param {object} [mSettings] initial settings for the new control
	 * @class A simple ContextMenu.
	 * @extends sap.ui.core.Control
	 * @author SAP SE
	 * @version ${version}
	 * @constructor
	 * @private
	 * @experimental
	 * @alias sap.ui.dt.ContextMenu
	 */
	var ContextMenu = Control.extend('sap.ui.dt.ContextMenuControl', {

		metadata: {
			properties: {

				/**
				 * Defines the maximum number of buttons displayed in the non-expanded version of the control.
				 * If more than n buttons are added an overflow button will be displayed instead of the nth button (n = maxButtonsDisplayed).
				 */
				"maxButtonsDisplayed": {
					type: "int",
					defaultValue: 4
				},
				/**
				 * Defines the buttons on the ContextMenu
				 * The objects should have the following properties:
				 * text - for the button text in the expanded version and the tooltip in the non-expanded version
				 * icon - the url of the butons icon
				 * handler - the function to call when the button is pressed
				 */
				"buttons": {
					type: "object[]",
					defaultValue: []
				},
				/**
				 * The Style class which should be added to the ContextMenu
				 */
				styleClass: {
					type: "string"
				}
			},

			events: {
				/**
				 * This event is fired after opening the ContextMenu
				 */
				Opened: {},
				/**
				 * This event is fired after closing the ContextMenu
				 */
				Closed: {},
				/**
				 * This event is fired when the overfow button is pressed
				 */
				OverflowButtonPressed: {}
			}
		},

		/**
		 * initializes the ContextMenu by adding a sap.m.Popover (with a sap.m.Flexbox as a content aggregation) as a Dependent of the ContextMenu
		 */
		init: function () {

			var sPopId = this.getId() + "-popover";

			// Returns the duration for the Popover's closing animation.
			// It particularily concerns the setting of the focus within the contextMenu
			Popover.prototype._getAnimationDuration = function() {
				return 0;
			};

			var oPopover = new Popover(sPopId, {
				showHeader: false,
				verticalScrolling: false,
				horizontalScrolling: false,
				content: new HBox(sPopId + "ContentBox", {
					renderType: "Bare"
				})
			});

			oPopover.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
			oPopover.oPopup.attachClosed(this._popupClosed, this);
			this.addDependent(oPopover);
			oPopover.addStyleClass("sapUiDtContextMenu");

			var sPopExpId = this.getId() + "-popoverExp";

			var oPopoverExpanded = new Popover(sPopExpId, {
				showHeader: false,
				verticalScrolling: false,
				horizontalScrolling: false,
				content: new VBox(sPopExpId + "ContentBox", {
					renderType: "Bare"
				})
			});

			oPopoverExpanded.attachBrowserEvent("keydown", this._changeFocusOnKeyStroke, this);
			oPopoverExpanded.oPopup.attachClosed(this._popupClosed, this);
{'fraction_non_alphanumeric': 0.11778918755662941, 'fraction_numerical': 0.000453035336756267, 'mean_word_length': 2.9516706443914082, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5038206', 'n_tokens_mistral': 2538, 'n_tokens_neox': 2048, 'n_words': 599}