提交 51f0436d 编写于 作者: J Johannes Rieken

rename editor/primary to editor/title, remove editor/secondary

上级 1aa20274
......@@ -70,7 +70,7 @@
}
],
"menus": {
"editor/primary": [
"editor/title": [
{
"when": "resourceLangId == markdown",
"command": "markdown.showPreview",
......
......@@ -28,16 +28,14 @@ export interface MenuItem {
when?: KbExpr;
}
export enum MenuLocation {
EditorPrimary = 1,
EditorSecondary = 2
export enum Menus {
EditorTitle = 1,
}
export namespace MenuLocation {
export function parse(value: string): MenuLocation {
export namespace Menus {
export function parse(value: string): Menus {
switch (value) {
case 'editor/primary': return MenuLocation.EditorPrimary;
case 'editor/secondary': return MenuLocation.EditorSecondary;
case 'editor/title': return Menus.EditorTitle;
}
}
}
......@@ -48,7 +46,7 @@ export interface IMenuService {
serviceId: any;
getMenuItems(loc: MenuLocation): MenuItem[];
getMenuItems(loc: Menus): MenuItem[];
getCommandActions(): CommandAction[];
}
......
......@@ -61,7 +61,7 @@ namespace schema {
description: localize('vscode.extension.contributes.menus', "Contributes menu items to predefined locations"),
type: 'object',
properties: {
'editor/primary': {
'editor/title': {
type: 'array',
items: menuItem
}
......
......@@ -7,9 +7,9 @@
import {values} from 'vs/base/common/collections';
import {KbExpr} from 'vs/platform/keybinding/common/keybindingService';
import {MenuLocation, CommandAction, MenuItem, IMenuService} from './actions';
import {Menus, CommandAction, MenuItem, IMenuService} from './actions';
export type IUserFriendlyMenuLocation = 'editor/primary' | 'editor/secondary';
export type IUserFriendlyMenuLocation = 'editor/title';
export interface IUserFriendlyMenuItem {
command: string;
......@@ -53,7 +53,7 @@ const _registry = new class {
}
registerMenuItems(location: IUserFriendlyMenuLocation, items: IUserFriendlyMenuItem[]): boolean {
const loc = MenuLocation.parse(location);
const loc = Menus.parse(location);
if (loc) {
let array = this._menuItems[loc];
if (!array) {
......@@ -65,7 +65,7 @@ const _registry = new class {
}
}
getMenuItems(loc: MenuLocation): MenuItem[] {
getMenuItems(loc: Menus): MenuItem[] {
const menuItems = this._menuItems[loc];
if (menuItems) {
return menuItems.map(item => {
......@@ -88,7 +88,7 @@ export class MenuService implements IMenuService {
serviceId;
getMenuItems(loc: MenuLocation): MenuItem[] {
getMenuItems(loc: Menus): MenuItem[] {
return _registry.getMenuItems(loc);
}
......
......@@ -12,7 +12,7 @@ import Event, {Emitter} from 'vs/base/common/event';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingService';
import {IExtensionService} from 'vs/platform/extensions/common/extensions';
import {MenuLocation, MenuItem, IMenuService} from 'vs/platform/actions/common/actions';
import {Menus, MenuItem, IMenuService} from 'vs/platform/actions/common/actions';
import {ResourceContextKey} from 'vs/platform/actions/common/resourceContextKey';
import {Action, IAction} from 'vs/base/common/actions';
import {BaseActionItem, ActionItem} from 'vs/base/browser/ui/actionbar/actionbar';
......@@ -29,7 +29,7 @@ export class ActionBarContributor {
constructor(
scope: HTMLElement,
location: MenuLocation,
location: Menus,
@IMenuService private _menuService: IMenuService,
@IKeybindingService private _keybindingService: IKeybindingService,
@IExtensionService private _extensionService: IExtensionService,
......
......@@ -32,7 +32,7 @@ import {IKeybindingService} from 'vs/platform/keybinding/common/keybindingServic
import {CloseEditorsInGroupAction, MoveGroupLeftAction, MoveGroupRightAction, SplitEditorAction, CloseEditorAction, KeepEditorAction, CloseOtherEditorsInGroupAction, CloseRightEditorsInGroupAction, ShowEditorsInGroupAction} from 'vs/workbench/browser/parts/editor/editorActions';
import {IDisposable, dispose} from 'vs/base/common/lifecycle';
import {ActionBarContributor} from 'vs/platform/actions/workbench/actionBarContributor';
import {MenuLocation} from 'vs/platform/actions/common/actions';
import {Menus} from 'vs/platform/actions/common/actions';
import {ResourceContextKey} from 'vs/platform/actions/common/resourceContextKey';
export interface IToolbarActions {
......@@ -177,7 +177,7 @@ export abstract class TitleControl implements ITitleAreaControl {
}
public create(parent: HTMLElement): void {
this.titleActionBarContributor = this.instantiationService.createInstance(ActionBarContributor, parent, MenuLocation.EditorPrimary);
this.titleActionBarContributor = this.instantiationService.createInstance(ActionBarContributor, parent, Menus.EditorTitle);
this.toDispose.push(this.titleActionBarContributor.onDidUpdate(e => this.refresh()));
this.toDispose.push(this.titleActionBarContributor);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册