@eclipse-glsp/client 2.7.0-next.1 → 2.7.0-next.12
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.map +1 -1
- package/lib/base/action-dispatcher.js +9 -3
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/auto-complete/auto-complete-widget.d.ts +1 -1
- package/lib/base/auto-complete/auto-complete-widget.js +3 -5
- package/lib/base/auto-complete/auto-complete-widget.js.map +1 -1
- package/lib/base/auto-complete/validation-decorator.d.ts +1 -1
- package/lib/base/auto-complete/validation-decorator.d.ts.map +1 -1
- package/lib/base/auto-complete/validation-decorator.js +1 -4
- package/lib/base/auto-complete/validation-decorator.js.map +1 -1
- package/lib/base/default.module.d.ts +1 -1
- package/lib/base/default.module.d.ts.map +1 -1
- package/lib/base/default.module.js +4 -2
- package/lib/base/default.module.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +4 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +11 -1
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.d.ts +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +2 -4
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/feedback/feedback-command.d.ts +1 -1
- package/lib/base/feedback/feedback-command.js +2 -2
- package/lib/base/feedback/feedback-command.js.map +1 -1
- package/lib/base/focus/focus-tracker.d.ts +1 -1
- package/lib/base/focus/focus-tracker.js +1 -1
- package/lib/base/model/glsp-model-source.d.ts +5 -2
- package/lib/base/model/glsp-model-source.d.ts.map +1 -1
- package/lib/base/model/glsp-model-source.js +28 -1
- package/lib/base/model/glsp-model-source.js.map +1 -1
- package/lib/base/model/model-change-service.d.ts +1 -1
- package/lib/base/model/model-change-service.js +1 -1
- package/lib/base/selection-service.d.ts +4 -3
- package/lib/base/selection-service.d.ts.map +1 -1
- package/lib/base/selection-service.js +6 -1
- package/lib/base/selection-service.js.map +1 -1
- package/lib/base/ui-extension/ui-extension.d.ts +1 -1
- package/lib/base/ui-extension/ui-extension.js +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.d.ts +1 -1
- package/lib/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.js +1 -1
- package/lib/features/bounds/bounds-module.d.ts +1 -1
- package/lib/features/bounds/bounds-module.js +2 -2
- package/lib/features/bounds/bounds-module.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +1 -1
- package/lib/features/bounds/hbox-layout.d.ts +1 -1
- package/lib/features/bounds/hbox-layout.js +1 -2
- package/lib/features/bounds/hbox-layout.js.map +1 -1
- package/lib/features/bounds/vbox-layout.d.ts +1 -1
- package/lib/features/bounds/vbox-layout.js +1 -2
- package/lib/features/bounds/vbox-layout.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 +1 -2
- package/lib/features/change-bounds/model.js.map +1 -1
- package/lib/features/change-bounds/point-position-updater.d.ts +1 -1
- package/lib/features/change-bounds/point-position-updater.js +3 -4
- package/lib/features/change-bounds/point-position-updater.js.map +1 -1
- package/lib/features/change-bounds/snap.d.ts +1 -1
- package/lib/features/change-bounds/snap.js +15 -0
- package/lib/features/change-bounds/snap.js.map +1 -1
- package/lib/features/command-palette/command-palette.d.ts +1 -1
- package/lib/features/command-palette/command-palette.js +1 -1
- package/lib/features/context-menu/context-menu-module.d.ts +1 -1
- package/lib/features/context-menu/context-menu-module.js +1 -2
- package/lib/features/context-menu/context-menu-module.js.map +1 -1
- package/lib/features/context-menu/delete-element-context-menu.d.ts +1 -1
- package/lib/features/context-menu/delete-element-context-menu.js +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.d.ts +1 -1
- package/lib/features/copy-paste/copy-paste-context-menu.js +2 -2
- package/lib/features/copy-paste/copy-paste-context-menu.js.map +1 -1
- package/lib/features/debug/debug-bounds-decorator.d.ts +1 -1
- package/lib/features/debug/debug-bounds-decorator.js +12 -13
- package/lib/features/debug/debug-bounds-decorator.js.map +1 -1
- package/lib/features/label-edit-ui/label-edit-ui.d.ts +4 -1
- package/lib/features/label-edit-ui/label-edit-ui.d.ts.map +1 -1
- package/lib/features/label-edit-ui/label-edit-ui.js +38 -1
- package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -1
- package/lib/features/navigation/navigation-action-handler.d.ts +1 -1
- package/lib/features/navigation/navigation-action-handler.js +1 -1
- package/lib/features/routing/edge-router.d.ts +2 -1
- package/lib/features/routing/edge-router.d.ts.map +1 -1
- package/lib/features/routing/edge-router.js +2 -1
- package/lib/features/routing/edge-router.js.map +1 -1
- package/lib/features/routing/routing-module.d.ts +1 -1
- package/lib/features/routing/routing-module.d.ts.map +1 -1
- package/lib/features/routing/routing-module.js +7 -1
- package/lib/features/routing/routing-module.js.map +1 -1
- package/lib/features/routing/sticky-manhattan-anchors.d.ts +29 -0
- package/lib/features/routing/sticky-manhattan-anchors.d.ts.map +1 -0
- package/lib/features/routing/sticky-manhattan-anchors.js +62 -0
- package/lib/features/routing/sticky-manhattan-anchors.js.map +1 -0
- package/lib/features/routing/sticky-manhattan-edge-router.d.ts +107 -0
- package/lib/features/routing/sticky-manhattan-edge-router.d.ts.map +1 -0
- package/lib/features/routing/sticky-manhattan-edge-router.js +626 -0
- package/lib/features/routing/sticky-manhattan-edge-router.js.map +1 -0
- package/lib/features/select/select-module.d.ts +1 -1
- package/lib/features/select/select-module.js +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 +1 -3
- package/lib/features/tool-palette/tool-palette.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +5 -1
- package/lib/index.js.map +1 -1
- package/lib/views/gedge-view-with-gaps-on-intersections.d.ts +39 -0
- package/lib/views/gedge-view-with-gaps-on-intersections.d.ts.map +1 -0
- package/lib/views/gedge-view-with-gaps-on-intersections.js +85 -0
- package/lib/views/gedge-view-with-gaps-on-intersections.js.map +1 -0
- package/lib/views/issue-marker-view.d.ts +1 -1
- package/lib/views/issue-marker-view.js +9 -10
- package/lib/views/issue-marker-view.js.map +1 -1
- package/lib/views/rounded-corner-manhattan-edge-view.d.ts +58 -0
- package/lib/views/rounded-corner-manhattan-edge-view.d.ts.map +1 -0
- package/lib/views/rounded-corner-manhattan-edge-view.js +170 -0
- package/lib/views/rounded-corner-manhattan-edge-view.js.map +1 -0
- package/package.json +4 -4
- package/src/base/action-dispatcher.spec.ts +2 -2
- package/src/base/action-dispatcher.ts +7 -4
- package/src/base/auto-complete/auto-complete-widget.ts +3 -3
- package/src/base/auto-complete/validation-decorator.ts +3 -4
- package/src/base/default.module.ts +6 -2
- package/src/base/editor-context-service.ts +17 -5
- package/src/base/feedback/feedback-action-dispatcher.ts +2 -2
- package/src/base/feedback/feedback-command.ts +2 -2
- package/src/base/focus/focus-tracker.ts +1 -1
- package/src/base/model/glsp-model-source.ts +35 -1
- package/src/base/model/model-change-service.ts +1 -1
- package/src/base/model/model-initialization-constraint.spec.ts +2 -2
- package/src/base/selection-service.spec.ts +3 -4
- package/src/base/selection-service.ts +11 -2
- package/src/base/ui-extension/ui-extension.ts +1 -1
- package/src/default-modules.spec.ts +2 -2
- package/src/features/accessibility/keyboard-tool-palette/keyboard-tool-palette.ts +1 -1
- package/src/features/bounds/bounds-module.ts +2 -2
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +1 -1
- package/src/features/bounds/hbox-layout.spec.ts +2 -2
- package/src/features/bounds/hbox-layout.ts +2 -2
- package/src/features/bounds/vbox-layout.spec.ts +2 -2
- package/src/features/bounds/vbox-layout.ts +2 -2
- package/src/features/change-bounds/model.ts +1 -2
- package/src/features/change-bounds/point-position-updater.spec.ts +3 -3
- package/src/features/change-bounds/point-position-updater.ts +4 -4
- package/src/features/change-bounds/snap.ts +2 -2
- package/src/features/command-palette/command-palette.ts +1 -1
- package/src/features/context-menu/context-menu-module.ts +2 -2
- package/src/features/context-menu/delete-element-context-menu.ts +2 -2
- package/src/features/copy-paste/copy-paste-context-menu.ts +2 -2
- package/src/features/debug/debug-bounds-decorator.tsx +2 -2
- package/src/features/label-edit-ui/label-edit-ui.ts +36 -3
- package/src/features/layout/layout-elements-action.spec.ts +2 -2
- package/src/features/navigation/navigation-action-handler.ts +3 -3
- package/src/features/routing/edge-router.ts +2 -2
- package/src/features/routing/routing-module.ts +8 -1
- package/src/features/routing/sticky-manhattan-anchors.ts +53 -0
- package/src/features/routing/sticky-manhattan-edge-router.spec.ts +212 -0
- package/src/features/routing/sticky-manhattan-edge-router.ts +713 -0
- package/src/features/select/select-module.ts +1 -1
- package/src/features/tool-palette/tool-palette.ts +1 -3
- package/src/index.ts +5 -1
- package/src/views/gedge-view-with-gaps-on-intersections.tsx +99 -0
- package/src/views/issue-marker-view.tsx +2 -2
- package/src/views/rounded-corner-manhattan-edge-view.ts +171 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.RoundedCornerManhattanEdgeView = void 0;
|
|
10
|
+
/********************************************************************************
|
|
11
|
+
* Copyright (c) 2022-2026 Imixs Software Solutions GmbH.
|
|
12
|
+
* Copyright (c) 2026 EclipseSource and others.
|
|
13
|
+
*
|
|
14
|
+
* This program and the accompanying materials are made available under the
|
|
15
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
16
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
17
|
+
*
|
|
18
|
+
* This Source Code may also be made available under the following Secondary
|
|
19
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
20
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
21
|
+
* with the GNU Classpath Exception which is available at
|
|
22
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
23
|
+
*
|
|
24
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
25
|
+
********************************************************************************/
|
|
26
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
27
|
+
const inversify_1 = require("inversify");
|
|
28
|
+
const gedge_view_with_gaps_on_intersections_1 = require("./gedge-view-with-gaps-on-intersections");
|
|
29
|
+
/**
|
|
30
|
+
* Manhattan edge view with rounded bends rendered as quadratic Béziers.
|
|
31
|
+
* Non-orthogonal inputs render as sharp corners. Radius is clamped per corner;
|
|
32
|
+
* override {@link cornerRadius} or {@link computeMaxRadius} to tune.
|
|
33
|
+
*
|
|
34
|
+
* Inherits gap / line-jump rendering from {@link GEdgeViewWithGapsOnIntersections}.
|
|
35
|
+
* The rendered line splices intersection fragments between points; the mouse-
|
|
36
|
+
* handle overlay skips them so the hit area stays contiguous.
|
|
37
|
+
*
|
|
38
|
+
* Based on Ralph Soika's `BPMNEdgeView`; see
|
|
39
|
+
* https://github.com/eclipse-glsp/glsp/discussions/1642.
|
|
40
|
+
*/
|
|
41
|
+
let RoundedCornerManhattanEdgeView = class RoundedCornerManhattanEdgeView extends gedge_view_with_gaps_on_intersections_1.GEdgeViewWithGapsOnIntersections {
|
|
42
|
+
constructor() {
|
|
43
|
+
super(...arguments);
|
|
44
|
+
/** Target corner radius in pixels. The effective radius is clamped per corner. */
|
|
45
|
+
this.cornerRadius = 10;
|
|
46
|
+
/** Lower bound for the effective radius, even on very short adjacent segments. */
|
|
47
|
+
this.minCornerRadius = 2;
|
|
48
|
+
/** Upper fraction of the shorter adjacent segment to use for the radius. */
|
|
49
|
+
this.maxRadiusFactor = 0.45;
|
|
50
|
+
/** Segment length (px) below which {@link shortSegmentRadiusFactor} tightens the radius further. */
|
|
51
|
+
this.shortSegmentThreshold = 5;
|
|
52
|
+
/** Fraction of the shorter adjacent segment to use as the radius below {@link shortSegmentThreshold}. */
|
|
53
|
+
this.shortSegmentRadiusFactor = 0.3;
|
|
54
|
+
}
|
|
55
|
+
createPathForSegments(segments, edge, addIntersectionPoints, args) {
|
|
56
|
+
if (segments.length === 0) {
|
|
57
|
+
return '';
|
|
58
|
+
}
|
|
59
|
+
let path = `M ${segments[0].x},${segments[0].y}`;
|
|
60
|
+
for (let i = 1; i < segments.length; i++) {
|
|
61
|
+
const p = segments[i];
|
|
62
|
+
if (addIntersectionPoints && (0, sprotty_1.isIntersectingRoutedPoint)(p)) {
|
|
63
|
+
const effective = this.filterCornerZoneIntersections(p, segments, i);
|
|
64
|
+
if (effective.intersections.length > 0) {
|
|
65
|
+
path += this.intersectionPath(edge, segments, effective, args);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
if (i < segments.length - 1) {
|
|
69
|
+
const prev = segments[i - 1];
|
|
70
|
+
const next = segments[i + 1];
|
|
71
|
+
const radius = this.computeMaxRadius(p, prev, next);
|
|
72
|
+
path += this.renderRoundedCorner(p, prev, next, radius);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
path += ` L ${p.x},${p.y}`;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return path;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Drops intersections inside either endpoint's rounded-corner zone (padded
|
|
82
|
+
* by the gap's skip-offset). The gap fragment can't be placed there without
|
|
83
|
+
* drawing backward into the curve on one side, and the crossing is hidden
|
|
84
|
+
* behind the curve anyway.
|
|
85
|
+
*/
|
|
86
|
+
filterCornerZoneIntersections(intersectingPoint, segments, pointIndex) {
|
|
87
|
+
const p1 = segments[pointIndex - 1];
|
|
88
|
+
const p2 = segments[pointIndex];
|
|
89
|
+
const p1Threshold = this.getCornerRadius(segments, pointIndex - 1) + this.skipOffsetBefore;
|
|
90
|
+
const p2Threshold = this.getCornerRadius(segments, pointIndex) + this.skipOffsetAfter;
|
|
91
|
+
const filtered = intersectingPoint.intersections.filter(intersection => sprotty_1.Point.maxDistance(intersection.intersectionPoint, p1) > p1Threshold &&
|
|
92
|
+
sprotty_1.Point.maxDistance(intersection.intersectionPoint, p2) > p2Threshold);
|
|
93
|
+
return { ...intersectingPoint, intersections: filtered };
|
|
94
|
+
}
|
|
95
|
+
/** Curve radius at `segments[cornerIndex]`, or 0 for source / target. */
|
|
96
|
+
getCornerRadius(segments, cornerIndex) {
|
|
97
|
+
if (cornerIndex <= 0 || cornerIndex >= segments.length - 1) {
|
|
98
|
+
return 0;
|
|
99
|
+
}
|
|
100
|
+
const corner = segments[cornerIndex];
|
|
101
|
+
const prev = segments[cornerIndex - 1];
|
|
102
|
+
const next = segments[cornerIndex + 1];
|
|
103
|
+
return this.computeMaxRadius(corner, prev, next);
|
|
104
|
+
}
|
|
105
|
+
/** SVG fragment for one rounded corner; falls back to `L` if not a right angle. */
|
|
106
|
+
renderRoundedCorner(corner, prev, next, radius) {
|
|
107
|
+
// Round only right-angle bends; diagonal / collinear inputs render sharp.
|
|
108
|
+
const horizIn = sprotty_1.Point.isHorizontalAligned(prev, corner);
|
|
109
|
+
const vertIn = sprotty_1.Point.isVerticalAligned(prev, corner);
|
|
110
|
+
const horizOut = sprotty_1.Point.isHorizontalAligned(corner, next);
|
|
111
|
+
const vertOut = sprotty_1.Point.isVerticalAligned(corner, next);
|
|
112
|
+
const isRightAngle = (horizIn && vertOut && !vertIn) || (vertIn && horizOut && !horizIn);
|
|
113
|
+
if (!isRightAngle) {
|
|
114
|
+
return ` L ${corner.x},${corner.y}`;
|
|
115
|
+
}
|
|
116
|
+
if (prev.x < corner.x && corner.y < next.y) {
|
|
117
|
+
// right → down
|
|
118
|
+
return ` L ${corner.x - radius},${corner.y} Q ${corner.x},${corner.y} ${corner.x},${corner.y + radius}`;
|
|
119
|
+
}
|
|
120
|
+
if (prev.y < corner.y && corner.x < next.x) {
|
|
121
|
+
// down → right
|
|
122
|
+
return ` L ${corner.x},${corner.y - radius} Q ${corner.x},${corner.y} ${corner.x + radius},${corner.y}`;
|
|
123
|
+
}
|
|
124
|
+
if (prev.x < corner.x && corner.y > next.y) {
|
|
125
|
+
// right → up
|
|
126
|
+
return ` L ${corner.x - radius},${corner.y} Q ${corner.x},${corner.y} ${corner.x},${corner.y - radius}`;
|
|
127
|
+
}
|
|
128
|
+
if (prev.y > corner.y && corner.x < next.x) {
|
|
129
|
+
// up → right
|
|
130
|
+
return ` L ${corner.x},${corner.y + radius} Q ${corner.x},${corner.y} ${corner.x + radius},${corner.y}`;
|
|
131
|
+
}
|
|
132
|
+
if (prev.y < corner.y && corner.x > next.x) {
|
|
133
|
+
// down → left
|
|
134
|
+
return ` L ${corner.x},${corner.y - radius} Q ${corner.x},${corner.y} ${corner.x - radius},${corner.y}`;
|
|
135
|
+
}
|
|
136
|
+
if (prev.x > corner.x && corner.y < next.y) {
|
|
137
|
+
// left → down
|
|
138
|
+
return ` L ${corner.x + radius},${corner.y} Q ${corner.x},${corner.y} ${corner.x},${corner.y + radius}`;
|
|
139
|
+
}
|
|
140
|
+
if (prev.y > corner.y && corner.x > next.x) {
|
|
141
|
+
// up → left
|
|
142
|
+
return ` L ${corner.x},${corner.y + radius} Q ${corner.x},${corner.y} ${corner.x - radius},${corner.y}`;
|
|
143
|
+
}
|
|
144
|
+
if (prev.x > corner.x && corner.y > next.y) {
|
|
145
|
+
// left → up
|
|
146
|
+
return ` L ${corner.x + radius},${corner.y} Q ${corner.x},${corner.y} ${corner.x},${corner.y - radius}`;
|
|
147
|
+
}
|
|
148
|
+
return ` L ${corner.x},${corner.y}`;
|
|
149
|
+
}
|
|
150
|
+
/** Clamps {@link cornerRadius} to a fraction of the shorter adjacent segment. */
|
|
151
|
+
computeMaxRadius(corner, prev, next) {
|
|
152
|
+
const segBefore = sprotty_1.Point.maxDistance(corner, prev);
|
|
153
|
+
const segAfter = sprotty_1.Point.maxDistance(next, corner);
|
|
154
|
+
if (segBefore === 0 || segAfter === 0) {
|
|
155
|
+
return this.minCornerRadius;
|
|
156
|
+
}
|
|
157
|
+
const shortest = Math.min(segBefore, segAfter);
|
|
158
|
+
let radius = Math.min(this.cornerRadius, shortest * this.maxRadiusFactor);
|
|
159
|
+
if (shortest < this.shortSegmentThreshold) {
|
|
160
|
+
radius = Math.min(radius, shortest * this.shortSegmentRadiusFactor);
|
|
161
|
+
}
|
|
162
|
+
radius = Math.min(radius, shortest / 2);
|
|
163
|
+
return Math.max(this.minCornerRadius, radius);
|
|
164
|
+
}
|
|
165
|
+
};
|
|
166
|
+
exports.RoundedCornerManhattanEdgeView = RoundedCornerManhattanEdgeView;
|
|
167
|
+
exports.RoundedCornerManhattanEdgeView = RoundedCornerManhattanEdgeView = __decorate([
|
|
168
|
+
(0, inversify_1.injectable)()
|
|
169
|
+
], RoundedCornerManhattanEdgeView);
|
|
170
|
+
//# sourceMappingURL=rounded-corner-manhattan-edge-view.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rounded-corner-manhattan-edge-view.js","sourceRoot":"","sources":["../../src/views/rounded-corner-manhattan-edge-view.ts"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;;;;;;;;;kFAekF;AAClF,mDAA6G;AAC7G,yCAAuC;AAEvC,mGAA2F;AAE3F;;;;;;;;;;;GAWG;AAEI,IAAM,8BAA8B,GAApC,MAAM,8BAA+B,SAAQ,wEAAgC;IAA7E;;Q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|
"keywords": [
|
|
6
6
|
"eclipse",
|
|
@@ -39,14 +39,14 @@
|
|
|
39
39
|
"build": "tsc -b",
|
|
40
40
|
"clean": "rimraf lib *.tsbuildinfo coverage .nyc_output",
|
|
41
41
|
"generate:index": "glsp generateIndex src -f -s",
|
|
42
|
-
"lint": "eslint
|
|
42
|
+
"lint": "eslint ./src",
|
|
43
43
|
"test": "mocha --config ../../.mocharc \"./src/**/*.spec.?(ts|tsx)\"",
|
|
44
44
|
"test:ci": "yarn test --reporter mocha-ctrf-json-reporter",
|
|
45
45
|
"test:coverage": "nyc yarn test",
|
|
46
46
|
"watch": "tsc -w"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@eclipse-glsp/sprotty": "2.7.0-next.
|
|
49
|
+
"@eclipse-glsp/sprotty": "2.7.0-next.12+aa1cf84",
|
|
50
50
|
"autocompleter": "^9.1.2",
|
|
51
51
|
"file-saver": "^2.0.5",
|
|
52
52
|
"lodash": "4.17.23",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"publishConfig": {
|
|
64
64
|
"access": "public"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "aa1cf8426e1a20ad2af3114b22f740cca9e13503"
|
|
67
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 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,7 +44,7 @@ const testHandler: IActionHandler = {
|
|
|
44
44
|
}
|
|
45
45
|
};
|
|
46
46
|
registry.register('request', testHandler);
|
|
47
|
-
|
|
47
|
+
|
|
48
48
|
registry.register('response', { handle: () => {} });
|
|
49
49
|
actionDispatcher.initialize().then(() => {
|
|
50
50
|
actionDispatcher['blockUntil'] = undefined;
|
|
@@ -46,7 +46,7 @@ export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRoo
|
|
|
46
46
|
protected override actionHandlerRegistry: ActionHandlerRegistry;
|
|
47
47
|
|
|
48
48
|
/** @deprecated No longer in used. The {@link ActionHandlerRegistry} is now directly injected */
|
|
49
|
-
// eslint-disable-next-line
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
50
50
|
@inject(TYPES.ActionHandlerRegistryProvider) protected override actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>;
|
|
51
51
|
protected postUpdateQueue: Action[] = [];
|
|
52
52
|
|
|
@@ -195,7 +195,7 @@ export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRoo
|
|
|
195
195
|
}
|
|
196
196
|
|
|
197
197
|
override request<Res extends ResponseAction>(action: RequestAction<Res>): Promise<Res> {
|
|
198
|
-
if (!action.requestId
|
|
198
|
+
if (!action.requestId || action.requestId === '') {
|
|
199
199
|
// No request id has been specified. So we use a generated one.
|
|
200
200
|
action.requestId = RequestAction.generateRequestId();
|
|
201
201
|
}
|
|
@@ -214,13 +214,16 @@ export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRoo
|
|
|
214
214
|
*/
|
|
215
215
|
requestUntil<Res extends ResponseAction>(
|
|
216
216
|
action: RequestAction<Res>,
|
|
217
|
-
timeoutMs = 2000,
|
|
217
|
+
timeoutMs: number = action.timeout ?? 2000,
|
|
218
218
|
rejectOnTimeout = false
|
|
219
219
|
): Promise<Res | undefined> {
|
|
220
|
-
if (!action.requestId
|
|
220
|
+
if (!action.requestId || action.requestId === '') {
|
|
221
221
|
// No request id has been specified. So we use a generated one.
|
|
222
222
|
action.requestId = RequestAction.generateRequestId();
|
|
223
223
|
}
|
|
224
|
+
// Stamp the effective timeout onto the action so the receiving side
|
|
225
|
+
// (handleServerRequest/handleClientRequest) can respect it.
|
|
226
|
+
action.timeout = timeoutMs;
|
|
224
227
|
|
|
225
228
|
const requestId = action.requestId;
|
|
226
229
|
const timeout = setTimeout(() => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2026 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
|
|
@@ -61,7 +61,7 @@ export interface AutoCompleteWidgetOptions {
|
|
|
61
61
|
selectedSuggestionChanged?: (suggestion?: LabeledAction) => void;
|
|
62
62
|
}
|
|
63
63
|
|
|
64
|
-
// eslint-disable-next-line @typescript-eslint/no-
|
|
64
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
65
65
|
const configureAutocomplete: (settings: AutocompleteSettings<LabeledAction>) => AutocompleteResult = require('autocompleter');
|
|
66
66
|
|
|
67
67
|
/**
|
|
@@ -91,7 +91,7 @@ export class AutoCompleteWidget {
|
|
|
91
91
|
public autoSuggestionSettings: AutoCompleteSettings,
|
|
92
92
|
public suggestionProvider: SuggestionProvider,
|
|
93
93
|
public suggestionSubmitHandler: SuggestionSubmitHandler,
|
|
94
|
-
|
|
94
|
+
|
|
95
95
|
protected notifyClose: (reason: CloseReason) => void = () => {},
|
|
96
96
|
protected logger?: ILogger,
|
|
97
97
|
protected options?: AutoCompleteWidgetOptions
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2026 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
|
|
@@ -24,14 +24,13 @@ export interface IValidationDecorator {
|
|
|
24
24
|
|
|
25
25
|
export namespace IValidationDecorator {
|
|
26
26
|
export const NO_DECORATION: IValidationDecorator = {
|
|
27
|
-
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
28
27
|
decorateValidationResult(_status: ValidationStatus) {},
|
|
29
28
|
isValidatedOk(): boolean {
|
|
30
29
|
return false;
|
|
31
30
|
},
|
|
32
|
-
|
|
31
|
+
|
|
33
32
|
invalidate() {},
|
|
34
|
-
|
|
33
|
+
|
|
35
34
|
dispose() {}
|
|
36
35
|
};
|
|
37
36
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 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
|
|
@@ -16,6 +16,8 @@
|
|
|
16
16
|
import {
|
|
17
17
|
ActionHandlerRegistry,
|
|
18
18
|
FeatureModule,
|
|
19
|
+
GetEditorContextAction,
|
|
20
|
+
GetSelectionAction,
|
|
19
21
|
KeyTool,
|
|
20
22
|
LocationPostprocessor,
|
|
21
23
|
MousePositionTracker,
|
|
@@ -75,7 +77,7 @@ export const defaultModule = new FeatureModule(
|
|
|
75
77
|
|
|
76
78
|
bind(EditorContextService).toSelf().inSingletonScope();
|
|
77
79
|
bind(TYPES.IDiagramStartup).toService(EditorContextService);
|
|
78
|
-
// eslint-disable-next-line
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
79
81
|
bind(TYPES.IEditorContextServiceProvider).toProvider<EditorContextService>(
|
|
80
82
|
ctx => async () => ctx.container.get(EditorContextService)
|
|
81
83
|
);
|
|
@@ -83,6 +85,7 @@ export const defaultModule = new FeatureModule(
|
|
|
83
85
|
|
|
84
86
|
configureActionHandler(context, SetEditModeAction.KIND, EditorContextService);
|
|
85
87
|
configureActionHandler(context, SetDirtyStateAction.KIND, EditorContextService);
|
|
88
|
+
configureActionHandler(context, GetEditorContextAction.KIND, EditorContextService);
|
|
86
89
|
|
|
87
90
|
bind(FocusTracker).toSelf().inSingletonScope();
|
|
88
91
|
bind(TYPES.IDiagramStartup).toService(FocusTracker);
|
|
@@ -121,6 +124,7 @@ export const defaultModule = new FeatureModule(
|
|
|
121
124
|
bind(SelectionService).toSelf().inSingletonScope();
|
|
122
125
|
bind(TYPES.IGModelRootListener).toService(SelectionService);
|
|
123
126
|
bind(TYPES.IDiagramStartup).toService(SelectionService);
|
|
127
|
+
configureActionHandler(context, GetSelectionAction.KIND, SelectionService);
|
|
124
128
|
|
|
125
129
|
// Feedback Support ------------------------------------
|
|
126
130
|
// Generic re-usable feedback modifying css classes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2026 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,14 +21,14 @@ import {
|
|
|
21
21
|
DisposableCollection,
|
|
22
22
|
EditMode,
|
|
23
23
|
EditorContext,
|
|
24
|
+
EditorContextResult,
|
|
24
25
|
Emitter,
|
|
25
26
|
Event,
|
|
26
|
-
findParentByFeature,
|
|
27
27
|
GModelElement,
|
|
28
28
|
GModelRoot,
|
|
29
|
+
GetEditorContextAction,
|
|
29
30
|
IActionDispatcher,
|
|
30
31
|
IActionHandler,
|
|
31
|
-
isViewport,
|
|
32
32
|
LazyInjector,
|
|
33
33
|
MaybePromise,
|
|
34
34
|
MousePositionTracker,
|
|
@@ -37,7 +37,9 @@ import {
|
|
|
37
37
|
SetEditModeAction,
|
|
38
38
|
TYPES,
|
|
39
39
|
ValueChange,
|
|
40
|
-
Viewport
|
|
40
|
+
Viewport,
|
|
41
|
+
findParentByFeature,
|
|
42
|
+
isViewport
|
|
41
43
|
} from '@eclipse-glsp/sprotty';
|
|
42
44
|
import { inject, injectable, postConstruct, preDestroy } from 'inversify';
|
|
43
45
|
import { FocusChange, FocusTracker } from './focus/focus-tracker';
|
|
@@ -177,6 +179,8 @@ export class EditorContextService implements IActionHandler, Disposable, IDiagra
|
|
|
177
179
|
return {
|
|
178
180
|
selectedElementIds: Array.from(this.selectionService.getSelectedElementIDs()),
|
|
179
181
|
lastMousePosition: this.mousePositionTracker.lastPositionOnDiagram,
|
|
182
|
+
viewport: this.viewportData,
|
|
183
|
+
canvasBounds: this.canvasBounds,
|
|
180
184
|
args
|
|
181
185
|
};
|
|
182
186
|
}
|
|
@@ -185,18 +189,26 @@ export class EditorContextService implements IActionHandler, Disposable, IDiagra
|
|
|
185
189
|
return {
|
|
186
190
|
selectedElementIds,
|
|
187
191
|
lastMousePosition: this.mousePositionTracker.lastPositionOnDiagram,
|
|
192
|
+
viewport: this.viewportData,
|
|
193
|
+
canvasBounds: this.canvasBounds,
|
|
188
194
|
args
|
|
189
195
|
};
|
|
190
196
|
}
|
|
191
197
|
|
|
192
|
-
handle(action: Action): void {
|
|
198
|
+
handle(action: Action): Action | void {
|
|
193
199
|
if (SetEditModeAction.is(action)) {
|
|
194
200
|
this.handleSetEditModeAction(action);
|
|
195
201
|
} else if (SetDirtyStateAction.is(action)) {
|
|
196
202
|
this.handleSetDirtyStateAction(action);
|
|
203
|
+
} else if (GetEditorContextAction.is(action)) {
|
|
204
|
+
return this.handleGetEditorContext(action);
|
|
197
205
|
}
|
|
198
206
|
}
|
|
199
207
|
|
|
208
|
+
protected handleGetEditorContext(action: GetEditorContextAction): EditorContextResult {
|
|
209
|
+
return EditorContextResult.create(this.get(), { responseId: action.requestId });
|
|
210
|
+
}
|
|
211
|
+
|
|
200
212
|
protected handleSetEditModeAction(action: SetEditModeAction): void {
|
|
201
213
|
const oldValue = this._editMode;
|
|
202
214
|
this._editMode = action.editMode;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 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
|
|
@@ -109,7 +109,7 @@ export class FeedbackActionDispatcher implements IFeedbackActionDispatcher, Disp
|
|
|
109
109
|
if (feedbackEmitter instanceof GModelElement) {
|
|
110
110
|
this.logger.log(
|
|
111
111
|
this,
|
|
112
|
-
|
|
112
|
+
|
|
113
113
|
'GModelElements as feedback emitters are discouraged, as they usually change between model updates and are considered unstable.'
|
|
114
114
|
);
|
|
115
115
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 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
|
-
/* eslint-disable
|
|
16
|
+
/* eslint-disable @typescript-eslint/no-deprecated */
|
|
17
17
|
import { Command, CommandExecutionContext, CommandReturn, ICommand } from '@eclipse-glsp/sprotty';
|
|
18
18
|
import { Ranked } from '../ranked';
|
|
19
19
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021-
|
|
2
|
+
* Copyright (c) 2021-2026 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) 2023-
|
|
2
|
+
* Copyright (c) 2023-2026 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
|
|
@@ -22,10 +22,14 @@ import {
|
|
|
22
22
|
DisposeClientSessionParameters,
|
|
23
23
|
GLSPClient,
|
|
24
24
|
GModelRootSchema,
|
|
25
|
+
IActionDispatcher,
|
|
25
26
|
ILogger,
|
|
26
27
|
InitializeClientSessionParameters,
|
|
27
28
|
InitializeResult,
|
|
28
29
|
ModelSource,
|
|
30
|
+
RejectAction,
|
|
31
|
+
RequestAction,
|
|
32
|
+
ResponseAction,
|
|
29
33
|
TYPES
|
|
30
34
|
} from '@eclipse-glsp/sprotty';
|
|
31
35
|
import { inject, injectable, preDestroy } from 'inversify';
|
|
@@ -94,6 +98,8 @@ export class GLSPModelSource extends ModelSource implements Disposable {
|
|
|
94
98
|
@inject(TYPES.IDiagramOptions)
|
|
95
99
|
protected options: IDiagramOptions;
|
|
96
100
|
|
|
101
|
+
declare readonly actionDispatcher: IActionDispatcher;
|
|
102
|
+
|
|
97
103
|
protected toDispose = new DisposableCollection();
|
|
98
104
|
clientId: string;
|
|
99
105
|
|
|
@@ -164,9 +170,37 @@ export class GLSPModelSource extends ModelSource implements Disposable {
|
|
|
164
170
|
const action = message.action;
|
|
165
171
|
ServerAction.mark(action);
|
|
166
172
|
this.logger.log(this, 'receiving', action);
|
|
173
|
+
if (RequestAction.is(action)) {
|
|
174
|
+
this.handleServerRequest(action);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
167
177
|
this.actionDispatcher.dispatch(action);
|
|
168
178
|
}
|
|
169
179
|
|
|
180
|
+
// Fire-and-forget: intentionally not awaited by messageReceived()
|
|
181
|
+
protected async handleServerRequest(action: RequestAction<ResponseAction>): Promise<void> {
|
|
182
|
+
try {
|
|
183
|
+
const response =
|
|
184
|
+
action.timeout !== undefined
|
|
185
|
+
? await this.actionDispatcher.requestUntil(action, action.timeout, true)
|
|
186
|
+
: await this.actionDispatcher.request(action);
|
|
187
|
+
if (response) {
|
|
188
|
+
this.sendResponseToServer(response);
|
|
189
|
+
}
|
|
190
|
+
} catch (error) {
|
|
191
|
+
this.logger.error(this, `Failed to handle server request '${action.kind}' (${action.requestId})`, error);
|
|
192
|
+
const reject = RejectAction.create(`Failed to handle request '${action.kind}' (${action.requestId})`, {
|
|
193
|
+
responseId: action.requestId,
|
|
194
|
+
detail: error?.toString?.()
|
|
195
|
+
});
|
|
196
|
+
this.sendResponseToServer(reject);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
protected sendResponseToServer(response: ResponseAction): void {
|
|
201
|
+
this.forwardToServer(response);
|
|
202
|
+
}
|
|
203
|
+
|
|
170
204
|
override initialize(registry: GLSPActionHandlerRegistry): void {
|
|
171
205
|
// Registering actions here is discouraged and it's recommended
|
|
172
206
|
// to implemented dedicated action handlers.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2025 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2025-2026 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) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2026 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
|
|
@@ -22,7 +22,7 @@ import { DefaultModelInitializationConstraint, ModelInitializationConstraint } f
|
|
|
22
22
|
const sandbox = sinon.createSandbox();
|
|
23
23
|
const container = new Container();
|
|
24
24
|
let constraint: ModelInitializationConstraint;
|
|
25
|
-
|
|
25
|
+
|
|
26
26
|
const listener = sandbox.spy((): void => {});
|
|
27
27
|
|
|
28
28
|
describe('DefaultModelInitializationConstraint', () => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2026 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
|
|
@@ -65,20 +65,19 @@ class MockSelectionListener implements ISelectionListener {
|
|
|
65
65
|
|
|
66
66
|
function createContainer(): Container {
|
|
67
67
|
const container = initializeContainer(new Container(), defaultModule);
|
|
68
|
-
|
|
68
|
+
|
|
69
69
|
container.rebind(TYPES.IFeedbackActionDispatcher).to(MockFeedbackActionDispatcher).inSingletonScope();
|
|
70
70
|
return container;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
describe('SelectionService', () => {
|
|
74
|
-
// eslint-disable-next-line deprecation/deprecation
|
|
75
74
|
let root: GModelRoot;
|
|
76
75
|
let selectionService: SelectionService;
|
|
77
76
|
let feedbackDispatcher: MockFeedbackActionDispatcher;
|
|
78
77
|
|
|
79
78
|
beforeEach(() => {
|
|
80
79
|
const container = createContainer();
|
|
81
|
-
|
|
80
|
+
|
|
82
81
|
root = createRoot('node1', 'node2', 'node3', 'node4', 'node5');
|
|
83
82
|
selectionService = container.get<SelectionService>(SelectionService);
|
|
84
83
|
feedbackDispatcher = container.get<MockFeedbackActionDispatcher>(TYPES.IFeedbackActionDispatcher);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2026 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
|
|
@@ -23,12 +23,15 @@ import {
|
|
|
23
23
|
Emitter,
|
|
24
24
|
Event,
|
|
25
25
|
GChildElement,
|
|
26
|
+
GetSelectionAction,
|
|
26
27
|
GModelElement,
|
|
27
28
|
GModelRoot,
|
|
29
|
+
IActionHandler,
|
|
28
30
|
ILogger,
|
|
29
31
|
LazyInjector,
|
|
30
32
|
SelectAction,
|
|
31
33
|
SelectAllAction,
|
|
34
|
+
SelectionResult,
|
|
32
35
|
SprottySelectAllCommand,
|
|
33
36
|
SprottySelectCommand,
|
|
34
37
|
TYPES,
|
|
@@ -60,7 +63,7 @@ export interface SelectionChange {
|
|
|
60
63
|
}
|
|
61
64
|
|
|
62
65
|
@injectable()
|
|
63
|
-
export class SelectionService implements IGModelRootListener, Disposable, IDiagramStartup {
|
|
66
|
+
export class SelectionService implements IGModelRootListener, IActionHandler, Disposable, IDiagramStartup {
|
|
64
67
|
@inject(TYPES.IFeedbackActionDispatcher)
|
|
65
68
|
protected feedbackDispatcher: IFeedbackActionDispatcher;
|
|
66
69
|
|
|
@@ -84,6 +87,12 @@ export class SelectionService implements IGModelRootListener, Disposable, IDiagr
|
|
|
84
87
|
this.lazyInjector.getAll<ISelectionListener>(TYPES.ISelectionListener).forEach(listener => this.addListener(listener));
|
|
85
88
|
}
|
|
86
89
|
|
|
90
|
+
handle(action: Action): Action | void {
|
|
91
|
+
if (GetSelectionAction.is(action)) {
|
|
92
|
+
return SelectionResult.create(this.getSelectedElementIDs(), action.requestId);
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
87
96
|
@preDestroy()
|
|
88
97
|
dispose(): void {
|
|
89
98
|
this.toDispose.dispose();
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2024-
|
|
2
|
+
* Copyright (c) 2024-2026 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
|