@eclipse-glsp/theia-integration
Version:
Glue code to integrate GLSP clients into Eclipse Theia
67 lines • 4.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/********************************************************************************
* Copyright (c) 2019-2024 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 service_connection_provider_1 = require("@theia/core/lib/browser/messaging/service-connection-provider");
const inversify_1 = require("@theia/core/shared/inversify");
const common_1 = require("../common");
const diagram_service_provider_1 = require("./diagram-service-provider");
const diagram_widget_factory_1 = require("./diagram/diagram-widget-factory");
const glsp_diagram_commands_1 = require("./diagram/glsp-diagram-commands");
const glsp_diagram_configuration_1 = require("./diagram/glsp-diagram-configuration");
const glsp_diagram_context_key_service_1 = require("./diagram/glsp-diagram-context-key-service");
const glsp_diagram_keybinding_1 = require("./diagram/glsp-diagram-keybinding");
const theia_context_menu_service_1 = require("./diagram/theia-context-menu-service");
const theia_marker_manager_1 = require("./diagram/theia-marker-manager");
const glsp_client_contribution_1 = require("./glsp-client-contribution");
const glsp_frontend_contribution_1 = require("./glsp-frontend-contribution");
const theia_glsp_context_menu_service_1 = require("./theia-glsp-context-menu-service");
const theia_opener_options_navigation_service_1 = require("./theia-opener-options-navigation-service");
exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
const context = { bind, unbind, isBound, rebind };
// GLSP Contribution API
(0, core_1.bindContributionProvider)(bind, glsp_client_contribution_1.GLSPClientContribution);
(0, client_1.bindAsService)(context, browser_1.FrontendApplicationContribution, glsp_frontend_contribution_1.GLSPFrontendContribution);
bind(diagram_service_provider_1.DiagramServiceProvider).toSelf().inSingletonScope();
bind(common_1.GLSPContribution.Service)
.toDynamicValue(({ container }) => service_connection_provider_1.ServiceConnectionProvider.createProxy(container, common_1.GLSPContribution.servicePath))
.inSingletonScope();
// Diagram Command API
(0, client_1.bindAsService)(context, core_1.CommandContribution, glsp_diagram_commands_1.GLSPDiagramCommandContribution);
(0, client_1.bindAsService)(context, core_1.MenuContribution, glsp_diagram_commands_1.GLSPDiagramMenuContribution);
(0, client_1.bindAsService)(context, browser_1.KeybindingContext, glsp_diagram_keybinding_1.GLSPDiagramKeybindingContext);
(0, client_1.bindAsService)(context, browser_1.KeybindingContribution, glsp_diagram_keybinding_1.GLSPDiagramKeybindingContribution);
// Misc
(0, core_1.bindContributionProvider)(bind, diagram_widget_factory_1.DiagramWidgetFactory);
(0, core_1.bindContributionProvider)(bind, glsp_diagram_configuration_1.DiagramConfiguration);
bind(glsp_diagram_configuration_1.DiagramContainerFactory).toFactory(ctx => () => ctx.container.createChild());
bind(glsp_diagram_context_key_service_1.GLSPDiagramContextKeyService).toSelf().inSingletonScope();
bind(theia_opener_options_navigation_service_1.TheiaOpenerOptionsNavigationService).toSelf().inSingletonScope();
bind(theia_context_menu_service_1.TheiaContextMenuServiceFactory).toFactory(ctx => () => {
const container = ctx.container.createChild();
container.bind(theia_glsp_context_menu_service_1.TheiaContextMenuService).toSelf().inSingletonScope();
return container.get(theia_glsp_context_menu_service_1.TheiaContextMenuService);
});
bind(theia_marker_manager_1.TheiaMarkerManagerFactory).toFactory(ctx => () => {
const container = ctx.container.createChild();
container.bind(theia_marker_manager_1.TheiaMarkerManager).toSelf().inSingletonScope();
return container.get(theia_marker_manager_1.TheiaMarkerManager);
});
});
//# sourceMappingURL=theia-integration-frontend-module.js.map