mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-09 17:52:34 -05:00
45 lines
1.7 KiB
TypeScript
45 lines
1.7 KiB
TypeScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the Source EULA. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
import * as nls from 'vs/nls';
|
|
import { Action } from 'vs/base/common/actions';
|
|
import { Registry } from 'vs/platform/registry/common/platform';
|
|
import { SyncActionDescriptor, MenuRegistry, MenuId } from 'vs/platform/actions/common/actions';
|
|
import { IWorkbenchActionRegistry, Extensions } from 'vs/workbench/common/actions';
|
|
import { IPartService } from 'vs/workbench/services/part/common/partService';
|
|
|
|
class ToggleCenteredLayout extends Action {
|
|
|
|
static readonly ID = 'workbench.action.toggleCenteredLayout';
|
|
static readonly LABEL = nls.localize('toggleCenteredLayout', "Toggle Centered Layout");
|
|
|
|
constructor(
|
|
id: string,
|
|
label: string,
|
|
@IPartService private partService: IPartService
|
|
) {
|
|
super(id, label);
|
|
this.enabled = !!this.partService;
|
|
}
|
|
|
|
run(): Promise<any> {
|
|
this.partService.centerEditorLayout(!this.partService.isEditorLayoutCentered());
|
|
|
|
return Promise.resolve(null);
|
|
}
|
|
}
|
|
|
|
const registry = Registry.as<IWorkbenchActionRegistry>(Extensions.WorkbenchActions);
|
|
registry.registerWorkbenchAction(new SyncActionDescriptor(ToggleCenteredLayout, ToggleCenteredLayout.ID, ToggleCenteredLayout.LABEL), 'View: Toggle Centered Layout', nls.localize('view', "View"));
|
|
|
|
MenuRegistry.appendMenuItem(MenuId.MenubarAppearanceMenu, {
|
|
group: '1_toggle_view',
|
|
command: {
|
|
id: ToggleCenteredLayout.ID,
|
|
title: nls.localize('miToggleCenteredLayout', "Toggle Centered Layout")
|
|
},
|
|
order: 3
|
|
});
|