UNPKG

@eclipse-glsp/client

Version:

A sprotty-based client for GLSP

74 lines 3.69 kB
"use strict"; var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); 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; return c > 3 && r && Object.defineProperty(target, key, r), r; }; var __metadata = (this && this.__metadata) || function (k, v) { if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.KeyboardNodeGrid = void 0; /******************************************************************************** * Copyright (c) 2023 Business Informatics Group (TU Wien) and others. * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v. 2.0 which is available at * http://www.eclipse.org/legal/epl-2.0. * * This Source Code may also be made available under the following Secondary * Licenses when the conditions for such availability set forth in the Eclipse * Public License v. 2.0 are satisfied: GNU General Public License, version 2 * with the GNU Classpath Exception which is available at * https://www.gnu.org/software/classpath/license.html. * * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0 ********************************************************************************/ require("../../../../css/keyboard.css"); const sprotty_1 = require("@eclipse-glsp/sprotty"); const inversify_1 = require("inversify"); const constants_1 = require("../keyboard-pointer/constants"); const keyboard_pointer_1 = require("../keyboard-pointer/keyboard-pointer"); const constants_2 = require("./constants"); const keyboard_grid_1 = require("./keyboard-grid"); const keyboard_grid_search_palette_1 = require("./keyboard-grid-search-palette"); let KeyboardNodeGrid = class KeyboardNodeGrid extends keyboard_grid_1.KeyboardGrid { constructor() { super(...arguments); this.triggerActions = [sprotty_1.SetUIExtensionVisibilityAction.create({ extensionId: constants_1.KeyboardPointerMetadata.ID, visible: true })]; this.originId = constants_1.KeyboardPointerMetadata.ID; } id() { return constants_2.KeyboardNodeGridMetadata.ID; } handle(action) { // Do nothing } onKeyDown(event) { super.onKeyDown(event); this.showSearchOnEvent(event); if (this.keyboardPointer.isVisible) { this.keyboardPointer.getKeyListener.keyDown(event); } } showSearchOnEvent(event) { if ((0, sprotty_1.matchesKeystroke)(event, 'KeyF', 'ctrl')) { event.preventDefault(); this.actionDispatcher.dispatch(sprotty_1.SetUIExtensionVisibilityAction.create({ extensionId: keyboard_grid_search_palette_1.GridSearchPaletteMetadata.ID, visible: true })); this.hide(); } } }; exports.KeyboardNodeGrid = KeyboardNodeGrid; __decorate([ (0, inversify_1.inject)(keyboard_pointer_1.KeyboardPointer), __metadata("design:type", keyboard_pointer_1.KeyboardPointer) ], KeyboardNodeGrid.prototype, "keyboardPointer", void 0); exports.KeyboardNodeGrid = KeyboardNodeGrid = __decorate([ (0, inversify_1.injectable)() ], KeyboardNodeGrid); //# sourceMappingURL=keyboard-node-grid.js.map