@eclipse-glsp/client 0.10.0-next.4ce46ea.160 → 0.10.0-next.6bee8eb.163
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/lib/base/action-dispatcher.d.ts +1 -1
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +3 -3
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +8 -8
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/auto-complete/validation-decorator.js +2 -2
- package/lib/base/auto-complete/validation-decorator.js.map +1 -1
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +3 -3
- package/lib/base/command-stack.js.map +1 -1
- package/lib/base/di.config.js +4 -4
- package/lib/base/di.config.js.map +1 -1
- package/lib/base/drag-aware-mouse-listener.d.ts +1 -1
- package/lib/base/drag-aware-mouse-listener.d.ts.map +1 -1
- package/lib/base/drag-aware-mouse-listener.js.map +1 -1
- package/lib/base/editor-context-service.js +10 -9
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/focus-tracker.js +3 -3
- package/lib/base/focus-tracker.js.map +1 -1
- package/lib/base/model/model-registry.d.ts.map +1 -1
- package/lib/base/model/model-registry.js +2 -2
- package/lib/base/model/model-registry.js.map +1 -1
- package/lib/base/model/update-model-command.d.ts +1 -1
- package/lib/base/model/update-model-command.d.ts.map +1 -1
- package/lib/base/model/update-model-command.js +12 -12
- package/lib/base/model/update-model-command.js.map +1 -1
- package/lib/base/model-initialization-constraint.d.ts +2 -2
- package/lib/base/model-initialization-constraint.d.ts.map +1 -1
- package/lib/base/model-initialization-constraint.js +9 -10
- package/lib/base/model-initialization-constraint.js.map +1 -1
- package/lib/base/selection-clearing-mouse-listener.d.ts.map +1 -1
- package/lib/base/selection-clearing-mouse-listener.js +1 -1
- package/lib/base/selection-clearing-mouse-listener.js.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/glsp-tool-manager.js +10 -10
- package/lib/base/tool-manager/glsp-tool-manager.js.map +1 -1
- package/lib/base/view/view-registry.d.ts.map +1 -1
- package/lib/base/view/view-registry.js +2 -2
- package/lib/base/view/view-registry.js.map +1 -1
- package/lib/features/change-bounds/model.d.ts +1 -1
- package/lib/features/change-bounds/model.d.ts.map +1 -1
- package/lib/features/change-bounds/model.js +3 -3
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/movement-restrictor.js +4 -4
- package/lib/features/change-bounds/movement-restrictor.js.map +1 -1
- package/lib/features/change-bounds/snap.js +1 -1
- package/lib/features/change-bounds/snap.js.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/server-command-palette-provider.js +4 -4
- package/lib/features/command-palette/server-command-palette-provider.js.map +1 -1
- package/lib/features/context-menu/delete-element-context-menu.js +2 -2
- package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.d.ts.map +1 -1
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js +7 -7
- package/lib/features/context-menu/selection-service-aware-context-menu-mouse-listener.js.map +1 -1
- package/lib/features/context-menu/server-context-menu-provider.js +4 -4
- package/lib/features/context-menu/server-context-menu-provider.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js +3 -3
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/copy-paste/copy-paste-handler.js +7 -7
- package/lib/features/copy-paste/copy-paste-handler.js.map +1 -1
- package/lib/features/copy-paste/di.config.js +3 -3
- package/lib/features/copy-paste/di.config.js.map +1 -1
- package/lib/features/decoration/decoration-placer.d.ts +1 -1
- package/lib/features/decoration/decoration-placer.d.ts.map +1 -1
- package/lib/features/decoration/decoration-placer.js +2 -2
- package/lib/features/decoration/decoration-placer.js.map +1 -1
- package/lib/features/edit-label/di.config.js +1 -1
- package/lib/features/edit-label/di.config.js.map +1 -1
- package/lib/features/edit-label/edit-label-tool.js +1 -1
- package/lib/features/edit-label/edit-label-tool.js.map +1 -1
- package/lib/features/edit-label/edit-label-validator.js +4 -4
- package/lib/features/edit-label/edit-label-validator.js.map +1 -1
- package/lib/features/hints/di.config.js +2 -2
- package/lib/features/hints/di.config.js.map +1 -1
- package/lib/features/hints/type-hints.d.ts +1 -1
- package/lib/features/hints/type-hints.d.ts.map +1 -1
- package/lib/features/hints/type-hints.js +13 -13
- package/lib/features/hints/type-hints.js.map +1 -1
- package/lib/features/hover/di.config.js +9 -9
- 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 -2
- package/lib/features/hover/hover.js.map +1 -1
- package/lib/features/layout/di.config.js +3 -3
- package/lib/features/layout/di.config.js.map +1 -1
- package/lib/features/layout/freeform-layout.d.ts.map +1 -1
- package/lib/features/layout/freeform-layout.js +3 -3
- package/lib/features/layout/freeform-layout.js.map +1 -1
- package/lib/features/layout/layout-commands.d.ts +1 -1
- package/lib/features/layout/layout-commands.d.ts.map +1 -1
- package/lib/features/layout/layout-commands.js +23 -20
- package/lib/features/layout/layout-commands.js.map +1 -1
- package/lib/features/layout/layout-commands.spec.js +6 -6
- package/lib/features/layout/layout-commands.spec.js.map +1 -1
- package/lib/features/layout/vbox-layout.d.ts.map +1 -1
- package/lib/features/layout/vbox-layout.js +7 -7
- package/lib/features/layout/vbox-layout.js.map +1 -1
- package/lib/features/model-source-watcher/di.config.js +1 -1
- package/lib/features/model-source-watcher/di.config.js.map +1 -1
- package/lib/features/model-source-watcher/model-source-changed-action-handler.js +7 -7
- package/lib/features/model-source-watcher/model-source-changed-action-handler.js.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.d.ts +9 -5
- package/lib/features/mouse-tool/mouse-tool.d.ts.map +1 -1
- package/lib/features/mouse-tool/mouse-tool.js +9 -45
- package/lib/features/mouse-tool/mouse-tool.js.map +1 -1
- package/lib/features/navigation/di.config.js +4 -4
- package/lib/features/navigation/di.config.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js +9 -9
- package/lib/features/navigation/navigation-action-handler.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.js +5 -5
- package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/features/navigation/navigation-target-resolver.spec.js +9 -9
- package/lib/features/navigation/navigation-target-resolver.spec.js.map +1 -1
- package/lib/features/reconnect/model.d.ts +1 -1
- package/lib/features/reconnect/model.d.ts.map +1 -1
- package/lib/features/reconnect/model.js +1 -1
- package/lib/features/reconnect/model.js.map +1 -1
- package/lib/features/save/save-keylistener.d.ts +1 -1
- package/lib/features/save/save-keylistener.d.ts.map +1 -1
- package/lib/features/save/save-keylistener.js +2 -2
- package/lib/features/save/save-keylistener.js.map +1 -1
- package/lib/features/select/di.config.js +4 -4
- package/lib/features/select/di.config.js.map +1 -1
- package/lib/features/select/select-feedback-action.js +4 -4
- package/lib/features/select/select-feedback-action.js.map +1 -1
- package/lib/features/select/selection-service.d.ts +3 -3
- package/lib/features/select/selection-service.d.ts.map +1 -1
- package/lib/features/select/selection-service.js +20 -18
- package/lib/features/select/selection-service.js.map +1 -1
- package/lib/features/select/selection-service.spec.js +19 -19
- package/lib/features/select/selection-service.spec.js.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js +19 -19
- package/lib/features/tool-feedback/change-bounds-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/creation-tool-feedback.js +19 -17
- package/lib/features/tool-feedback/creation-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/css-feedback.js +5 -5
- package/lib/features/tool-feedback/css-feedback.js.map +1 -1
- package/lib/features/tool-feedback/di.config.js +14 -14
- package/lib/features/tool-feedback/di.config.js.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js +32 -32
- package/lib/features/tool-feedback/edge-edit-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/feedback-action-dispatcher.js +3 -3
- package/lib/features/tool-feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.d.ts +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.d.ts.map +1 -1
- package/lib/features/tool-feedback/marquee-tool-feedback.js +3 -3
- package/lib/features/tool-feedback/marquee-tool-feedback.js.map +1 -1
- package/lib/features/tool-feedback/model.d.ts +1 -2
- package/lib/features/tool-feedback/model.d.ts.map +1 -1
- package/lib/features/tool-feedback/model.js +1 -1
- package/lib/features/tool-feedback/model.js.map +1 -1
- package/lib/features/tool-feedback/view.js +4 -4
- package/lib/features/tool-feedback/view.js.map +1 -1
- package/lib/features/tool-palette/di.config.js +2 -2
- package/lib/features/tool-palette/di.config.js.map +1 -1
- package/lib/features/tool-palette/palette-item.js +2 -2
- package/lib/features/tool-palette/palette-item.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 +16 -14
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/features/tools/base-glsp-tool.js +6 -6
- package/lib/features/tools/base-glsp-tool.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 +31 -31
- package/lib/features/tools/change-bounds-tool.js.map +1 -1
- package/lib/features/tools/delete-tool.d.ts +1 -1
- package/lib/features/tools/delete-tool.d.ts.map +1 -1
- package/lib/features/tools/delete-tool.js +14 -14
- package/lib/features/tools/delete-tool.js.map +1 -1
- package/lib/features/tools/di.config.js +3 -3
- package/lib/features/tools/di.config.js.map +1 -1
- package/lib/features/tools/edge-creation-tool.d.ts +1 -1
- package/lib/features/tools/edge-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-creation-tool.js +14 -14
- package/lib/features/tools/edge-creation-tool.js.map +1 -1
- package/lib/features/tools/edge-edit-tool.d.ts +1 -1
- package/lib/features/tools/edge-edit-tool.d.ts.map +1 -1
- package/lib/features/tools/edge-edit-tool.js +23 -23
- package/lib/features/tools/edge-edit-tool.js.map +1 -1
- package/lib/features/tools/marquee-behavior.spec.js +63 -63
- package/lib/features/tools/marquee-behavior.spec.js.map +1 -1
- package/lib/features/tools/marquee-mouse-tool.d.ts +1 -1
- package/lib/features/tools/marquee-mouse-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-mouse-tool.js +15 -15
- package/lib/features/tools/marquee-mouse-tool.js.map +1 -1
- package/lib/features/tools/marquee-tool.d.ts +1 -1
- package/lib/features/tools/marquee-tool.d.ts.map +1 -1
- package/lib/features/tools/marquee-tool.js +3 -3
- package/lib/features/tools/marquee-tool.js.map +1 -1
- package/lib/features/tools/model.d.ts +1 -1
- package/lib/features/tools/model.d.ts.map +1 -1
- package/lib/features/tools/model.js +1 -1
- package/lib/features/tools/model.js.map +1 -1
- package/lib/features/tools/node-creation-tool.d.ts +1 -1
- package/lib/features/tools/node-creation-tool.d.ts.map +1 -1
- package/lib/features/tools/node-creation-tool.js +13 -13
- package/lib/features/tools/node-creation-tool.js.map +1 -1
- package/lib/features/tools/view.d.ts.map +1 -1
- package/lib/features/tools/view.js +2 -2
- package/lib/features/tools/view.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/marker-navigator.d.ts +1 -1
- package/lib/features/validation/marker-navigator.d.ts.map +1 -1
- package/lib/features/validation/marker-navigator.js +21 -21
- package/lib/features/validation/marker-navigator.js.map +1 -1
- package/lib/features/validation/marker-navigator.spec.js +21 -21
- package/lib/features/validation/marker-navigator.spec.js.map +1 -1
- package/lib/features/validation/validate.d.ts +1 -1
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +21 -21
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/features/viewport/di.config.js +6 -6
- package/lib/features/viewport/di.config.js.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.d.ts +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.d.ts.map +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js +1 -1
- package/lib/features/viewport/glsp-scroll-mouse-listener.js.map +1 -1
- package/lib/index.js +7 -3
- package/lib/index.js.map +1 -1
- package/lib/lib/model.d.ts +1 -1
- package/lib/lib/model.d.ts.map +1 -1
- package/lib/lib/model.js +1 -1
- package/lib/lib/model.js.map +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts +1 -1
- package/lib/model-source/glsp-diagram-server.d.ts.map +1 -1
- package/lib/model-source/glsp-diagram-server.js +5 -5
- package/lib/model-source/glsp-diagram-server.js.map +1 -1
- package/lib/protocol-reexport.js +7 -2
- package/lib/protocol-reexport.js.map +1 -1
- package/lib/utils/argument-utils.js +5 -5
- package/lib/utils/argument-utils.js.map +1 -1
- package/lib/utils/smodel-util.d.ts +106 -9
- package/lib/utils/smodel-util.d.ts.map +1 -1
- package/lib/utils/smodel-util.js +124 -38
- package/lib/utils/smodel-util.js.map +1 -1
- package/lib/utils/viewpoint-util.js +3 -3
- package/lib/utils/viewpoint-util.js.map +1 -1
- package/lib/views/base-view-module.js +19 -19
- package/lib/views/base-view-module.js.map +1 -1
- package/lib/views/compartments.js +1 -1
- package/lib/views/compartments.js.map +1 -1
- package/lib/views/glsp-edge-view.d.ts +1 -1
- package/lib/views/glsp-edge-view.d.ts.map +1 -1
- package/lib/views/glsp-edge-view.js +1 -1
- package/lib/views/glsp-edge-view.js.map +1 -1
- package/lib/views/index.js +6 -2
- package/lib/views/index.js.map +1 -1
- package/lib/views/issue-marker-view.d.ts.map +1 -1
- package/lib/views/issue-marker-view.js +3 -3
- package/lib/views/issue-marker-view.js.map +1 -1
- package/lib/views/rounded-corner-view.d.ts.map +1 -1
- package/lib/views/rounded-corner-view.js +2 -2
- package/lib/views/rounded-corner-view.js.map +1 -1
- package/package.json +6 -17
- package/src/base/action-dispatcher.ts +4 -4
- package/src/base/command-stack.ts +3 -3
- package/src/base/drag-aware-mouse-listener.ts +4 -4
- package/src/base/model/model-registry.ts +2 -2
- package/src/base/model/update-model-command.ts +2 -2
- package/src/base/model-initialization-constraint.ts +8 -9
- package/src/base/selection-clearing-mouse-listener.ts +1 -1
- package/src/base/tool-manager/glsp-tool-manager.ts +7 -7
- package/src/base/view/view-registry.ts +2 -2
- package/src/features/change-bounds/model.ts +5 -5
- package/src/features/context-menu/selection-service-aware-context-menu-mouse-listener.ts +1 -1
- package/src/features/decoration/decoration-placer.ts +2 -2
- package/src/features/hints/type-hints.ts +2 -2
- package/src/features/hover/hover.ts +1 -1
- package/src/features/layout/freeform-layout.ts +3 -3
- package/src/features/layout/layout-commands.ts +9 -9
- package/src/features/layout/vbox-layout.ts +16 -12
- package/src/features/mouse-tool/mouse-tool.ts +14 -50
- package/src/features/reconnect/model.ts +2 -2
- package/src/features/save/save-keylistener.ts +2 -2
- package/src/features/select/selection-service.ts +5 -4
- package/src/features/tool-feedback/change-bounds-tool-feedback.ts +10 -9
- package/src/features/tool-feedback/creation-tool-feedback.ts +10 -10
- package/src/features/tool-feedback/edge-edit-tool-feedback.ts +15 -15
- package/src/features/tool-feedback/marquee-tool-feedback.ts +2 -2
- package/src/features/tool-feedback/model.ts +1 -3
- package/src/features/tool-palette/tool-palette.ts +5 -3
- package/src/features/tools/change-bounds-tool.ts +6 -6
- package/src/features/tools/delete-tool.ts +3 -3
- package/src/features/tools/edge-creation-tool.ts +3 -3
- package/src/features/tools/edge-edit-tool.ts +5 -5
- package/src/features/tools/marquee-mouse-tool.ts +6 -6
- package/src/features/tools/marquee-tool.ts +2 -2
- package/src/features/tools/model.ts +2 -2
- package/src/features/tools/node-creation-tool.ts +3 -3
- package/src/features/tools/view.tsx +2 -3
- package/src/features/validation/marker-navigator.ts +6 -4
- package/src/features/validation/validate.ts +4 -4
- package/src/features/viewport/glsp-scroll-mouse-listener.ts +2 -2
- package/src/lib/model.ts +2 -3
- package/src/model-source/glsp-diagram-server.ts +5 -5
- package/src/utils/smodel-util.ts +121 -41
- package/src/views/glsp-edge-view.tsx +4 -4
- package/src/views/issue-marker-view.tsx +2 -2
- package/src/views/rounded-corner-view.tsx +2 -3
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -21,12 +21,12 @@ import { CommandStack, IActionDispatcher, SModelRoot, TYPES } from 'sprotty';
|
|
|
21
21
|
export class GLSPCommandStack extends CommandStack {
|
|
22
22
|
@inject(TYPES.IActionDispatcherProvider) protected actionDispatcher: () => Promise<IActionDispatcher>;
|
|
23
23
|
|
|
24
|
-
undo(): Promise<SModelRoot> {
|
|
24
|
+
override undo(): Promise<SModelRoot> {
|
|
25
25
|
this.actionDispatcher().then(dispatcher => dispatcher.dispatch(new UndoOperation()));
|
|
26
26
|
return this.thenUpdate();
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
redo(): Promise<SModelRoot> {
|
|
29
|
+
override redo(): Promise<SModelRoot> {
|
|
30
30
|
this.actionDispatcher().then(dispatcher => dispatcher.dispatch(new RedoOperation()));
|
|
31
31
|
return this.thenUpdate();
|
|
32
32
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -28,19 +28,19 @@ export class DragAwareMouseListener extends MouseListener {
|
|
|
28
28
|
private _isMouseDown = false;
|
|
29
29
|
private _isMouseDrag = false;
|
|
30
30
|
|
|
31
|
-
mouseDown(target: SModelElement, event: MouseEvent): Action[] {
|
|
31
|
+
override mouseDown(target: SModelElement, event: MouseEvent): Action[] {
|
|
32
32
|
this._isMouseDown = true;
|
|
33
33
|
return [];
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
mouseMove(target: SModelElement, event: MouseEvent): Action[] {
|
|
36
|
+
override mouseMove(target: SModelElement, event: MouseEvent): Action[] {
|
|
37
37
|
if (this._isMouseDown) {
|
|
38
38
|
this._isMouseDrag = true;
|
|
39
39
|
}
|
|
40
40
|
return [];
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
mouseUp(element: SModelElement, event: MouseEvent): Action[] {
|
|
43
|
+
override mouseUp(element: SModelElement, event: MouseEvent): Action[] {
|
|
44
44
|
this._isMouseDown = false;
|
|
45
45
|
if (this._isMouseDrag) {
|
|
46
46
|
this._isMouseDrag = false;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-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
|
|
@@ -18,7 +18,7 @@ import { SModelElement, SModelRegistry } from 'sprotty';
|
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class GLSPModelRegistry extends SModelRegistry {
|
|
21
|
-
register(key: string, factory: (u: void) => SModelElement): void {
|
|
21
|
+
override register(key: string, factory: (u: void) => SModelElement): void {
|
|
22
22
|
if (key === undefined) {
|
|
23
23
|
throw new Error('Key is undefined');
|
|
24
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -68,7 +68,7 @@ export class FeedbackAwareUpdateModelCommand extends UpdateModelCommand {
|
|
|
68
68
|
this.actionHandlerRegistryProvider().then(registry => (this.actionHandlerRegistry = registry));
|
|
69
69
|
}
|
|
70
70
|
|
|
71
|
-
protected performUpdate(oldRoot: SModelRoot, newRoot: SModelRoot, context: CommandExecutionContext): CommandReturn {
|
|
71
|
+
protected override performUpdate(oldRoot: SModelRoot, newRoot: SModelRoot, context: CommandExecutionContext): CommandReturn {
|
|
72
72
|
if (this.feedbackActionDispatcher && this.actionHandlerRegistry) {
|
|
73
73
|
// Create a temporary context wich defines the `newRoot` as `root`
|
|
74
74
|
// This way we do not corrupt the redo/undo behavior of the super class
|
|
@@ -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 { Action,
|
|
16
|
+
import { Action, isSetModelAction, isUpdateModelAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { injectable } from 'inversify';
|
|
18
18
|
import { InitializeCanvasBoundsAction } from 'sprotty';
|
|
19
19
|
import { Deferred } from 'sprotty/lib/utils/async';
|
|
@@ -74,21 +74,20 @@ export abstract class ModelInitializationConstraint {
|
|
|
74
74
|
*/
|
|
75
75
|
@injectable()
|
|
76
76
|
export class DefaultModelInitializationConstraint extends ModelInitializationConstraint {
|
|
77
|
-
protected
|
|
77
|
+
protected seenNonEmptyModelAction = false;
|
|
78
78
|
|
|
79
79
|
isInitializedAfter(action: Action): boolean {
|
|
80
|
-
if (this.
|
|
81
|
-
this.
|
|
82
|
-
} else if (this.
|
|
80
|
+
if (this.isNonEmptyModelAction(action)) {
|
|
81
|
+
this.seenNonEmptyModelAction = true;
|
|
82
|
+
} else if (this.seenNonEmptyModelAction && action.kind === InitializeCanvasBoundsAction.KIND) {
|
|
83
83
|
return true;
|
|
84
84
|
}
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
87
87
|
|
|
88
|
-
protected
|
|
89
|
-
if (action
|
|
90
|
-
|
|
91
|
-
return updateModelAction.newRoot !== undefined && updateModelAction.newRoot.type !== 'NONE';
|
|
88
|
+
protected isNonEmptyModelAction(action: Action): boolean {
|
|
89
|
+
if (isSetModelAction(action) || isUpdateModelAction(action)) {
|
|
90
|
+
return action.newRoot.type !== 'NONE';
|
|
92
91
|
}
|
|
93
92
|
return false;
|
|
94
93
|
}
|
|
@@ -30,7 +30,7 @@ import { MouseListener, SModelElement } from 'sprotty';
|
|
|
30
30
|
*/
|
|
31
31
|
@injectable()
|
|
32
32
|
export class SelectionClearingMouseListener extends MouseListener {
|
|
33
|
-
mouseDown(_target: SModelElement, event: MouseEvent): never[] {
|
|
33
|
+
override mouseDown(_target: SModelElement, event: MouseEvent): never[] {
|
|
34
34
|
const selection = document.getSelection();
|
|
35
35
|
// eslint-disable-next-line no-null/no-null
|
|
36
36
|
if (selection === null) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -28,8 +28,8 @@ export interface IGLSPToolManager extends ToolManager {
|
|
|
28
28
|
export class GLSPToolManager extends ToolManager implements IGLSPToolManager, EditModeListener {
|
|
29
29
|
protected editorContext?: EditorContextService;
|
|
30
30
|
|
|
31
|
-
@multiInject(GLSP_TYPES.ITool) @optional() tools: Tool[];
|
|
32
|
-
@multiInject(GLSP_TYPES.IDefaultTool) @optional() defaultTools: Tool[];
|
|
31
|
+
@multiInject(GLSP_TYPES.ITool) @optional() override tools: Tool[];
|
|
32
|
+
@multiInject(GLSP_TYPES.IDefaultTool) @optional() override defaultTools: Tool[];
|
|
33
33
|
@inject(GLSP_TYPES.IEditorContextServiceProvider) contextServiceProvider: EditorContextServiceProvider;
|
|
34
34
|
|
|
35
35
|
@postConstruct()
|
|
@@ -43,19 +43,19 @@ export class GLSPToolManager extends ToolManager implements IGLSPToolManager, Ed
|
|
|
43
43
|
});
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
registerDefaultTools(...tools: Tool[]): void {
|
|
46
|
+
override registerDefaultTools(...tools: Tool[]): void {
|
|
47
47
|
for (const tool of tools) {
|
|
48
48
|
distinctAdd(this.defaultTools, tool);
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
|
|
52
|
-
registerTools(...tools: Tool[]): void {
|
|
52
|
+
override registerTools(...tools: Tool[]): void {
|
|
53
53
|
for (const tool of tools) {
|
|
54
54
|
distinctAdd(this.tools, tool);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
-
enable(toolIds: string[]): void {
|
|
58
|
+
override enable(toolIds: string[]): void {
|
|
59
59
|
this.disableActiveTools();
|
|
60
60
|
let tools = toolIds.map(id => this.tool(id));
|
|
61
61
|
if (this.editorContext && this.editorContext.isReadonly) {
|
|
@@ -90,6 +90,6 @@ export interface GLSPTool extends Tool {
|
|
|
90
90
|
isEditTool: boolean;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
-
export function isGLSPTool(tool:
|
|
93
|
+
export function isGLSPTool(tool: any): tool is GLSPTool {
|
|
94
94
|
return 'isEditTool' in tool && typeof tool['isEditTool'] === 'boolean';
|
|
95
95
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-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
|
|
@@ -18,7 +18,7 @@ import { IView, ViewRegistry } from 'sprotty';
|
|
|
18
18
|
|
|
19
19
|
@injectable()
|
|
20
20
|
export class GLSPViewRegistry extends ViewRegistry {
|
|
21
|
-
register(key: string, instance: IView): void {
|
|
21
|
+
override register(key: string, instance: IView): void {
|
|
22
22
|
if (key === undefined) {
|
|
23
23
|
throw new Error('Key is undefined');
|
|
24
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -51,14 +51,14 @@ export class SResizeHandle extends SChildElement implements Hoverable {
|
|
|
51
51
|
static readonly TYPE = 'resize-handle';
|
|
52
52
|
|
|
53
53
|
constructor(
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
54
|
+
readonly location?: ResizeHandleLocation,
|
|
55
|
+
override readonly type: string = SResizeHandle.TYPE,
|
|
56
|
+
readonly hoverFeedback: boolean = false
|
|
57
57
|
) {
|
|
58
58
|
super();
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
hasFeature(feature: symbol): boolean {
|
|
61
|
+
override hasFeature(feature: symbol): boolean {
|
|
62
62
|
return feature === hoverFeedbackFeature;
|
|
63
63
|
}
|
|
64
64
|
|
|
@@ -37,7 +37,7 @@ export class SelectionServiceAwareContextMenuMouseListener extends MouseListener
|
|
|
37
37
|
/**
|
|
38
38
|
* Opens the context menu on right-click.
|
|
39
39
|
*/
|
|
40
|
-
mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
|
|
40
|
+
override mouseDown(target: SModelElement, event: MouseEvent): (Action | Promise<Action>)[] {
|
|
41
41
|
if (event.button === 2 && this.contextMenuService && this.menuProvider) {
|
|
42
42
|
return this.openContextMenu(event, target);
|
|
43
43
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
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
|
|
@@ -21,7 +21,7 @@ import { Decoration, DecorationPlacer, isSizeable, ORIGIN_POINT, SChildElement,
|
|
|
21
21
|
export class GlspDecorationPlacer extends DecorationPlacer {
|
|
22
22
|
protected static readonly DECORATION_OFFSET: Point = { x: 12, y: 10 };
|
|
23
23
|
|
|
24
|
-
protected getPosition(element: SModelElement & Decoration): Point {
|
|
24
|
+
protected override getPosition(element: SModelElement & Decoration): Point {
|
|
25
25
|
if (element instanceof SChildElement && element.parent instanceof SRoutableElement) {
|
|
26
26
|
return super.getPosition(element);
|
|
27
27
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -48,7 +48,7 @@ export class ApplyTypeHintsAction implements Action {
|
|
|
48
48
|
@injectable()
|
|
49
49
|
export class ApplyTypeHintsCommand extends FeedbackCommand {
|
|
50
50
|
public static KIND = 'applyTypeHints';
|
|
51
|
-
public readonly priority = 10;
|
|
51
|
+
public override readonly priority = 10;
|
|
52
52
|
|
|
53
53
|
@inject(GLSP_TYPES.ITypeHintProvider) protected typeHintProvider: ITypeHintProvider;
|
|
54
54
|
|
|
@@ -53,7 +53,7 @@ export class GlspHoverMouseListener extends HoverMouseListener implements IActio
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
protected startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action> {
|
|
56
|
+
protected override startMouseOverTimer(target: SModelElement, event: MouseEvent): Promise<Action> {
|
|
57
57
|
this.stopMouseOverTimer();
|
|
58
58
|
return new Promise(resolve => {
|
|
59
59
|
this.state.mouseOverTimer = window.setTimeout(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-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
|
|
@@ -35,7 +35,7 @@ import { AbstractLayoutOptions } from 'sprotty/lib/features/bounds/layout-option
|
|
|
35
35
|
export class FreeFormLayouter extends AbstractLayout<AbstractLayoutOptions> {
|
|
36
36
|
static KIND = 'freeform';
|
|
37
37
|
|
|
38
|
-
layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void {
|
|
38
|
+
override layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void {
|
|
39
39
|
const boundsData = layouter.getBoundsData(container);
|
|
40
40
|
const options = this.getLayoutOptions(container);
|
|
41
41
|
const childrenSize = this.getChildrenSize(container, options, layouter);
|
|
@@ -97,7 +97,7 @@ export class FreeFormLayouter extends AbstractLayout<AbstractLayoutOptions> {
|
|
|
97
97
|
return currentOffset;
|
|
98
98
|
}
|
|
99
99
|
|
|
100
|
-
protected getFinalContainerBounds(
|
|
100
|
+
protected override getFinalContainerBounds(
|
|
101
101
|
container: SParentElement & LayoutContainer,
|
|
102
102
|
lastOffset: Point,
|
|
103
103
|
options: AbstractLayoutOptions,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -166,10 +166,10 @@ export class ResizeElementsCommand extends LayoutElementsCommand {
|
|
|
166
166
|
static readonly KIND = 'layout:resize';
|
|
167
167
|
|
|
168
168
|
constructor(
|
|
169
|
-
@inject(TYPES.Action) protected action: ResizeElementsAction,
|
|
170
|
-
@inject(TYPES.IActionDispatcher) protected actionDispatcher: IActionDispatcher,
|
|
171
|
-
@inject(GLSP_TYPES.SelectionService) protected selectionService: SelectionService,
|
|
172
|
-
@inject(GLSP_TYPES.IMovementRestrictor) @optional() readonly movementRestrictor?: IMovementRestrictor
|
|
169
|
+
@inject(TYPES.Action) protected override action: ResizeElementsAction,
|
|
170
|
+
@inject(TYPES.IActionDispatcher) protected override actionDispatcher: IActionDispatcher,
|
|
171
|
+
@inject(GLSP_TYPES.SelectionService) protected override selectionService: SelectionService,
|
|
172
|
+
@inject(GLSP_TYPES.IMovementRestrictor) @optional() override readonly movementRestrictor?: IMovementRestrictor
|
|
173
173
|
) {
|
|
174
174
|
super(action, actionDispatcher, selectionService, movementRestrictor);
|
|
175
175
|
}
|
|
@@ -280,10 +280,10 @@ export class AlignElementsCommand extends LayoutElementsCommand {
|
|
|
280
280
|
static readonly KIND = 'layout:align';
|
|
281
281
|
|
|
282
282
|
constructor(
|
|
283
|
-
@inject(TYPES.Action) protected action: AlignElementsAction,
|
|
284
|
-
@inject(TYPES.IActionDispatcher) protected actionDispatcher: IActionDispatcher,
|
|
285
|
-
@inject(GLSP_TYPES.SelectionService) protected selectionService: SelectionService,
|
|
286
|
-
@inject(GLSP_TYPES.IMovementRestrictor) @optional() readonly movementRestrictor?: IMovementRestrictor
|
|
283
|
+
@inject(TYPES.Action) protected override action: AlignElementsAction,
|
|
284
|
+
@inject(TYPES.IActionDispatcher) protected override actionDispatcher: IActionDispatcher,
|
|
285
|
+
@inject(GLSP_TYPES.SelectionService) protected override selectionService: SelectionService,
|
|
286
|
+
@inject(GLSP_TYPES.IMovementRestrictor) @optional() override readonly movementRestrictor?: IMovementRestrictor
|
|
287
287
|
) {
|
|
288
288
|
super(action, actionDispatcher, selectionService, movementRestrictor);
|
|
289
289
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-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
|
|
@@ -44,9 +44,9 @@ export interface VBoxLayoutOptionsExt extends VBoxLayoutOptions {
|
|
|
44
44
|
*/
|
|
45
45
|
@injectable()
|
|
46
46
|
export class VBoxLayouterExt extends VBoxLayouter {
|
|
47
|
-
static KIND = VBoxLayouter.KIND;
|
|
47
|
+
static override KIND = VBoxLayouter.KIND;
|
|
48
48
|
|
|
49
|
-
layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void {
|
|
49
|
+
override layout(container: SParentElement & LayoutContainer, layouter: StatefulLayouter): void {
|
|
50
50
|
const boundsData = layouter.getBoundsData(container);
|
|
51
51
|
const options = this.getLayoutOptions(container);
|
|
52
52
|
const childrenSize = this.getChildrenSize(container, options, layouter);
|
|
@@ -80,7 +80,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
80
80
|
}
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
protected getChildrenSize(
|
|
83
|
+
protected override getChildrenSize(
|
|
84
84
|
container: SParentElement & LayoutContainer,
|
|
85
85
|
containerOptions: VBoxLayoutOptionsExt,
|
|
86
86
|
layouter: StatefulLayouter
|
|
@@ -109,7 +109,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
109
109
|
return result;
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
protected layoutChildren(
|
|
112
|
+
protected override layoutChildren(
|
|
113
113
|
container: SParentElement & LayoutContainer,
|
|
114
114
|
layouter: StatefulLayouter,
|
|
115
115
|
containerOptions: VBoxLayoutOptionsExt,
|
|
@@ -147,7 +147,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
147
147
|
return currentOffset;
|
|
148
148
|
}
|
|
149
149
|
|
|
150
|
-
protected layoutChild(
|
|
150
|
+
protected override layoutChild(
|
|
151
151
|
child: SChildElement,
|
|
152
152
|
boundsData: BoundsData,
|
|
153
153
|
bounds: Bounds,
|
|
@@ -183,7 +183,11 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
183
183
|
return offset;
|
|
184
184
|
}
|
|
185
185
|
|
|
186
|
-
protected getFixedContainerBounds(
|
|
186
|
+
protected override getFixedContainerBounds(
|
|
187
|
+
container: SModelElement,
|
|
188
|
+
layoutOptions: VBoxLayoutOptionsExt,
|
|
189
|
+
layouter: StatefulLayouter
|
|
190
|
+
): Bounds {
|
|
187
191
|
const currentContainer = container;
|
|
188
192
|
// eslint-disable-next-line no-constant-condition
|
|
189
193
|
if (isBoundsAware(currentContainer)) {
|
|
@@ -196,11 +200,11 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
196
200
|
return EMPTY_BOUNDS;
|
|
197
201
|
}
|
|
198
202
|
|
|
199
|
-
protected getChildLayoutOptions(child: SChildElement, containerOptions: VBoxLayoutOptionsExt): VBoxLayoutOptionsExt {
|
|
203
|
+
protected override getChildLayoutOptions(child: SChildElement, containerOptions: VBoxLayoutOptionsExt): VBoxLayoutOptionsExt {
|
|
200
204
|
return super.getChildLayoutOptions(child, containerOptions) as VBoxLayoutOptionsExt;
|
|
201
205
|
}
|
|
202
206
|
|
|
203
|
-
protected getLayoutOptions(element: SModelElement): VBoxLayoutOptionsExt {
|
|
207
|
+
protected override getLayoutOptions(element: SModelElement): VBoxLayoutOptionsExt {
|
|
204
208
|
return super.getLayoutOptions(element) as VBoxLayoutOptionsExt;
|
|
205
209
|
}
|
|
206
210
|
|
|
@@ -208,7 +212,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
208
212
|
return (element as any).layoutOptions;
|
|
209
213
|
}
|
|
210
214
|
|
|
211
|
-
protected getFinalContainerBounds(
|
|
215
|
+
protected override getFinalContainerBounds(
|
|
212
216
|
container: SParentElement & LayoutContainer,
|
|
213
217
|
lastOffset: Point,
|
|
214
218
|
options: VBoxLayoutOptionsExt,
|
|
@@ -229,7 +233,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
229
233
|
return result;
|
|
230
234
|
}
|
|
231
235
|
|
|
232
|
-
protected getDefaultLayoutOptions(): VBoxLayoutOptionsExt {
|
|
236
|
+
protected override getDefaultLayoutOptions(): VBoxLayoutOptionsExt {
|
|
233
237
|
return {
|
|
234
238
|
resizeContainer: true,
|
|
235
239
|
paddingTop: 5,
|
|
@@ -250,7 +254,7 @@ export class VBoxLayouterExt extends VBoxLayouter {
|
|
|
250
254
|
};
|
|
251
255
|
}
|
|
252
256
|
|
|
253
|
-
protected spread(a: VBoxLayoutOptionsExt, b: VBoxLayoutOptionsExt): VBoxLayoutOptionsExt {
|
|
257
|
+
protected override spread(a: VBoxLayoutOptionsExt, b: VBoxLayoutOptionsExt): VBoxLayoutOptionsExt {
|
|
254
258
|
return { ...a, ...b };
|
|
255
259
|
}
|
|
256
260
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Action, isAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { injectable, multiInject, optional } from 'inversify';
|
|
18
|
-
import { On, VNode, VNodeData } from 'snabbdom';
|
|
19
18
|
import { MouseListener, MouseTool, SModelElement, SModelRoot, TYPES } from 'sprotty';
|
|
20
19
|
import { getRank } from '../rank/model';
|
|
21
20
|
|
|
@@ -24,48 +23,36 @@ export interface IMouseTool {
|
|
|
24
23
|
deregister(mouseListener: MouseListener): void;
|
|
25
24
|
}
|
|
26
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Custom helper type to declare the explicit mouse listener methods
|
|
28
|
+
* of {@link MouseListener} i.e. omitting the `decorate` method.
|
|
29
|
+
*/
|
|
30
|
+
type MouseListenerMethods = keyof Omit<MouseListener, 'decorate'>;
|
|
31
|
+
|
|
27
32
|
@injectable()
|
|
28
33
|
export class RankingMouseTool extends MouseTool implements IMouseTool {
|
|
29
34
|
protected rankedMouseListeners: Map<number, MouseListener[]>;
|
|
30
35
|
|
|
31
|
-
constructor(@multiInject(TYPES.MouseListener) @optional() protected mouseListeners: MouseListener[] = []) {
|
|
36
|
+
constructor(@multiInject(TYPES.MouseListener) @optional() protected override mouseListeners: MouseListener[] = []) {
|
|
32
37
|
super(mouseListeners);
|
|
33
38
|
this.rankedMouseListeners = groupBy(mouseListeners, listener => getRank(listener));
|
|
34
39
|
}
|
|
35
40
|
|
|
36
|
-
register(mouseListener: MouseListener): void {
|
|
41
|
+
override register(mouseListener: MouseListener): void {
|
|
37
42
|
super.register(mouseListener);
|
|
38
43
|
this.rankedMouseListeners = groupBy(this.mouseListeners, listener => getRank(listener));
|
|
39
44
|
}
|
|
40
45
|
|
|
41
|
-
deregister(mouseListener: MouseListener): void {
|
|
46
|
+
override deregister(mouseListener: MouseListener): void {
|
|
42
47
|
super.deregister(mouseListener);
|
|
43
48
|
this.rankedMouseListeners = groupBy(this.mouseListeners, listener => getRank(listener));
|
|
44
49
|
}
|
|
45
50
|
|
|
46
|
-
decorate(vnode: VNode, element: SModelElement): VNode {
|
|
47
|
-
// we need to overwrite the existing event handlers registered by the original mouse tool
|
|
48
|
-
if (element instanceof SModelRoot) {
|
|
49
|
-
overwriteOn(vnode, 'mouseover', this.mouseOver.bind(this, element), element);
|
|
50
|
-
overwriteOn(vnode, 'mouseout', this.mouseOut.bind(this, element), element);
|
|
51
|
-
overwriteOn(vnode, 'mouseenter', this.mouseEnter.bind(this, element), element);
|
|
52
|
-
overwriteOn(vnode, 'mouseleave', this.mouseLeave.bind(this, element), element);
|
|
53
|
-
overwriteOn(vnode, 'mousedown', this.mouseDown.bind(this, element), element);
|
|
54
|
-
overwriteOn(vnode, 'mouseup', this.mouseUp.bind(this, element), element);
|
|
55
|
-
overwriteOn(vnode, 'mousemove', this.mouseMove.bind(this, element), element);
|
|
56
|
-
overwriteOn(vnode, 'wheel', this.wheel.bind(this, element), element);
|
|
57
|
-
overwriteOn(vnode, 'contextmenu', this.contextMenu.bind(this, element), element);
|
|
58
|
-
overwriteOn(vnode, 'dblclick', this.doubleClick.bind(this, element), element);
|
|
59
|
-
}
|
|
60
|
-
vnode = this.mouseListeners.reduce((n: VNode, listener: MouseListener) => listener.decorate(n, element), vnode);
|
|
61
|
-
return vnode;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
51
|
contextMenu(model: SModelRoot, event: MouseEvent): void {
|
|
65
52
|
event.preventDefault();
|
|
66
53
|
}
|
|
67
54
|
|
|
68
|
-
protected handleEvent<K extends
|
|
55
|
+
protected override handleEvent<K extends MouseListenerMethods>(methodName: K, model: SModelRoot, event: MouseEvent): void {
|
|
69
56
|
this.focusOnMouseEvent(methodName, model);
|
|
70
57
|
const element = this.getTargetElement(model, event);
|
|
71
58
|
if (!element) {
|
|
@@ -74,7 +61,7 @@ export class RankingMouseTool extends MouseTool implements IMouseTool {
|
|
|
74
61
|
this.notifyListenersByRank(element, methodName, model, event);
|
|
75
62
|
}
|
|
76
63
|
|
|
77
|
-
async notifyListenersByRank<K extends
|
|
64
|
+
async notifyListenersByRank<K extends MouseListenerMethods>(
|
|
78
65
|
element: SModelElement,
|
|
79
66
|
methodName: K,
|
|
80
67
|
model: SModelRoot,
|
|
@@ -85,15 +72,13 @@ export class RankingMouseTool extends MouseTool implements IMouseTool {
|
|
|
85
72
|
}
|
|
86
73
|
}
|
|
87
74
|
|
|
88
|
-
async dispatchActions<K extends
|
|
75
|
+
async dispatchActions<K extends MouseListenerMethods>(
|
|
89
76
|
mouseListeners: MouseListener[],
|
|
90
77
|
methodName: K,
|
|
91
78
|
element: SModelElement,
|
|
92
79
|
event: MouseEvent
|
|
93
80
|
): Promise<void> {
|
|
94
|
-
const actions = mouseListeners
|
|
95
|
-
.map(listener => listener[methodName].apply(listener, [element, event]))
|
|
96
|
-
.reduce((a, b) => a.concat(b));
|
|
81
|
+
const actions = mouseListeners.map(listener => listener[methodName](element, event as WheelEvent)).reduce((a, b) => a.concat(b));
|
|
97
82
|
if (actions.length > 0) {
|
|
98
83
|
event.preventDefault();
|
|
99
84
|
for (const actionOrPromise of actions) {
|
|
@@ -124,24 +109,3 @@ function groupBy<K, T>(array: Array<T>, keyFunction: (x: T) => K): Map<K, T[]> {
|
|
|
124
109
|
}, new Map<K, T[]>());
|
|
125
110
|
return new Map<K, T[]>([...unsortedMap.entries()].sort());
|
|
126
111
|
}
|
|
127
|
-
|
|
128
|
-
function overwriteOn(vnode: VNode, event: string, listener: (model: SModelElement, _event: Event) => void, element: SModelElement): void {
|
|
129
|
-
const val = getOn(vnode);
|
|
130
|
-
// ignore any previous val[event] registrations
|
|
131
|
-
(val as any)[event] = [listener, element];
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function getOn(vnode: VNode): On {
|
|
135
|
-
const data = getData(vnode);
|
|
136
|
-
if (!data.on) {
|
|
137
|
-
data.on = {};
|
|
138
|
-
}
|
|
139
|
-
return data.on;
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function getData(vnode: VNode): VNodeData {
|
|
143
|
-
if (!vnode.data) {
|
|
144
|
-
vnode.data = {};
|
|
145
|
-
}
|
|
146
|
-
return vnode.data;
|
|
147
|
-
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -69,7 +69,7 @@ export function createReconnectHandle(edge: SRoutableElement, kind: RoutingHandl
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
export class SReconnectHandle extends SRoutingHandle {
|
|
72
|
-
hasFeature(feature: symbol): boolean {
|
|
72
|
+
override hasFeature(feature: symbol): boolean {
|
|
73
73
|
return feature !== selectFeature && super.hasFeature(feature);
|
|
74
74
|
}
|
|
75
75
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -18,7 +18,7 @@ import { KeyListener, SModelRoot } from 'sprotty';
|
|
|
18
18
|
import { matchesKeystroke } from 'sprotty/lib/utils/keyboard';
|
|
19
19
|
|
|
20
20
|
export class SaveModelKeyboardListener extends KeyListener {
|
|
21
|
-
keyDown(_element: SModelRoot, event: KeyboardEvent): Action[] {
|
|
21
|
+
override keyDown(_element: SModelRoot, event: KeyboardEvent): Action[] {
|
|
22
22
|
if (matchesKeystroke(event, 'KeyS', 'ctrlCmd')) {
|
|
23
23
|
return [new SaveModelAction()];
|
|
24
24
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-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
|
|
@@ -20,8 +20,8 @@ import {
|
|
|
20
20
|
CommandExecutionContext,
|
|
21
21
|
ILogger,
|
|
22
22
|
isSelectable,
|
|
23
|
-
isSelected,
|
|
24
23
|
SChildElement,
|
|
24
|
+
Selectable,
|
|
25
25
|
SelectAllCommand as SprottySelectAllCommand,
|
|
26
26
|
SelectCommand as SprottySelectCommand,
|
|
27
27
|
SModelElement,
|
|
@@ -31,6 +31,7 @@ import {
|
|
|
31
31
|
} from 'sprotty';
|
|
32
32
|
import { SModelRootListener } from '../../base/model/update-model-command';
|
|
33
33
|
import { GLSP_TYPES } from '../../base/types';
|
|
34
|
+
import { getMatchingElements } from '../../utils/smodel-util';
|
|
34
35
|
import { IFeedbackActionDispatcher } from '../tool-feedback/feedback-action-dispatcher';
|
|
35
36
|
import { SelectFeedbackAction } from './select-feedback-action';
|
|
36
37
|
|
|
@@ -122,8 +123,8 @@ export class SelectionService implements SModelRootListener {
|
|
|
122
123
|
return this.root;
|
|
123
124
|
}
|
|
124
125
|
|
|
125
|
-
getSelectedElements(): Readonly<SModelElement>[] {
|
|
126
|
-
return
|
|
126
|
+
getSelectedElements(): Readonly<SModelElement & Selectable>[] {
|
|
127
|
+
return getMatchingElements(this.root.index, isSelectable);
|
|
127
128
|
}
|
|
128
129
|
|
|
129
130
|
/**
|