@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
83 lines • 4.59 kB
JavaScript
;
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.GLSPDiagramConfiguration = exports.DiagramConfiguration = exports.DiagramContainerFactory = void 0;
/********************************************************************************
* Copyright (c) 2020-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 inversify_1 = require("@theia/core/shared/inversify");
const default_modules_1 = require("./features/default-modules");
const theia_context_menu_service_1 = require("./theia-context-menu-service");
const theia_marker_manager_1 = require("./theia-marker-manager");
exports.DiagramContainerFactory = Symbol('DiagramContainerFactory');
exports.DiagramConfiguration = Symbol('DiagramConfiguration');
/**
* Default {@link DiagramConfiguration} implementation for GLSP diagrams.
* The created diagram container is a child container of the main Theia DI container.
* This means that services that are configured inside of the diagram container also have access (i.e. can inject)
* services from the main Theia DI container.
*
* (bound in Theia main DI container)
*/
let GLSPDiagramConfiguration = class GLSPDiagramConfiguration {
createContainer(options) {
const container = this.diagramContainerFactory();
const diagramOptionsModule = this.createDiagramOptionsModule(options);
this.configureContainer(container, diagramOptionsModule, ...this.getContainerConfiguration());
this.initializeContainer(container);
return container;
}
createDiagramOptionsModule(options) {
return (0, client_1.createDiagramOptionsModule)(options);
}
/**
* Retrieves additional {@link ContainerConfiguration} for the diagram container.
* Typically this composes a set of theia specific customization modules.
* @returns the container configuration
*/
getContainerConfiguration() {
return [default_modules_1.THEIA_DEFAULT_MODULE_CONFIG];
}
initializeContainer(container) {
(0, theia_context_menu_service_1.connectTheiaContextMenuService)(container, this.contextMenuServiceFactory);
(0, theia_marker_manager_1.connectTheiaMarkerManager)(container, this.theiaMarkerManager, this.diagramType);
}
};
exports.GLSPDiagramConfiguration = GLSPDiagramConfiguration;
__decorate([
(0, inversify_1.inject)(theia_context_menu_service_1.TheiaContextMenuServiceFactory),
__metadata("design:type", Function)
], GLSPDiagramConfiguration.prototype, "contextMenuServiceFactory", void 0);
__decorate([
(0, inversify_1.inject)(theia_marker_manager_1.TheiaMarkerManagerFactory),
__metadata("design:type", Function)
], GLSPDiagramConfiguration.prototype, "theiaMarkerManager", void 0);
__decorate([
(0, inversify_1.inject)(exports.DiagramContainerFactory),
__metadata("design:type", Function)
], GLSPDiagramConfiguration.prototype, "diagramContainerFactory", void 0);
exports.GLSPDiagramConfiguration = GLSPDiagramConfiguration = __decorate([
(0, inversify_1.injectable)()
], GLSPDiagramConfiguration);
//# sourceMappingURL=glsp-diagram-configuration.js.map