@eclipse-glsp/client 1.1.0-next.c40feb3.207 → 1.1.0-next.cb7168a.239
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/css/decoration.css +1 -1
- package/css/glsp-sprotty.css +18 -18
- package/lib/base/auto-complete/auto-complete-widget.d.ts +2 -2
- package/lib/base/auto-complete/auto-complete-widget.js +3 -3
- package/lib/base/command-stack.d.ts +1 -2
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +5 -14
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/container-modules.d.ts +32 -2
- package/lib/base/container-modules.d.ts.map +1 -1
- package/lib/base/container-modules.js +74 -40
- package/lib/base/container-modules.js.map +1 -1
- package/lib/base/di.config.d.ts +1 -1
- package/lib/base/di.config.d.ts.map +1 -1
- package/lib/base/di.config.js +7 -7
- package/lib/base/di.config.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +3 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +3 -3
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/selection-clearing-mouse-listener.js +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts +4 -5
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +15 -8
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/features/bounds/di.config.d.ts +0 -16
- package/lib/features/bounds/di.config.d.ts.map +1 -1
- package/lib/features/bounds/di.config.js +12 -9
- package/lib/features/bounds/di.config.js.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.d.ts +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/freeform-layout.js +2 -2
- package/lib/features/{layout → bounds}/freeform-layout.js.map +1 -1
- package/lib/features/bounds/freeform-layout.spec.d.ts.map +1 -0
- package/lib/features/{layout/tests → bounds}/freeform-layout.spec.js +37 -37
- package/lib/features/bounds/freeform-layout.spec.js.map +1 -0
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +3 -2
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/hbox-layout.js.map +1 -1
- package/lib/features/bounds/hbox-layout.spec.d.ts.map +1 -0
- package/lib/features/{layout/tests → bounds}/hbox-layout.spec.js +18 -18
- package/lib/features/bounds/hbox-layout.spec.js.map +1 -0
- package/lib/features/{layout/tests/layouter-test-util.d.ts → bounds/layouter-test-util.spec.d.ts} +3 -4
- package/lib/features/bounds/layouter-test-util.spec.d.ts.map +1 -0
- package/lib/features/{layout/tests/layouter-test-util.js → bounds/layouter-test-util.spec.js} +7 -7
- package/lib/features/bounds/layouter-test-util.spec.js.map +1 -0
- package/lib/features/{layout → bounds}/layouter.d.ts +1 -1
- package/lib/features/{layout → bounds}/layouter.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/layouter.js +1 -1
- package/lib/features/{layout → bounds}/layouter.js.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.d.ts.map +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js +1 -1
- package/lib/features/{layout → bounds}/vbox-layout.js.map +1 -1
- package/lib/features/bounds/vbox-layout.spec.d.ts.map +1 -0
- package/lib/features/{layout/tests → bounds}/vbox-layout.spec.js +18 -18
- package/lib/features/bounds/vbox-layout.spec.js.map +1 -0
- package/lib/features/command-palette/command-palette-tool.d.ts +1 -1
- package/lib/features/command-palette/command-palette-tool.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette-tool.js +3 -3
- package/lib/features/command-palette/command-palette-tool.js.map +1 -1
- package/lib/features/command-palette/di.config.d.ts +0 -15
- package/lib/features/command-palette/di.config.d.ts.map +1 -1
- package/lib/features/command-palette/di.config.js +6 -7
- package/lib/features/command-palette/di.config.js.map +1 -1
- package/lib/features/context-menu/di.config.d.ts +0 -15
- package/lib/features/context-menu/di.config.d.ts.map +1 -1
- package/lib/features/context-menu/di.config.js +4 -3
- package/lib/features/context-menu/di.config.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.d.ts +2 -2
- package/lib/features/copy-paste/copy-paste-handler.d.ts.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js +5 -5
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/decoration/di.config.d.ts +0 -15
- package/lib/features/decoration/di.config.d.ts.map +1 -1
- package/lib/features/decoration/di.config.js +4 -4
- package/lib/features/decoration/di.config.js.map +1 -1
- package/lib/features/edit-label/di.config.d.ts +0 -15
- package/lib/features/edit-label/di.config.d.ts.map +1 -1
- package/lib/features/edit-label/di.config.js +3 -2
- package/lib/features/edit-label/di.config.js.map +1 -1
- package/lib/features/export/di.config.d.ts +4 -0
- package/lib/features/export/di.config.d.ts.map +1 -0
- package/lib/features/export/di.config.js +30 -0
- package/lib/features/export/di.config.js.map +1 -0
- package/lib/features/export/glsp-svg-exporter.d.ts +1 -1
- package/lib/features/export/glsp-svg-exporter.d.ts.map +1 -1
- package/lib/features/export/glsp-svg-exporter.js +1 -2
- package/lib/features/export/glsp-svg-exporter.js.map +1 -1
- package/lib/features/hover/di.config.d.ts +0 -15
- package/lib/features/hover/di.config.d.ts.map +1 -1
- package/lib/features/hover/di.config.js +7 -7
- package/lib/features/hover/di.config.js.map +1 -1
- package/lib/features/hover/hover.d.ts.map +1 -1
- package/lib/features/hover/hover.js +2 -1
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/layout/di.config.d.ts +1 -1
- package/lib/features/layout/di.config.d.ts.map +1 -1
- package/lib/features/layout/di.config.js +1 -9
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/layout/layout-elements-action.d.ts.map +1 -1
- package/lib/features/layout/layout-elements-action.js +2 -2
- package/lib/features/layout/layout-elements-action.js.map +1 -1
- package/lib/features/navigation/di.config.d.ts +2 -1
- package/lib/features/navigation/di.config.d.ts.map +1 -1
- package/lib/features/navigation/di.config.js +3 -3
- package/lib/features/navigation/di.config.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts +2 -2
- package/lib/features/navigation/navigation-action-handler.js +2 -2
- package/lib/features/save/di.config.d.ts +0 -15
- package/lib/features/save/di.config.d.ts.map +1 -1
- package/lib/features/save/di.config.js +3 -2
- package/lib/features/save/di.config.js.map +1 -1
- package/lib/features/save/model.d.ts +1 -1
- package/lib/features/select/di.config.d.ts +0 -15
- package/lib/features/select/di.config.d.ts.map +1 -1
- package/lib/features/select/di.config.js +8 -7
- package/lib/features/select/di.config.js.map +1 -1
- package/lib/features/select/select-mouse-listener.d.ts +1 -1
- package/lib/features/select/select-mouse-listener.d.ts.map +1 -1
- package/lib/features/select/select-mouse-listener.js +2 -1
- package/lib/features/select/select-mouse-listener.js.map +1 -1
- package/lib/features/select/selection-service.spec.js +19 -3
- package/lib/features/select/selection-service.spec.js.map +1 -1
- package/lib/features/source-model-watcher/di.config.js +1 -1
- package/lib/features/svg-metadata/di.config.d.ts +19 -0
- package/lib/features/svg-metadata/di.config.d.ts.map +1 -0
- package/lib/features/svg-metadata/di.config.js +26 -0
- package/lib/features/svg-metadata/di.config.js.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts +24 -0
- package/lib/features/svg-metadata/metadata-placer.d.ts.map +1 -0
- package/lib/features/svg-metadata/metadata-placer.js +63 -0
- package/lib/features/svg-metadata/metadata-placer.js.map +1 -0
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +4 -3
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +5 -4
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +7 -7
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +8 -11
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/di.config.d.ts +0 -15
- package/lib/features/tool-feedback/di.config.d.ts.map +1 -1
- package/lib/features/tool-feedback/di.config.js +20 -18
- package/lib/features/tool-feedback/di.config.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +2 -3
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +6 -11
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tool-palette/di.config.d.ts +0 -15
- package/lib/features/tool-palette/di.config.d.ts.map +1 -1
- package/lib/features/tool-palette/di.config.js +4 -4
- package/lib/features/tool-palette/di.config.js.map +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts +1 -1
- package/lib/features/tool-palette/tool-palette.d.ts.map +1 -1
- package/lib/features/tool-palette/tool-palette.js +2 -2
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts +1 -1
- package/lib/features/tools/change-bounds-tool.d.ts.map +1 -1
- package/lib/features/tools/change-bounds-tool.js +6 -6
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/di.config.d.ts +18 -5
- package/lib/features/tools/di.config.d.ts.map +1 -1
- package/lib/features/tools/di.config.js +15 -19
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts +2 -2
- package/lib/features/tools/glsp-manhattan-edge-router.d.ts.map +1 -1
- package/lib/features/tools/glsp-manhattan-edge-router.js +4 -4
- package/lib/features/tools/glsp-manhattan-edge-router.js.map +1 -1
- package/lib/features/validation/di.config.js +4 -4
- package/lib/features/validation/di.config.js.map +1 -1
- package/lib/features/validation/issue-marker.d.ts +1 -1
- package/lib/features/validation/issue-marker.js +1 -1
- package/lib/features/validation/validate.d.ts +6 -6
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +18 -17
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/di.config.d.ts +0 -15
- package/lib/features/viewport/di.config.d.ts.map +1 -1
- package/lib/features/viewport/di.config.js +12 -11
- package/lib/features/viewport/di.config.js.map +1 -1
- package/lib/index.d.ts +28 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +66 -34
- package/lib/index.js.map +1 -1
- package/lib/lib/model.d.ts +7 -3
- package/lib/lib/model.d.ts.map +1 -1
- package/lib/lib/model.js +48 -1
- package/lib/lib/model.js.map +1 -1
- package/lib/sprotty-reexport.d.ts +7 -7
- package/lib/sprotty-reexport.d.ts.map +1 -1
- package/lib/sprotty-reexport.js +19 -10
- package/lib/sprotty-reexport.js.map +1 -1
- package/lib/utils/html-utils.d.ts +1 -1
- package/lib/utils/html-utils.js +1 -1
- package/lib/utils/smodel-util.d.ts +1 -1
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +1 -1
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/views/base-view-module.d.ts +18 -6
- package/lib/views/base-view-module.d.ts.map +1 -1
- package/lib/views/base-view-module.js +1 -1
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/glsp-edge-view.d.ts +2 -2
- package/lib/views/glsp-edge-view.d.ts.map +1 -1
- package/lib/views/glsp-edge-view.js +2 -2
- package/lib/views/glsp-edge-view.js.map +1 -1
- package/lib/views/glsp-projection-view.d.ts +1 -1
- package/lib/views/glsp-projection-view.js +1 -1
- package/lib/views/index.d.ts +1 -1
- package/lib/views/index.js +1 -1
- package/lib/views/rounded-corner-view.js +2 -2
- package/lib/views/rounded-corner.d.ts +1 -1
- package/lib/views/rounded-corner.js +1 -1
- package/package.json +20 -19
- package/src/base/auto-complete/auto-complete-widget.ts +3 -3
- package/src/base/command-stack.ts +13 -11
- package/src/base/container-modules.ts +42 -9
- package/src/base/di.config.ts +8 -8
- package/src/base/editor-context-service.ts +4 -4
- package/src/base/selection-clearing-mouse-listener.ts +1 -1
- package/src/base/tool-manager/glsp-tool-manager.ts +15 -12
- package/src/features/bounds/di.config.ts +21 -11
- package/src/features/{layout/tests → bounds}/freeform-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/freeform-layout.ts +2 -2
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +4 -7
- package/src/features/{layout/tests → bounds}/hbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/hbox-layout.ts +1 -1
- package/src/features/{layout/tests/layouter-test-util.ts → bounds/layouter-test-util.spec.ts} +6 -6
- package/src/features/{layout → bounds}/layouter.ts +1 -1
- package/src/features/{layout/tests → bounds}/vbox-layout.spec.ts +2 -2
- package/src/features/{layout → bounds}/vbox-layout.ts +1 -1
- package/src/features/command-palette/command-palette-tool.ts +3 -3
- package/src/features/command-palette/di.config.ts +6 -7
- package/src/features/context-menu/di.config.ts +4 -3
- package/src/features/copy-paste/copy-paste-handler.ts +5 -5
- package/src/features/decoration/di.config.ts +4 -4
- package/src/features/edit-label/di.config.ts +3 -2
- package/src/features/export/di.config.ts +29 -0
- package/src/features/export/glsp-svg-exporter.ts +8 -7
- package/src/features/hover/di.config.ts +8 -7
- package/src/features/hover/hover.ts +2 -1
- package/src/features/layout/di.config.ts +2 -11
- package/src/features/layout/layout-elements-action.ts +2 -1
- package/src/features/navigation/di.config.ts +4 -2
- package/src/features/navigation/navigation-action-handler.ts +2 -2
- package/src/features/save/di.config.ts +3 -2
- package/src/features/save/model.ts +1 -1
- package/src/features/select/di.config.ts +8 -7
- package/src/features/select/select-mouse-listener.ts +2 -2
- package/src/features/select/selection-service.spec.ts +4 -5
- package/src/features/source-model-watcher/di.config.ts +1 -1
- package/src/features/svg-metadata/di.config.ts +26 -0
- package/src/features/svg-metadata/metadata-placer.ts +51 -0
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +4 -4
- package/src/features/tool-feedback/creation-tool-feedback.ts +22 -16
- package/src/features/tool-feedback/di.config.ts +20 -18
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +3 -11
- package/src/features/tool-palette/di.config.ts +4 -4
- package/src/features/tool-palette/tool-palette.ts +4 -4
- package/src/features/tools/change-bounds-tool.ts +7 -7
- package/src/features/tools/di.config.ts +19 -24
- package/src/features/tools/glsp-manhattan-edge-router.ts +8 -5
- package/src/features/validation/di.config.ts +5 -5
- package/src/features/validation/issue-marker.ts +1 -1
- package/src/features/validation/validate.ts +16 -19
- package/src/features/viewport/di.config.ts +13 -11
- package/src/index.ts +37 -5
- package/src/lib/model.ts +35 -3
- package/src/sprotty-reexport.ts +24 -8
- package/src/utils/html-utils.ts +1 -1
- package/src/utils/smodel-util.ts +12 -5
- package/src/views/base-view-module.ts +4 -9
- package/src/views/glsp-edge-view.tsx +3 -3
- package/src/views/glsp-projection-view.tsx +1 -1
- package/src/views/index.ts +1 -2
- package/src/views/rounded-corner-view.tsx +2 -2
- package/src/views/rounded-corner.ts +2 -2
- package/lib/features/layout/tests/freeform-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/freeform-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/hbox-layout.spec.js.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.d.ts.map +0 -1
- package/lib/features/layout/tests/layouter-test-util.js.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.d.ts.map +0 -1
- package/lib/features/layout/tests/vbox-layout.spec.js.map +0 -1
- /package/lib/features/{layout/tests → bounds}/freeform-layout.spec.d.ts +0 -0
- /package/lib/features/{layout/tests → bounds}/hbox-layout.spec.d.ts +0 -0
- /package/lib/features/{layout/tests → bounds}/vbox-layout.spec.d.ts +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,22 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import { CommandStack, IActionDispatcher, SModelRoot } from 'sprotty';
|
|
19
|
-
import { TYPES } from './types';
|
|
16
|
+
import { injectable } from 'inversify';
|
|
17
|
+
import { CommandStack, SModelRoot } from 'sprotty';
|
|
20
18
|
|
|
21
19
|
@injectable()
|
|
22
20
|
export class GLSPCommandStack extends CommandStack {
|
|
23
|
-
@inject(TYPES.IActionDispatcherProvider) protected actionDispatcher: () => Promise<IActionDispatcher>;
|
|
24
|
-
|
|
25
21
|
override undo(): Promise<SModelRoot> {
|
|
26
|
-
this.
|
|
27
|
-
|
|
22
|
+
this.logger.warn(
|
|
23
|
+
this,
|
|
24
|
+
'GLSPCommandStack.undo() was called. This should never happen as the GLSP server is responsible for handling undo requests'
|
|
25
|
+
);
|
|
26
|
+
return this.currentModel;
|
|
28
27
|
}
|
|
29
28
|
|
|
30
29
|
override redo(): Promise<SModelRoot> {
|
|
31
|
-
this.
|
|
32
|
-
|
|
30
|
+
this.logger.warn(
|
|
31
|
+
this,
|
|
32
|
+
'GLSPCommandStack.redo() was called. This should never happen as the GLSP server is responsible for handling redo requests'
|
|
33
|
+
);
|
|
34
|
+
return this.currentModel;
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
+
import { ContainerConfiguration, initializeContainer } from '@eclipse-glsp/protocol';
|
|
17
18
|
import { Container, ContainerModule } from 'inversify';
|
|
18
19
|
import {
|
|
19
20
|
buttonModule,
|
|
@@ -21,7 +22,6 @@ import {
|
|
|
21
22
|
edgeIntersectionModule,
|
|
22
23
|
edgeLayoutModule,
|
|
23
24
|
expandModule,
|
|
24
|
-
exportModule,
|
|
25
25
|
fadeModule,
|
|
26
26
|
labelEditUiModule,
|
|
27
27
|
modelSourceModule,
|
|
@@ -29,17 +29,19 @@ import {
|
|
|
29
29
|
routingModule,
|
|
30
30
|
zorderModule
|
|
31
31
|
} from 'sprotty';
|
|
32
|
+
import svgMetadataModule from '../features/svg-metadata/di.config';
|
|
32
33
|
import glspBoundsModule from '../features/bounds/di.config';
|
|
33
34
|
import glspCommandPaletteModule from '../features/command-palette/di.config';
|
|
34
35
|
import glspContextMenuModule from '../features/context-menu/di.config';
|
|
35
36
|
import { glspServerCopyPasteModule } from '../features/copy-paste/di.config';
|
|
36
37
|
import glspDecorationModule from '../features/decoration/di.config';
|
|
37
38
|
import glspEditLabelModule from '../features/edit-label/di.config';
|
|
39
|
+
import glspExportModule from '../features/export/di.config';
|
|
38
40
|
import modelHintsModule from '../features/hints/di.config';
|
|
39
41
|
import glspHoverModule from '../features/hover/di.config';
|
|
40
42
|
import layoutModule from '../features/layout/di.config';
|
|
41
43
|
import glspMouseToolModule from '../features/mouse-tool/di.config';
|
|
42
|
-
import
|
|
44
|
+
import navigationModule from '../features/navigation/di.config';
|
|
43
45
|
import glspSelectModule from '../features/select/di.config';
|
|
44
46
|
import sourceModelWatcherModule from '../features/source-model-watcher/di.config';
|
|
45
47
|
import toolFeedbackModule from '../features/tool-feedback/di.config';
|
|
@@ -56,7 +58,7 @@ export const DEFAULT_MODULES = [
|
|
|
56
58
|
edgeIntersectionModule,
|
|
57
59
|
edgeLayoutModule,
|
|
58
60
|
expandModule,
|
|
59
|
-
|
|
61
|
+
glspExportModule,
|
|
60
62
|
fadeModule,
|
|
61
63
|
glspBoundsModule,
|
|
62
64
|
glspCommandPaletteModule,
|
|
@@ -82,8 +84,40 @@ export const DEFAULT_MODULES = [
|
|
|
82
84
|
toolsModule,
|
|
83
85
|
enableDefaultToolsOnFocusLossModule,
|
|
84
86
|
validationModule,
|
|
85
|
-
zorderModule
|
|
86
|
-
|
|
87
|
+
zorderModule,
|
|
88
|
+
svgMetadataModule
|
|
89
|
+
] as const;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Initializes a GLSP Diagram container with the GLSP default modules and the specified custom `modules`.
|
|
93
|
+
* Additional modules can be passed as direct arguments or as part of a {@link ModuleConfiguration}.
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const container= createDiagramContainer(myModule1, myModule2)
|
|
96
|
+
* // or
|
|
97
|
+
* const container= createDiagramContainer({ add: [myModule1, myModule2]})
|
|
98
|
+
* ```
|
|
99
|
+
* Default modules can be excluded using {@link ModuleConfiguration}s.
|
|
100
|
+
* This means, you can still customize the default modules in two ways.
|
|
101
|
+
*
|
|
102
|
+
* First, you can exclude default modules and add a module with your custom code.
|
|
103
|
+
*
|
|
104
|
+
* ```typescript
|
|
105
|
+
* const container = createDiagramContainer({ add:myModelSourceWatcherModule, remove: modelSourceWatcherModule} );
|
|
106
|
+
* ```
|
|
107
|
+
*
|
|
108
|
+
* Second, you can unbind or rebind implementations that are originally bound in one of the default modules.
|
|
109
|
+
*
|
|
110
|
+
* ```typescript
|
|
111
|
+
* rebind(NavigationTargetResolver).to(MyNavigationTargetResolver);
|
|
112
|
+
* ```
|
|
113
|
+
*
|
|
114
|
+
* @param containerConfiguration
|
|
115
|
+
* Custom modules to be loaded in addition to the default modules and/or default modules that should be excluded.
|
|
116
|
+
* @returns The initialized container.
|
|
117
|
+
*/
|
|
118
|
+
export function initializeDiagramContainer(container: Container, ...containerConfiguration: ContainerConfiguration): Container {
|
|
119
|
+
return initializeContainer(container, ...DEFAULT_MODULES, ...containerConfiguration);
|
|
120
|
+
}
|
|
87
121
|
|
|
88
122
|
/**
|
|
89
123
|
* Creates a GLSP Client container with the GLSP default modules and the specified custom `modules`.
|
|
@@ -105,9 +139,8 @@ export const DEFAULT_MODULES = [
|
|
|
105
139
|
* ```
|
|
106
140
|
* @param modules Custom modules to be loaded in addition to the default modules.
|
|
107
141
|
* @returns The created container.
|
|
142
|
+
* @deprecated Please use `initializeDiagramContainer` from `@eclipse-glsp/client` instead
|
|
108
143
|
*/
|
|
109
144
|
export function createClientContainer(...modules: ContainerModule[]): Container {
|
|
110
|
-
|
|
111
|
-
container.load(...DEFAULT_MODULES, ...modules);
|
|
112
|
-
return container;
|
|
145
|
+
return initializeDiagramContainer(new Container(), ...modules);
|
|
113
146
|
}
|
package/src/base/di.config.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { InitializeResult, SetEditModeAction } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { bindAsService, bindOrRebind, InitializeResult, SetEditModeAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import '@vscode/codicons/dist/codicon.css';
|
|
18
18
|
import { Container, ContainerModule } from 'inversify';
|
|
19
19
|
import { ActionHandlerRegistry, configureActionHandler, configureCommand, ModelSource, SetModelCommand } from 'sprotty';
|
|
@@ -54,19 +54,19 @@ const defaultGLSPModule = new ContainerModule((bind, _unbind, isBound, rebind) =
|
|
|
54
54
|
configureCommand(context, FeedbackAwareUpdateModelCommand);
|
|
55
55
|
configureActionHandler(context, SetModelCommand.KIND, SetModelActionHandler);
|
|
56
56
|
|
|
57
|
-
|
|
57
|
+
bindAsService(context, TYPES.MouseListener, SelectionClearingMouseListener);
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
bindOrRebind(context, TYPES.ICommandStack).to(GLSPCommandStack);
|
|
60
60
|
bind(GLSPToolManager).toSelf().inSingletonScope();
|
|
61
|
-
|
|
61
|
+
bindOrRebind(context, TYPES.IToolManager).toService(GLSPToolManager);
|
|
62
62
|
bind(GLSPActionDispatcher).toSelf().inSingletonScope();
|
|
63
|
-
|
|
63
|
+
bindOrRebind(context, TYPES.IActionDispatcher).toService(GLSPActionDispatcher);
|
|
64
64
|
|
|
65
65
|
bind(ModelInitializationConstraint).to(DefaultModelInitializationConstraint).inSingletonScope();
|
|
66
66
|
|
|
67
67
|
// support re-registration of model elements and views
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
bindOrRebind(context, TYPES.SModelRegistry).to(GLSPModelRegistry).inSingletonScope();
|
|
69
|
+
bindOrRebind(context, TYPES.ViewRegistry).to(GLSPViewRegistry).inSingletonScope();
|
|
70
70
|
});
|
|
71
71
|
|
|
72
72
|
export default defaultGLSPModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -21,7 +21,7 @@ import { isSourceUriAware } from './source-uri-aware';
|
|
|
21
21
|
import { TYPES } from './types';
|
|
22
22
|
|
|
23
23
|
export interface EditModeListener {
|
|
24
|
-
editModeChanged(newValue: string,
|
|
24
|
+
editModeChanged(newValue: string, oldValue: string): void;
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
/**
|
|
@@ -81,11 +81,11 @@ export class EditorContextService implements IActionHandler {
|
|
|
81
81
|
if (SetEditModeAction.is(action)) {
|
|
82
82
|
const oldValue = this._editMode;
|
|
83
83
|
this._editMode = action.editMode;
|
|
84
|
-
this.
|
|
84
|
+
this.notifyEditModeListeners(oldValue);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
protected
|
|
88
|
+
protected notifyEditModeListeners(oldValue: string): void {
|
|
89
89
|
this.editModeListeners.forEach(listener => listener.editModeChanged(oldValue, this.editMode));
|
|
90
90
|
}
|
|
91
91
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2020-2022 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,19 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { distinctAdd, EditMode } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { AnyObject, distinctAdd, EditMode, hasBooleanProp, hasFunctionProp, hasStringProp } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable, multiInject, optional, postConstruct } from 'inversify';
|
|
18
18
|
import { Tool, ToolManager } from 'sprotty';
|
|
19
19
|
import { EditModeListener, EditorContextService, EditorContextServiceProvider } from '../editor-context-service';
|
|
20
20
|
import { TYPES } from '../types';
|
|
21
21
|
|
|
22
|
-
export interface IGLSPToolManager extends ToolManager {
|
|
23
|
-
/* Disables all actives tools and activates only default tool with non-edit function*/
|
|
24
|
-
disableEditTools(): void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
22
|
@injectable()
|
|
28
|
-
export class GLSPToolManager extends ToolManager implements
|
|
23
|
+
export class GLSPToolManager extends ToolManager implements EditModeListener {
|
|
29
24
|
protected editorContext?: EditorContextService;
|
|
30
25
|
|
|
31
26
|
@multiInject(TYPES.ITool) @optional() override tools: Tool[];
|
|
@@ -59,7 +54,7 @@ export class GLSPToolManager extends ToolManager implements IGLSPToolManager, Ed
|
|
|
59
54
|
this.disableActiveTools();
|
|
60
55
|
let tools = toolIds.map(id => this.tool(id));
|
|
61
56
|
if (this.editorContext && this.editorContext.isReadonly) {
|
|
62
|
-
tools = tools.filter(tool => tool && (!
|
|
57
|
+
tools = tools.filter(tool => tool && (!GLSPTool.is(tool) || tool.isEditTool === false));
|
|
63
58
|
}
|
|
64
59
|
tools.forEach(tool => {
|
|
65
60
|
if (tool !== undefined) {
|
|
@@ -71,7 +66,7 @@ export class GLSPToolManager extends ToolManager implements IGLSPToolManager, Ed
|
|
|
71
66
|
|
|
72
67
|
disableEditTools(): void {
|
|
73
68
|
this.disableActiveTools();
|
|
74
|
-
this.enable(this.defaultTools.filter(tool => !
|
|
69
|
+
this.enable(this.defaultTools.filter(tool => !GLSPTool.is(tool) || tool.isEditTool === false).map(tool => tool.id));
|
|
75
70
|
}
|
|
76
71
|
|
|
77
72
|
editModeChanged(oldValue: string, newValue: string): void {
|
|
@@ -90,6 +85,14 @@ export interface GLSPTool extends Tool {
|
|
|
90
85
|
isEditTool: boolean;
|
|
91
86
|
}
|
|
92
87
|
|
|
93
|
-
export
|
|
94
|
-
|
|
88
|
+
export namespace GLSPTool {
|
|
89
|
+
export function is(object: unknown): object is GLSPTool {
|
|
90
|
+
return (
|
|
91
|
+
AnyObject.is(object) &&
|
|
92
|
+
hasStringProp(object, 'id') &&
|
|
93
|
+
hasFunctionProp(object, 'enable') &&
|
|
94
|
+
hasFunctionProp(object, 'disable') &&
|
|
95
|
+
hasBooleanProp(object, 'isEditTool')
|
|
96
|
+
);
|
|
97
|
+
}
|
|
95
98
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,27 +13,37 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { bindAsService } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
18
|
import {
|
|
18
|
-
configureCommand,
|
|
19
|
-
|
|
19
|
+
configureCommand,
|
|
20
|
+
configureLayout,
|
|
21
|
+
HBoxLayouter,
|
|
22
|
+
HiddenBoundsUpdater,
|
|
23
|
+
Layouter,
|
|
24
|
+
LayoutRegistry,
|
|
25
|
+
RequestBoundsCommand,
|
|
26
|
+
SetBoundsCommand,
|
|
27
|
+
VBoxLayouter
|
|
20
28
|
} from 'sprotty';
|
|
21
|
-
import '../../../css/command-palette.css';
|
|
22
29
|
import { TYPES } from '../../base/types';
|
|
30
|
+
import { FreeFormLayouter } from './freeform-layout';
|
|
23
31
|
import { GLSPHiddenBoundsUpdater } from './glsp-hidden-bounds-updater';
|
|
32
|
+
import { HBoxLayouterExt } from './hbox-layout';
|
|
33
|
+
import { VBoxLayouterExt } from './vbox-layout';
|
|
24
34
|
|
|
25
35
|
const glspBoundsModule = new ContainerModule((bind, _unbind, isBound, _rebind) => {
|
|
26
|
-
|
|
27
|
-
configureCommand(
|
|
36
|
+
const context = { bind, isBound };
|
|
37
|
+
configureCommand(context, SetBoundsCommand);
|
|
38
|
+
configureCommand(context, RequestBoundsCommand);
|
|
28
39
|
bind(HiddenBoundsUpdater).toSelf().inSingletonScope();
|
|
29
|
-
|
|
30
|
-
bind(TYPES.HiddenVNodePostprocessor).toService(GLSPHiddenBoundsUpdater);
|
|
40
|
+
bindAsService(context, TYPES.HiddenVNodePostprocessor, GLSPHiddenBoundsUpdater);
|
|
31
41
|
bind(TYPES.Layouter).to(Layouter).inSingletonScope();
|
|
32
42
|
bind(TYPES.LayoutRegistry).to(LayoutRegistry).inSingletonScope();
|
|
33
43
|
|
|
34
|
-
configureLayout(
|
|
35
|
-
configureLayout(
|
|
36
|
-
configureLayout(
|
|
44
|
+
configureLayout(context, VBoxLayouter.KIND, VBoxLayouterExt);
|
|
45
|
+
configureLayout(context, HBoxLayouter.KIND, HBoxLayouterExt);
|
|
46
|
+
configureLayout(context, FreeFormLayouter.KIND, FreeFormLayouter);
|
|
37
47
|
});
|
|
38
48
|
|
|
39
49
|
export default glspBoundsModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -17,7 +17,7 @@ import { expect } from 'chai';
|
|
|
17
17
|
import 'mocha';
|
|
18
18
|
import 'reflect-metadata';
|
|
19
19
|
import { BoundsData, ConsoleLogger, SModelElement } from 'sprotty';
|
|
20
|
-
import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
|
|
20
|
+
import { gModel, layout, sComp, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
|
|
21
21
|
|
|
22
22
|
describe('FreeFormLayouter', () => {
|
|
23
23
|
const layoutRegistry = setupLayoutRegistry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -20,7 +20,7 @@ import { AbstractLayout } from 'sprotty/lib/features/bounds/abstract-layout';
|
|
|
20
20
|
import { AbstractLayoutOptions } from 'sprotty/lib/features/bounds/layout-options';
|
|
21
21
|
|
|
22
22
|
/**
|
|
23
|
-
* Layouts children of a container with
|
|
23
|
+
* Layouts children of a container with explicit X/Y positions
|
|
24
24
|
*/
|
|
25
25
|
@injectable()
|
|
26
26
|
export class FreeFormLayouter extends AbstractLayout<AbstractLayoutOptions> {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,10 +14,7 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
Action, ComputedBoundsAction, Deferred, ElementAndRoutingPoints, RequestAction,
|
|
19
|
-
ResponseAction
|
|
20
|
-
} from '@eclipse-glsp/protocol';
|
|
17
|
+
import { Action, ComputedBoundsAction, Deferred, ElementAndRoutingPoints, RequestAction, ResponseAction } from '@eclipse-glsp/protocol';
|
|
21
18
|
import { inject, injectable, optional } from 'inversify';
|
|
22
19
|
import { VNode } from 'snabbdom';
|
|
23
20
|
import { EdgeRouterRegistry, HiddenBoundsUpdater, IActionDispatcher, SModelElement, SRoutableElement } from 'sprotty';
|
|
@@ -30,7 +27,6 @@ import { calcElementAndRoute, isRoutable } from '../../utils/smodel-util';
|
|
|
30
27
|
*/
|
|
31
28
|
@injectable()
|
|
32
29
|
export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
33
|
-
|
|
34
30
|
@inject(EdgeRouterRegistry) @optional() protected readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
35
31
|
|
|
36
32
|
protected element2route: ElementAndRoutingPoints[] = [];
|
|
@@ -47,7 +43,8 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
47
43
|
|
|
48
44
|
override postUpdate(cause?: Action): void {
|
|
49
45
|
const actions = this.captureActions(() => super.postUpdate(cause));
|
|
50
|
-
actions
|
|
46
|
+
actions
|
|
47
|
+
.filter(action => ComputedBoundsAction.is(action))
|
|
51
48
|
.forEach(action => this.actionDispatcher.dispatch(this.enhanceAction(action as ComputedBoundsAction)));
|
|
52
49
|
this.element2route = [];
|
|
53
50
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 TypeFox, STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 TypeFox, STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -19,7 +19,7 @@ import { expect } from 'chai';
|
|
|
19
19
|
import 'mocha';
|
|
20
20
|
import 'reflect-metadata';
|
|
21
21
|
import { BoundsData, ConsoleLogger, SModelElement, SNode } from 'sprotty';
|
|
22
|
-
import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
|
|
22
|
+
import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
|
|
23
23
|
|
|
24
24
|
describe('HBoxLayouter', () => {
|
|
25
25
|
const layoutRegistry = setupLayoutRegistry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
package/src/features/{layout/tests/layouter-test-util.ts → bounds/layouter-test-util.spec.ts}
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -15,8 +15,8 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
17
|
import { Dimension, Point } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { Container } from 'inversify';
|
|
18
19
|
import 'mocha';
|
|
19
|
-
import 'reflect-metadata';
|
|
20
20
|
import {
|
|
21
21
|
BoundsData,
|
|
22
22
|
ConsoleLogger,
|
|
@@ -30,9 +30,9 @@ import {
|
|
|
30
30
|
SParentElement,
|
|
31
31
|
TYPES
|
|
32
32
|
} from 'sprotty';
|
|
33
|
-
import {
|
|
34
|
-
import { GLSPGraph } from '
|
|
35
|
-
import { StatefulLayouterExt } from '
|
|
33
|
+
import { initializeDiagramContainer } from '../../base/container-modules';
|
|
34
|
+
import { GLSPGraph } from '../../lib/model';
|
|
35
|
+
import { StatefulLayouterExt } from './layouter';
|
|
36
36
|
|
|
37
37
|
export function gModel(): GLSPGraph {
|
|
38
38
|
return new GLSPGraph();
|
|
@@ -117,6 +117,6 @@ export function layout(
|
|
|
117
117
|
export function setupLayoutRegistry(): LayoutRegistry {
|
|
118
118
|
// Generic Test setup
|
|
119
119
|
// create client container that registers all default modules including the layoutModule
|
|
120
|
-
const layoutContainer =
|
|
120
|
+
const layoutContainer = initializeDiagramContainer(new Container());
|
|
121
121
|
return layoutContainer.get<LayoutRegistry>(TYPES.LayoutRegistry);
|
|
122
122
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2022-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022 TypeFox, STMicroelectronics and others.
|
|
2
|
+
* Copyright (c) 2022-2023 TypeFox, STMicroelectronics and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -19,7 +19,7 @@ import { expect } from 'chai';
|
|
|
19
19
|
import 'mocha';
|
|
20
20
|
import 'reflect-metadata';
|
|
21
21
|
import { BoundsData, ConsoleLogger, SModelElement, SNode } from 'sprotty';
|
|
22
|
-
import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util';
|
|
22
|
+
import { layout, setupLayoutRegistry, sLabel, sNode } from './layouter-test-util.spec';
|
|
23
23
|
|
|
24
24
|
describe('VBoxLayouter', () => {
|
|
25
25
|
const layoutRegistry = setupLayoutRegistry();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,7 +25,7 @@ export class CommandPaletteTool implements Tool {
|
|
|
25
25
|
|
|
26
26
|
@postConstruct()
|
|
27
27
|
protected postConstruct(): void {
|
|
28
|
-
this.commandPaletteKeyListener = this.
|
|
28
|
+
this.commandPaletteKeyListener = this.createCommandPaletteKeyListener();
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
get id(): string {
|
|
@@ -40,7 +40,7 @@ export class CommandPaletteTool implements Tool {
|
|
|
40
40
|
this.keyTool.deregister(this.commandPaletteKeyListener);
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
protected
|
|
43
|
+
protected createCommandPaletteKeyListener(): KeyListener {
|
|
44
44
|
return new CommandPaletteKeyListener();
|
|
45
45
|
}
|
|
46
46
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { bindAsService } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
18
|
import { CommandPalette, CommandPaletteActionProviderRegistry } from 'sprotty';
|
|
18
19
|
import '../../../css/command-palette.css';
|
|
@@ -21,12 +22,10 @@ import { CommandPaletteTool } from './command-palette-tool';
|
|
|
21
22
|
import { ServerCommandPaletteActionProvider } from './server-command-palette-provider';
|
|
22
23
|
|
|
23
24
|
const glspCommandPaletteModule = new ContainerModule(bind => {
|
|
24
|
-
bind
|
|
25
|
-
bind(TYPES.
|
|
26
|
-
bind
|
|
27
|
-
bind
|
|
28
|
-
bind(TYPES.ICommandPaletteActionProvider).to(ServerCommandPaletteActionProvider);
|
|
29
|
-
bind(TYPES.IDefaultTool).to(CommandPaletteTool);
|
|
25
|
+
bindAsService(bind, TYPES.IUIExtension, CommandPalette);
|
|
26
|
+
bind(TYPES.ICommandPaletteActionProviderRegistry).to(CommandPaletteActionProviderRegistry).inSingletonScope();
|
|
27
|
+
bindAsService(bind, TYPES.ICommandPaletteActionProvider, ServerCommandPaletteActionProvider);
|
|
28
|
+
bindAsService(bind, TYPES.IDefaultTool, CommandPaletteTool);
|
|
30
29
|
});
|
|
31
30
|
|
|
32
31
|
export default glspCommandPaletteModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
import { bindAsService } from '@eclipse-glsp/protocol';
|
|
16
17
|
import { ContainerModule } from 'inversify';
|
|
17
18
|
import { ContextMenuProviderRegistry, IContextMenuService } from 'sprotty';
|
|
18
19
|
import { TYPES } from '../../base/types';
|
|
@@ -30,9 +31,9 @@ const glspContextMenuModule = new ContainerModule(bind => {
|
|
|
30
31
|
}
|
|
31
32
|
})
|
|
32
33
|
);
|
|
33
|
-
bind
|
|
34
|
+
bindAsService(bind, TYPES.MouseListener, SelectionServiceAwareContextMenuMouseListener);
|
|
34
35
|
bind(TYPES.IContextMenuProviderRegistry).to(ContextMenuProviderRegistry);
|
|
35
|
-
bind
|
|
36
|
+
bindAsService(bind, TYPES.IContextMenuItemProvider, ServerContextMenuItemProvider);
|
|
36
37
|
});
|
|
37
38
|
|
|
38
39
|
export default glspContextMenuModule;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -96,7 +96,7 @@ const CLIPBOARD_DATA_FORMAT = 'text/plain';
|
|
|
96
96
|
export class ServerCopyPasteHandler implements ICopyPasteHandler {
|
|
97
97
|
@inject(TYPES.IActionDispatcher) protected actionDispatcher: GLSPActionDispatcher;
|
|
98
98
|
@inject(TYPES.ViewerOptions) protected viewerOptions: ViewerOptions;
|
|
99
|
-
@inject(TYPES.IAsyncClipboardService) protected
|
|
99
|
+
@inject(TYPES.IAsyncClipboardService) protected clipboardService: IAsyncClipboardService;
|
|
100
100
|
@inject(EditorContextService) protected editorContext: EditorContextService;
|
|
101
101
|
|
|
102
102
|
handleCopy(event: ClipboardEvent): void {
|
|
@@ -105,13 +105,13 @@ export class ServerCopyPasteHandler implements ICopyPasteHandler {
|
|
|
105
105
|
event.clipboardData.setData(CLIPBOARD_DATA_FORMAT, toClipboardId(clipboardId));
|
|
106
106
|
this.actionDispatcher
|
|
107
107
|
.request<SetClipboardDataAction>(RequestClipboardDataAction.create(this.editorContext.get()))
|
|
108
|
-
.then(action => this.
|
|
108
|
+
.then(action => this.clipboardService.put(action.clipboardData, clipboardId));
|
|
109
109
|
event.preventDefault();
|
|
110
110
|
} else {
|
|
111
111
|
if (event.clipboardData) {
|
|
112
112
|
event.clipboardData.clearData();
|
|
113
113
|
}
|
|
114
|
-
this.
|
|
114
|
+
this.clipboardService.clear();
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
|
|
@@ -126,7 +126,7 @@ export class ServerCopyPasteHandler implements ICopyPasteHandler {
|
|
|
126
126
|
handlePaste(event: ClipboardEvent): void {
|
|
127
127
|
if (event.clipboardData && this.shouldPaste(event)) {
|
|
128
128
|
const clipboardId = getClipboardIdFromDataTransfer(event.clipboardData);
|
|
129
|
-
const clipboardData = this.
|
|
129
|
+
const clipboardData = this.clipboardService.get(clipboardId);
|
|
130
130
|
if (clipboardData) {
|
|
131
131
|
this.actionDispatcher.dispatch(PasteOperation.create({ clipboardData, editorContext: this.editorContext.get() }));
|
|
132
132
|
}
|