This repository has been archived by the owner on Jan 15, 2020. It is now read-only.
/
di.config.ts
41 lines (34 loc) · 2.04 KB
/
di.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/********************************************************************************
* Copyright (c) 2019 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
********************************************************************************/
import "../../css/glsp-sprotty.css";
import { ContainerModule } from "inversify";
import { configureActionHandler, configureCommand, SetModelCommand, Tool, TYPES } from "sprotty/lib";
import { SetOperationsAction } from "../features/operation/set-operations";
import { GLSP_TYPES } from "../types";
import { GLSPCommandStack } from "./command-stack";
import { FeedbackAwareUpdateModelCommand, SetModelActionHandler } from "./model/update-model-command";
import { createToolFactory, GLSPToolManagerActionHandler } from "./tool-manager/tool-manager-action-handler";
const defaultGLSPModule = new ContainerModule((bind, _unbind, isBound, rebind) => {
const context = { bind, _unbind, isBound, rebind };
// Tool manager initialization ------------------------------------
configureActionHandler(context, SetOperationsAction.KIND, GLSPToolManagerActionHandler);
bind(GLSP_TYPES.IToolFactory).toFactory<Tool>((createToolFactory()));
// Model update initialization ------------------------------------
configureCommand(context, FeedbackAwareUpdateModelCommand);
configureActionHandler(context, SetModelCommand.KIND, SetModelActionHandler);
rebind(TYPES.ICommandStack).to(GLSPCommandStack);
});
export default defaultGLSPModule;