@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
378 lines • 25.1 kB
JavaScript
"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);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GLSPLayoutKeybindingContribution = exports.GLSPLayoutCommandContribution = exports.GLSPLayoutMenuContribution = exports.GLSPLayoutMenus = exports.GLSPLayoutCommands = void 0;
exports.registerDiagramLayoutCommands = registerDiagramLayoutCommands;
/********************************************************************************
* Copyright (c) 2019-2023 EclipseSource 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
********************************************************************************/
const client_1 = require("@eclipse-glsp/client");
const core_1 = require("@theia/core");
const browser_1 = require("@theia/core/lib/browser");
const inversify_1 = require("@theia/core/shared/inversify");
const glsp_command_handler_1 = require("./glsp-command-handler");
const glsp_diagram_commands_1 = require("./glsp-diagram-commands");
const glsp_diagram_keybinding_1 = require("./glsp-diagram-keybinding");
function registerDiagramLayoutCommands(context) {
if (!context.isBound(GLSPLayoutCommandContribution)) {
(0, client_1.bindAsService)(context, core_1.CommandContribution, GLSPLayoutCommandContribution);
}
if (!context.isBound(GLSPLayoutMenuContribution)) {
(0, client_1.bindAsService)(context, core_1.MenuContribution, GLSPLayoutMenuContribution);
}
if (!context.isBound(GLSPLayoutKeybindingContribution)) {
(0, client_1.bindAsService)(context, browser_1.KeybindingContribution, GLSPLayoutKeybindingContribution);
}
}
var GLSPLayoutCommands;
(function (GLSPLayoutCommands) {
GLSPLayoutCommands.RESIZE_WIDTH_MIN = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width:min';
GLSPLayoutCommands.RESIZE_WIDTH_MIN_LABEL = 'Minimal Width';
GLSPLayoutCommands.RESIZE_WIDTH_MAX = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width:max';
GLSPLayoutCommands.RESIZE_WIDTH_MAX_LABEL = 'Maximal Width';
GLSPLayoutCommands.RESIZE_WIDTH_AVG = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width:avg';
GLSPLayoutCommands.RESIZE_WIDTH_AVG_LABEL = 'Average Width';
GLSPLayoutCommands.RESIZE_WIDTH_FIRST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width:first';
GLSPLayoutCommands.RESIZE_WIDTH_FIRST_LABEL = 'Width of First Selected Element';
GLSPLayoutCommands.RESIZE_WIDTH_LAST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width:last';
GLSPLayoutCommands.RESIZE_WIDTH_LAST_LABEL = 'Width of Last Selected Element';
GLSPLayoutCommands.RESIZE_HEIGHT_MIN = 'glsp:' + client_1.ResizeElementsAction.KIND + ':height:min';
GLSPLayoutCommands.RESIZE_HEIGHT_MIN_LABEL = 'Minimal Height';
GLSPLayoutCommands.RESIZE_HEIGHT_MAX = 'glsp:' + client_1.ResizeElementsAction.KIND + ':height:max';
GLSPLayoutCommands.RESIZE_HEIGHT_MAX_LABEL = 'Maximal Height';
GLSPLayoutCommands.RESIZE_HEIGHT_AVG = 'glsp:' + client_1.ResizeElementsAction.KIND + ':height:avg';
GLSPLayoutCommands.RESIZE_HEIGHT_AVG_LABEL = 'Average Height';
GLSPLayoutCommands.RESIZE_HEIGHT_FIRST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':height:first';
GLSPLayoutCommands.RESIZE_HEIGHT_FIRST_LABEL = 'Height of First Selected Element';
GLSPLayoutCommands.RESIZE_HEIGHT_LAST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':height:last';
GLSPLayoutCommands.RESIZE_HEIGHT_LAST_LABEL = 'Height of Last Selected Element';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MIN = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width_and_height:min';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MIN_LBL = 'Minimal Width and Height';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MAX = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width_and_height:max';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MAX_LBL = 'Maximal Width and Height';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_AVG = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width_and_height:avg';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_AVG_LBL = 'Average Width and Height';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_FIRST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width_and_height:first';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_FIRST_LBL = 'Width and Height of First Selected Element';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_LAST = 'glsp:' + client_1.ResizeElementsAction.KIND + ':width_and_height:last';
GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_LAST_LBL = 'Width and Height of Last Selected Element';
GLSPLayoutCommands.ALIGN_LEFT = 'glsp:' + client_1.AlignElementsAction.KIND + ':left';
GLSPLayoutCommands.ALIGN_LEFT_LABEL = 'Left';
GLSPLayoutCommands.ALIGN_CENTER = 'glsp:' + client_1.AlignElementsAction.KIND + ':center';
GLSPLayoutCommands.ALIGN_CENTER_LABEL = 'Center';
GLSPLayoutCommands.ALIGN_RIGHT = 'glsp:' + client_1.AlignElementsAction.KIND + ':right';
GLSPLayoutCommands.ALIGN_RIGHT_LABEL = 'Right';
GLSPLayoutCommands.ALIGN_TOP = 'glsp:' + client_1.AlignElementsAction.KIND + ':top';
GLSPLayoutCommands.ALIGN_TOP_LABEL = 'Top';
GLSPLayoutCommands.ALIGN_MIDDLE = 'glsp:' + client_1.AlignElementsAction.KIND + ':middle';
GLSPLayoutCommands.ALIGN_MIDDLE_LABEL = 'Middle';
GLSPLayoutCommands.ALIGN_BOTTOM = 'glsp:' + client_1.AlignElementsAction.KIND + ':bottom';
GLSPLayoutCommands.ALIGN_BOTTOM_LABEL = 'Bottom';
GLSPLayoutCommands.ALIGN_LEFT_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':left:first';
GLSPLayoutCommands.ALIGN_LEFT_FIRST_LABEL = 'Left of First Selected Element';
GLSPLayoutCommands.ALIGN_CENTER_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':center:first';
GLSPLayoutCommands.ALIGN_CENTER_FIRST_LABEL = 'Center of First Selected Element';
GLSPLayoutCommands.ALIGN_RIGHT_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':right:first';
GLSPLayoutCommands.ALIGN_RIGHT_FIRST_LABEL = 'Right of First Selected Element';
GLSPLayoutCommands.ALIGN_TOP_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':top:first';
GLSPLayoutCommands.ALIGN_TOP_FIRST_LABEL = 'Top of First Selected Element';
GLSPLayoutCommands.ALIGN_MIDDLE_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':middle:first';
GLSPLayoutCommands.ALIGN_MIDDLE_FIRST_LABEL = 'Middle of First Selected Element';
GLSPLayoutCommands.ALIGN_BOTTOM_FIRST = 'glsp:' + client_1.AlignElementsAction.KIND + ':bottom:first';
GLSPLayoutCommands.ALIGN_BOTTOM_FIRST_LABEL = 'Bottom of First Selected Element';
GLSPLayoutCommands.ALIGN_LEFT_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':left:last';
GLSPLayoutCommands.ALIGN_LEFT_LAST_LABEL = 'Left of Last Selected Element';
GLSPLayoutCommands.ALIGN_CENTER_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':center:last';
GLSPLayoutCommands.ALIGN_CENTER_LAST_LABEL = 'Center of Last Selected Element';
GLSPLayoutCommands.ALIGN_RIGHT_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':right:last';
GLSPLayoutCommands.ALIGN_RIGHT_LAST_LABEL = 'Right of Last Selected Element';
GLSPLayoutCommands.ALIGN_TOP_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':top:last';
GLSPLayoutCommands.ALIGN_TOP_LAST_LABEL = 'Top of Last Selected Element';
GLSPLayoutCommands.ALIGN_MIDDLE_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':middle:last';
GLSPLayoutCommands.ALIGN_MIDDLE_LAST_LABEL = 'Middle of Last Selected Element';
GLSPLayoutCommands.ALIGN_BOTTOM_LAST = 'glsp:' + client_1.AlignElementsAction.KIND + ':bottom:last';
GLSPLayoutCommands.ALIGN_BOTTOM_LAST_LABEL = 'Bottom of Last Selected Element';
})(GLSPLayoutCommands || (exports.GLSPLayoutCommands = GLSPLayoutCommands = {}));
var GLSPLayoutMenus;
(function (GLSPLayoutMenus) {
GLSPLayoutMenus.ALIGN_MENU = glsp_diagram_commands_1.GLSPDiagramMenus.DIAGRAM.concat('align');
GLSPLayoutMenus.ALIGN_HORIZONTAL_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('1_horizontal');
GLSPLayoutMenus.ALIGN_VERTICAL_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('2_vertical');
GLSPLayoutMenus.ALIGN_HORIZONTAL_FIRST_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('3_horizontal_first');
GLSPLayoutMenus.ALIGN_VERTICAL_FIRST_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('4_vertical_first');
GLSPLayoutMenus.ALIGN_HORIZONTAL_LAST_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('5_horizontal_last');
GLSPLayoutMenus.ALIGN_VERTICAL_LAST_GROUP = GLSPLayoutMenus.ALIGN_MENU.concat('6_vertical_last');
GLSPLayoutMenus.RESIZE_MENU = glsp_diagram_commands_1.GLSPDiagramMenus.DIAGRAM.concat('resize');
GLSPLayoutMenus.RESIZE_WIDTH_GROUP = GLSPLayoutMenus.RESIZE_MENU.concat('1_width');
GLSPLayoutMenus.RESIZE_HEIGHT_GROUP = GLSPLayoutMenus.RESIZE_MENU.concat('2_height');
GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP = GLSPLayoutMenus.RESIZE_MENU.concat('3_width_and_height');
})(GLSPLayoutMenus || (exports.GLSPLayoutMenus = GLSPLayoutMenus = {}));
let GLSPLayoutMenuContribution = class GLSPLayoutMenuContribution {
registerMenus(registry) {
registry.registerSubmenu(GLSPLayoutMenus.RESIZE_MENU, 'Resize');
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_MIN,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_MAX,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AVG,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_FIRST,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_LAST,
order: '5'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_HEIGHT_MIN,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_HEIGHT_MAX,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_HEIGHT_AVG,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_HEIGHT_FIRST,
order: '5'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_HEIGHT_LAST,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MIN,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MAX,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_AVG,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_FIRST,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.RESIZE_WIDTH_AND_HEIGHT_GROUP, {
commandId: GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_LAST,
order: '5'
});
registry.registerSubmenu(GLSPLayoutMenus.ALIGN_MENU, 'Align');
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_LEFT,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_CENTER,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_RIGHT,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_TOP,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_MIDDLE,
order: '5'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_BOTTOM,
order: '6'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_LEFT_FIRST,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_CENTER_FIRST,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_RIGHT_FIRST,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_TOP_FIRST,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_MIDDLE_FIRST,
order: '5'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_FIRST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_BOTTOM_FIRST,
order: '6'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_LEFT_LAST,
order: '1'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_CENTER_LAST,
order: '2'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_HORIZONTAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_RIGHT_LAST,
order: '3'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_TOP_LAST,
order: '4'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_MIDDLE_LAST,
order: '5'
});
registry.registerMenuAction(GLSPLayoutMenus.ALIGN_VERTICAL_LAST_GROUP, {
commandId: GLSPLayoutCommands.ALIGN_BOTTOM_LAST,
order: '6'
});
}
};
exports.GLSPLayoutMenuContribution = GLSPLayoutMenuContribution;
exports.GLSPLayoutMenuContribution = GLSPLayoutMenuContribution = __decorate([
(0, inversify_1.injectable)()
], GLSPLayoutMenuContribution);
let GLSPLayoutCommandContribution = class GLSPLayoutCommandContribution {
constructor(shell) {
this.shell = shell;
}
registerResize(registry, id, label, dimension, reduceFunction) {
registry.registerCommand({
id: id,
category: 'Diagram',
label: 'Resize to ' + label
}, new glsp_command_handler_1.GLSPCommandHandler(this.shell, {
actions: () => [client_1.ResizeElementsAction.create({ dimension, reduceFunction })],
isEnabled: context => !context.isReadonly && context.get().selectedElementIds.length > 1
}));
}
registerAlign(registry, id, label, alignment, selectionFunction) {
registry.registerCommand({
id: id,
category: 'Diagram',
label: 'Align ' + label
}, new glsp_command_handler_1.GLSPCommandHandler(this.shell, {
actions: () => [client_1.AlignElementsAction.create({ alignment, selectionFunction })],
isEnabled: context => !context.isReadonly && context.get().selectedElementIds.length > 1
}));
}
registerCommands(reg) {
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_MIN, GLSPLayoutCommands.RESIZE_WIDTH_MIN_LABEL, client_1.ResizeDimension.Width, 'min');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_MAX, GLSPLayoutCommands.RESIZE_WIDTH_MAX_LABEL, client_1.ResizeDimension.Width, 'max');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AVG, GLSPLayoutCommands.RESIZE_WIDTH_AVG_LABEL, client_1.ResizeDimension.Width, 'avg');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_FIRST, GLSPLayoutCommands.RESIZE_WIDTH_FIRST_LABEL, client_1.ResizeDimension.Width, 'first');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_LAST, GLSPLayoutCommands.RESIZE_WIDTH_LAST_LABEL, client_1.ResizeDimension.Width, 'last');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_HEIGHT_MIN, GLSPLayoutCommands.RESIZE_HEIGHT_MIN_LABEL, client_1.ResizeDimension.Height, 'min');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_HEIGHT_MAX, GLSPLayoutCommands.RESIZE_HEIGHT_MAX_LABEL, client_1.ResizeDimension.Height, 'max');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_HEIGHT_AVG, GLSPLayoutCommands.RESIZE_HEIGHT_AVG_LABEL, client_1.ResizeDimension.Height, 'avg');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_HEIGHT_FIRST, GLSPLayoutCommands.RESIZE_HEIGHT_FIRST_LABEL, client_1.ResizeDimension.Height, 'first');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_HEIGHT_LAST, GLSPLayoutCommands.RESIZE_HEIGHT_LAST_LABEL, client_1.ResizeDimension.Height, 'last');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MIN, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MIN_LBL, client_1.ResizeDimension.Width_And_Height, 'min');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MAX, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_MAX_LBL, client_1.ResizeDimension.Width_And_Height, 'max');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_AVG, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_AVG_LBL, client_1.ResizeDimension.Width_And_Height, 'avg');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_FIRST, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_FIRST_LBL, client_1.ResizeDimension.Width_And_Height, 'first');
this.registerResize(reg, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_LAST, GLSPLayoutCommands.RESIZE_WIDTH_AND_HEIGHT_LAST_LBL, client_1.ResizeDimension.Width_And_Height, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_LEFT, GLSPLayoutCommands.ALIGN_LEFT_LABEL, client_1.Alignment.Left, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_CENTER, GLSPLayoutCommands.ALIGN_CENTER_LABEL, client_1.Alignment.Center, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_RIGHT, GLSPLayoutCommands.ALIGN_RIGHT_LABEL, client_1.Alignment.Right, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_TOP, GLSPLayoutCommands.ALIGN_TOP_LABEL, client_1.Alignment.Top, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_MIDDLE, GLSPLayoutCommands.ALIGN_MIDDLE_LABEL, client_1.Alignment.Middle, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_BOTTOM, GLSPLayoutCommands.ALIGN_BOTTOM_LABEL, client_1.Alignment.Bottom, 'all');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_LEFT_FIRST, GLSPLayoutCommands.ALIGN_LEFT_FIRST_LABEL, client_1.Alignment.Left, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_CENTER_FIRST, GLSPLayoutCommands.ALIGN_CENTER_FIRST_LABEL, client_1.Alignment.Center, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_RIGHT_FIRST, GLSPLayoutCommands.ALIGN_RIGHT_FIRST_LABEL, client_1.Alignment.Right, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_TOP_FIRST, GLSPLayoutCommands.ALIGN_TOP_FIRST_LABEL, client_1.Alignment.Top, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_MIDDLE_FIRST, GLSPLayoutCommands.ALIGN_MIDDLE_FIRST_LABEL, client_1.Alignment.Middle, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_BOTTOM_FIRST, GLSPLayoutCommands.ALIGN_BOTTOM_FIRST_LABEL, client_1.Alignment.Bottom, 'first');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_LEFT_LAST, GLSPLayoutCommands.ALIGN_LEFT_LAST_LABEL, client_1.Alignment.Left, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_CENTER_LAST, GLSPLayoutCommands.ALIGN_CENTER_LAST_LABEL, client_1.Alignment.Center, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_RIGHT_LAST, GLSPLayoutCommands.ALIGN_RIGHT_LAST_LABEL, client_1.Alignment.Right, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_TOP_LAST, GLSPLayoutCommands.ALIGN_TOP_LAST_LABEL, client_1.Alignment.Top, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_MIDDLE_LAST, GLSPLayoutCommands.ALIGN_MIDDLE_LAST_LABEL, client_1.Alignment.Middle, 'last');
this.registerAlign(reg, GLSPLayoutCommands.ALIGN_BOTTOM_LAST, GLSPLayoutCommands.ALIGN_BOTTOM_LAST_LABEL, client_1.Alignment.Bottom, 'last');
}
};
exports.GLSPLayoutCommandContribution = GLSPLayoutCommandContribution;
exports.GLSPLayoutCommandContribution = GLSPLayoutCommandContribution = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(browser_1.ApplicationShell)),
__metadata("design:paramtypes", [browser_1.ApplicationShell])
], GLSPLayoutCommandContribution);
let GLSPLayoutKeybindingContribution = class GLSPLayoutKeybindingContribution {
constructor(diagramKeybindingContext) {
this.diagramKeybindingContext = diagramKeybindingContext;
}
registerKeybindings(registry) {
registry.registerKeybinding({
command: GLSPLayoutCommands.ALIGN_LEFT,
context: this.diagramKeybindingContext.id,
keybinding: 'alt+shift+left',
when: '!glspEditorIsReadonly && glspEditorHasMultipleSelection'
});
registry.registerKeybinding({
command: GLSPLayoutCommands.ALIGN_RIGHT,
context: this.diagramKeybindingContext.id,
keybinding: 'alt+shift+right',
when: '!glspEditorIsReadonly && glspEditorHasMultipleSelection'
});
registry.registerKeybinding({
command: GLSPLayoutCommands.ALIGN_TOP,
context: this.diagramKeybindingContext.id,
keybinding: 'alt+shift+up',
when: '!glspEditorIsReadonly && glspEditorHasMultipleSelection'
});
registry.registerKeybinding({
command: GLSPLayoutCommands.ALIGN_BOTTOM,
context: this.diagramKeybindingContext.id,
keybinding: 'alt+shift+down',
when: '!glspEditorIsReadonly && glspEditorHasMultipleSelection'
});
}
};
exports.GLSPLayoutKeybindingContribution = GLSPLayoutKeybindingContribution;
exports.GLSPLayoutKeybindingContribution = GLSPLayoutKeybindingContribution = __decorate([
(0, inversify_1.injectable)(),
__param(0, (0, inversify_1.inject)(glsp_diagram_keybinding_1.GLSPDiagramKeybindingContext)),
__metadata("design:paramtypes", [glsp_diagram_keybinding_1.GLSPDiagramKeybindingContext])
], GLSPLayoutKeybindingContribution);
//# sourceMappingURL=glsp-layout-commands.js.map