提交 9aea4f56 编写于 作者: B Benjamin Pasero

fill editor actions into tab context menu

上级 b0f8a303
......@@ -9,6 +9,7 @@ import 'vs/css!./media/tabstitle';
import {TPromise} from 'vs/base/common/winjs.base';
import nls = require('vs/nls');
import {IAction} from 'vs/base/common/actions';
import {prepareActions} from 'vs/workbench/browser/actionBarRegistry';
import arrays = require('vs/base/common/arrays');
import errors = require('vs/base/common/errors');
import DOM = require('vs/base/browser/dom');
......@@ -267,19 +268,30 @@ export class TabsTitleControl extends TitleControl {
}
private getTabActions(editor: IEditorInput, group: IEditorGroup): IAction[] {
const editorActions = this.getEditorActions(group);
// Enablement
this.closeOtherEditorsAction.enabled = group.count > 1;
this.pinEditorAction.enabled = !group.isPinned(editor);
// Actions
return [
const actions:IAction[] = [
this.closeEditorAction,
this.closeOtherEditorsAction,
this.closeAllEditorsAction,
new Separator(),
this.pinEditorAction
this.pinEditorAction,
];
if (editorActions.primary.length) {
actions.push(new Separator(), ...prepareActions(editorActions.primary));
}
if (editorActions.secondary.length) {
actions.push(new Separator(), ...prepareActions(editorActions.secondary));
}
return actions;
}
public dispose(): void {
......
......@@ -200,9 +200,9 @@ export abstract class TitleControl {
return { primary, secondary };
}
protected getEditorActionsForContext(context: BaseEditor): IToolbarActions;
protected getEditorActionsForContext(context: IEditorInputActionContext): IToolbarActions;
protected getEditorActionsForContext(context: any): IToolbarActions {
private getEditorActionsForContext(context: BaseEditor): IToolbarActions;
private getEditorActionsForContext(context: IEditorInputActionContext): IToolbarActions;
private getEditorActionsForContext(context: any): IToolbarActions {
let primaryActions: IAction[] = [];
let secondaryActions: IAction[] = [];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册