<commit_before>enyo.kind({
	name: "DocumentToolbar",
	kind: "onyx.Toolbar",

	// TODO check if still needed
	classes: "ares-docbar-container",

	events: {
		onToggleOpen: "",
		onSwitchFile: "",
		onCloseFileRequest: ""
	},

	components: [
		{kind: "onyx.Grabber", ontap: "doToggleOpen"},
		{
			name: "tabs",
			kind: "onyx.TabBar",
			onTabChanged: 'switchFile',
			onTabRemove: 'closeFile'
		}
	],

	createFileTab: function(name, id) {
		var c = this.$.tabs.addTab(
			{
				caption: name,
				userId: id // id like home-123f3c8a766751826...
			}
		);
	},
	switchFile: function(inSender, inEvent) {
		this.doSwitchFile({id: inEvent.userId});
		return true;
	},
	activateFileWithId: function(id) {
		this.$.tabs.activate({ userId: id });
	},
	closeFile: function(inSender, inEvent) {
		var id = inSender.fileId;
		this.doClose({id: id});
		return true;
	},
	removeTab: function(id) {
		this.$.tabs.removeTab({ userId: id }) ;
	}
});<commit_msg>ENYO-2266: ask Phobos before closing a tab<commit_after>enyo.kind({
	name: "DocumentToolbar",
	kind: "onyx.Toolbar",

	// TODO check if still needed
	classes: "ares-docbar-container",

	events: {
		onToggleOpen: "",
		onSwitchFile: "",
		onCloseFileRequest: ""
	},

	components: [
		{kind: "onyx.Grabber", ontap: "doToggleOpen"},
		{
			name: "tabs",
			kind: "onyx.TabBar",
			checkBeforeClosing: true,
			onTabChanged: 'switchFile',
			onTabRemoveRequested: 'requestCloseFile'
		}
	],

	createFileTab: function(name, id) {
		var c = this.$.tabs.addTab(
			{
				caption: name,
				userId: id // id like home-123f3c8a766751826...
			}
		);
	},
	switchFile: function(inSender, inEvent) {
		this.doSwitchFile({id: inEvent.userId});
		return true;
	},
	activateFileWithId: function(id) {
		this.$.tabs.activate({ userId: id });
	},

	requestCloseFile: function(inSender, inEvent) {
		// inEvent.next callback is ditched. Ares will call removeTab
		// when file is closed by Ace
		this.doCloseFileRequest({id: inEvent.userId});
		return true;
	},
	removeTab: function(id) {
		this.$.tabs.removeTab({ userId: id }) ;
	}
});
{'fraction_non_alphanumeric': 0.16368038740920096, 'fraction_numerical': 0.01549636803874092, 'mean_word_length': 3.6954545454545453, 'pattern_counts': {'":': 0, '<': 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': '1530104', 'n_tokens_mistral': 860, 'n_tokens_neox': 779, 'n_words': 157}