UNPKG

2.7 kBJavaScriptView Raw
1"use strict";
2// *****************************************************************************
3// Copyright (C) 2021 Ericsson and others.
4//
5// This program and the accompanying materials are made available under the
6// terms of the Eclipse Public License v. 2.0 which is available at
7// http://www.eclipse.org/legal/epl-2.0.
8//
9// This Source Code may also be made available under the following Secondary
10// Licenses when the conditions for such availability set forth in the Eclipse
11// Public License v. 2.0 are satisfied: GNU General Public License, version 2
12// with the GNU Classpath Exception which is available at
13// https://www.gnu.org/software/classpath/license.html.
14//
15// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
16// *****************************************************************************
17Object.defineProperty(exports, "__esModule", { value: true });
18exports.WindowContribution = exports.WindowCommands = void 0;
19const tslib_1 = require("tslib");
20const inversify_1 = require("inversify");
21const common_1 = require("../common");
22const window_service_1 = require("./window/window-service");
23const common_frontend_contribution_1 = require("../browser/common-frontend-contribution");
24var WindowCommands;
25(function (WindowCommands) {
26 WindowCommands.NEW_WINDOW = common_1.Command.toDefaultLocalizedCommand({
27 id: 'workbench.action.newWindow',
28 label: 'New Window'
29 });
30})(WindowCommands = exports.WindowCommands || (exports.WindowCommands = {}));
31let WindowContribution = class WindowContribution {
32 registerCommands(commands) {
33 commands.registerCommand(WindowCommands.NEW_WINDOW, {
34 execute: () => {
35 this.windowService.openNewDefaultWindow();
36 }
37 });
38 }
39 registerKeybindings(registry) {
40 registry.registerKeybindings({
41 command: WindowCommands.NEW_WINDOW.id,
42 keybinding: this.isElectron() ? 'ctrlcmd+shift+n' : 'alt+shift+n'
43 });
44 }
45 registerMenus(registry) {
46 registry.registerMenuAction(common_frontend_contribution_1.CommonMenus.FILE_NEW_TEXT, {
47 commandId: WindowCommands.NEW_WINDOW.id,
48 order: 'c'
49 });
50 }
51 isElectron() {
52 return common_1.environment.electron.is();
53 }
54};
55(0, tslib_1.__decorate)([
56 (0, inversify_1.inject)(window_service_1.WindowService),
57 (0, tslib_1.__metadata)("design:type", Object)
58], WindowContribution.prototype, "windowService", void 0);
59WindowContribution = (0, tslib_1.__decorate)([
60 (0, inversify_1.injectable)()
61], WindowContribution);
62exports.WindowContribution = WindowContribution;
63//# sourceMappingURL=window-contribution.js.map
\No newline at end of file