/
crossmodel-diagram-module.ts
32 lines (30 loc) · 1.72 KB
/
crossmodel-diagram-module.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
/********************************************************************************
* Copyright (c) 2024 CrossBreeze.
********************************************************************************/
import {
ConsoleLogger,
LogLevel,
SetViewportAction,
TYPES,
bindAsService,
bindOrRebind,
configureActionHandler
} from '@eclipse-glsp/client';
import { TheiaGLSPSelectionForwarder } from '@eclipse-glsp/theia-integration';
import { ContainerModule, interfaces } from '@theia/core/shared/inversify';
import { GridAlignmentHandler } from './crossmodel-grid-handler';
import { CrossModelGridSnapper } from './crossmodel-grid-snapper';
import { CrossModelGLSPSelectionDataService } from './crossmodel-selection-data-service';
import { CrossModelSelectionDataService, CrossModelTheiaGLSPSelectionForwarder } from './crossmodel-selection-forwarder';
export function createCrossModelDiagramModule(registry: interfaces.ContainerModuleCallBack): ContainerModule {
return new ContainerModule((bind, unbind, isBound, rebind, unbindAsync, onActivation, onDeactivation) => {
rebind(TYPES.ILogger).to(ConsoleLogger).inSingletonScope();
rebind(TYPES.LogLevel).toConstantValue(LogLevel.warn);
bindAsService(bind, CrossModelSelectionDataService, CrossModelGLSPSelectionDataService);
bind(CrossModelTheiaGLSPSelectionForwarder).toSelf().inSingletonScope();
bindOrRebind({ bind, isBound, rebind }, TheiaGLSPSelectionForwarder).toService(CrossModelTheiaGLSPSelectionForwarder);
bind(TYPES.ISnapper).to(CrossModelGridSnapper);
configureActionHandler({ bind, isBound }, SetViewportAction.KIND, GridAlignmentHandler);
registry(bind, unbind, isBound, rebind, unbindAsync, onActivation, onDeactivation);
});
}