UNPKG

3.37 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 WITH Classpath-exception-2.0
16// *****************************************************************************
17var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
18 var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
19 if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
20 else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
21 return c > 3 && r && Object.defineProperty(target, key, r), r;
22};
23var __metadata = (this && this.__metadata) || function (k, v) {
24 if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
25};
26Object.defineProperty(exports, "__esModule", { value: true });
27exports.WindowContribution = exports.WindowCommands = void 0;
28const inversify_1 = require("inversify");
29const common_1 = require("../common");
30const window_service_1 = require("./window/window-service");
31const common_frontend_contribution_1 = require("../browser/common-frontend-contribution");
32var WindowCommands;
33(function (WindowCommands) {
34 WindowCommands.NEW_WINDOW = common_1.Command.toDefaultLocalizedCommand({
35 id: 'workbench.action.newWindow',
36 label: 'New Window'
37 });
38})(WindowCommands = exports.WindowCommands || (exports.WindowCommands = {}));
39let WindowContribution = class WindowContribution {
40 registerCommands(commands) {
41 commands.registerCommand(WindowCommands.NEW_WINDOW, {
42 execute: () => {
43 this.windowService.openNewDefaultWindow();
44 }
45 });
46 }
47 registerKeybindings(registry) {
48 registry.registerKeybindings({
49 command: WindowCommands.NEW_WINDOW.id,
50 keybinding: this.isElectron() ? 'ctrlcmd+shift+n' : 'alt+shift+n'
51 });
52 }
53 registerMenus(registry) {
54 registry.registerMenuAction(common_frontend_contribution_1.CommonMenus.FILE_NEW, {
55 commandId: WindowCommands.NEW_WINDOW.id,
56 order: 'c'
57 });
58 }
59 isElectron() {
60 return common_1.environment.electron.is();
61 }
62};
63__decorate([
64 (0, inversify_1.inject)(window_service_1.WindowService),
65 __metadata("design:type", Object)
66], WindowContribution.prototype, "windowService", void 0);
67WindowContribution = __decorate([
68 (0, inversify_1.injectable)()
69], WindowContribution);
70exports.WindowContribution = WindowContribution;
71//# sourceMappingURL=window-contribution.js.map
\No newline at end of file