@eclipse-glsp/client 2.1.1 → 2.2.0-next.326
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/css/ghost-element.css +3 -1
- package/css/glsp-sprotty.css +4 -5
- package/lib/base/action-dispatcher.d.ts +3 -2
- package/lib/base/action-dispatcher.d.ts.map +1 -1
- package/lib/base/action-dispatcher.js +17 -2
- package/lib/base/action-dispatcher.js.map +1 -1
- package/lib/base/action-dispatcher.spec.js +2 -2
- package/lib/base/action-dispatcher.spec.js.map +1 -1
- package/lib/base/action-handler-registry.d.ts +6 -2
- package/lib/base/action-handler-registry.d.ts.map +1 -1
- package/lib/base/action-handler-registry.js +31 -3
- package/lib/base/action-handler-registry.js.map +1 -1
- package/lib/base/command-stack.d.ts +8 -16
- package/lib/base/command-stack.d.ts.map +1 -1
- package/lib/base/command-stack.js +15 -14
- package/lib/base/command-stack.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 +16 -3
- package/lib/base/default.module.js.map +1 -1
- package/lib/base/editor-context-service.d.ts +44 -3
- package/lib/base/editor-context-service.d.ts.map +1 -1
- package/lib/base/editor-context-service.js +36 -13
- package/lib/base/editor-context-service.js.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.d.ts +28 -1
- package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
- package/lib/base/feedback/feedback-action-dispatcher.js +27 -2
- package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
- package/lib/base/feedback/feedback-command.d.ts +9 -4
- package/lib/base/feedback/feedback-command.d.ts.map +1 -1
- package/lib/base/feedback/feedback-command.js +14 -3
- package/lib/base/feedback/feedback-command.js.map +1 -1
- package/lib/base/feedback/index.d.ts +2 -1
- package/lib/base/feedback/index.d.ts.map +1 -1
- package/lib/base/feedback/index.js +2 -1
- package/lib/base/feedback/index.js.map +1 -1
- package/lib/base/feedback/set-model-command.d.ts +25 -0
- package/lib/base/feedback/set-model-command.d.ts.map +1 -0
- package/lib/base/feedback/set-model-command.js +65 -0
- package/lib/base/feedback/set-model-command.js.map +1 -0
- package/lib/base/feedback/update-model-command.d.ts +17 -6
- package/lib/base/feedback/update-model-command.d.ts.map +1 -1
- package/lib/base/feedback/update-model-command.js +9 -29
- package/lib/base/feedback/update-model-command.js.map +1 -1
- package/lib/base/index.d.ts +2 -1
- package/lib/base/index.d.ts.map +1 -1
- package/lib/base/index.js +2 -1
- package/lib/base/index.js.map +1 -1
- package/lib/base/model/diagram-loader.d.ts +12 -7
- package/lib/base/model/diagram-loader.d.ts.map +1 -1
- package/lib/base/model/diagram-loader.js +10 -17
- package/lib/base/model/diagram-loader.js.map +1 -1
- package/lib/base/model/glsp-model-source.d.ts +1 -1
- package/lib/base/model/glsp-model-source.js +1 -1
- package/lib/base/ranked.d.ts +11 -1
- package/lib/base/ranked.d.ts.map +1 -1
- package/lib/base/ranked.js +7 -1
- package/lib/base/ranked.js.map +1 -1
- package/lib/base/selection-service.d.ts +9 -8
- package/lib/base/selection-service.d.ts.map +1 -1
- package/lib/base/selection-service.js +11 -14
- package/lib/base/selection-service.js.map +1 -1
- package/lib/base/selection-service.spec.js +5 -1
- package/lib/base/selection-service.spec.js.map +1 -1
- package/lib/base/tool-manager/tool-manager.d.ts +10 -8
- package/lib/base/tool-manager/tool-manager.d.ts.map +1 -1
- package/lib/base/tool-manager/tool-manager.js +25 -22
- package/lib/base/tool-manager/tool-manager.js.map +1 -1
- package/lib/base/ui-extension-registry.d.ts +23 -0
- package/lib/base/ui-extension-registry.d.ts.map +1 -0
- package/lib/base/ui-extension-registry.js +51 -0
- package/lib/base/ui-extension-registry.js.map +1 -0
- package/lib/base/view/key-tool.d.ts +21 -2
- package/lib/base/view/key-tool.d.ts.map +1 -1
- package/lib/base/view/key-tool.js +21 -3
- package/lib/base/view/key-tool.js.map +1 -1
- package/lib/base/view/mouse-tool.d.ts +20 -3
- package/lib/base/view/mouse-tool.d.ts.map +1 -1
- package/lib/base/view/mouse-tool.js +9 -5
- package/lib/base/view/mouse-tool.js.map +1 -1
- package/lib/default-modules.d.ts.map +1 -1
- package/lib/default-modules.js +2 -1
- package/lib/default-modules.js.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts +6 -4
- package/lib/features/bounds/glsp-hidden-bounds-updater.d.ts.map +1 -1
- package/lib/features/bounds/glsp-hidden-bounds-updater.js +20 -3
- package/lib/features/bounds/glsp-hidden-bounds-updater.js.map +1 -1
- package/lib/features/bounds/local-bounds.d.ts +8 -4
- package/lib/features/bounds/local-bounds.d.ts.map +1 -1
- package/lib/features/bounds/local-bounds.js +9 -5
- package/lib/features/bounds/local-bounds.js.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.d.ts +2 -2
- package/lib/features/bounds/set-bounds-feedback-command.d.ts.map +1 -1
- package/lib/features/bounds/set-bounds-feedback-command.js +5 -3
- package/lib/features/bounds/set-bounds-feedback-command.js.map +1 -1
- package/lib/features/change-bounds/position-snapper.d.ts +1 -1
- package/lib/features/change-bounds/position-snapper.js +1 -1
- package/lib/features/command-palette/command-palette-module.d.ts.map +1 -1
- package/lib/features/command-palette/command-palette-module.js +2 -1
- package/lib/features/command-palette/command-palette-module.js.map +1 -1
- package/lib/features/command-palette/command-palette.d.ts +21 -0
- package/lib/features/command-palette/command-palette.d.ts.map +1 -0
- package/lib/features/command-palette/command-palette.js +46 -0
- package/lib/features/command-palette/command-palette.js.map +1 -0
- package/lib/features/command-palette/index.d.ts +1 -0
- package/lib/features/command-palette/index.d.ts.map +1 -1
- package/lib/features/command-palette/index.js +1 -0
- package/lib/features/command-palette/index.js.map +1 -1
- package/lib/features/element-template/add-template-element.d.ts +1 -1
- package/lib/features/element-template/add-template-element.d.ts.map +1 -1
- package/lib/features/element-template/add-template-element.js +6 -5
- package/lib/features/element-template/add-template-element.js.map +1 -1
- package/lib/features/helper-lines/helper-line-feedback.d.ts +1 -1
- package/lib/features/helper-lines/helper-line-feedback.d.ts.map +1 -1
- package/lib/features/helper-lines/helper-line-feedback.js +9 -3
- package/lib/features/helper-lines/helper-line-feedback.js.map +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.d.ts +1 -1
- package/lib/features/helper-lines/helper-line-manager-default.js +1 -1
- package/lib/features/helper-lines/helper-line-manager.d.ts +1 -1
- package/lib/features/hints/type-hint-provider.d.ts +17 -2
- package/lib/features/hints/type-hint-provider.d.ts.map +1 -1
- package/lib/features/hints/type-hint-provider.js +13 -13
- package/lib/features/hints/type-hint-provider.js.map +1 -1
- package/lib/features/label-edit-ui/label-edit-ui-module.d.ts +18 -0
- package/lib/features/label-edit-ui/label-edit-ui-module.d.ts.map +1 -0
- package/lib/features/label-edit-ui/label-edit-ui-module.js +27 -0
- package/lib/features/label-edit-ui/label-edit-ui-module.js.map +1 -0
- package/lib/features/label-edit-ui/label-edit-ui.d.ts +21 -0
- package/lib/features/label-edit-ui/label-edit-ui.d.ts.map +1 -0
- package/lib/features/label-edit-ui/label-edit-ui.js +46 -0
- package/lib/features/label-edit-ui/label-edit-ui.js.map +1 -0
- package/lib/features/navigation/navigation-action-handler.d.ts +15 -0
- package/lib/features/navigation/navigation-action-handler.d.ts.map +1 -1
- package/lib/features/navigation/navigation-action-handler.js +2 -2
- package/lib/features/navigation/navigation-action-handler.js.map +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.d.ts +1 -1
- package/lib/features/tools/change-bounds/change-bounds-tool-feedback.js +1 -1
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.d.ts +1 -1
- package/lib/features/tools/marquee-selection/marquee-behavior.spec.js +1 -1
- package/lib/features/validation/validate.d.ts +20 -2
- package/lib/features/validation/validate.d.ts.map +1 -1
- package/lib/features/validation/validate.js +14 -11
- package/lib/features/validation/validate.js.map +1 -1
- package/lib/utils/gmodel-util.d.ts +2 -1
- package/lib/utils/gmodel-util.d.ts.map +1 -1
- package/lib/utils/gmodel-util.js +15 -5
- package/lib/utils/gmodel-util.js.map +1 -1
- package/lib/utils/html-utils.js +1 -1
- package/package.json +7 -6
- package/src/base/action-dispatcher.spec.ts +5 -4
- package/src/base/action-dispatcher.ts +20 -4
- package/src/base/action-handler-registry.ts +24 -3
- package/src/base/command-stack.ts +17 -29
- package/src/base/default.module.ts +22 -4
- package/src/base/editor-context-service.ts +61 -16
- package/src/base/feedback/feedback-action-dispatcher.ts +50 -2
- package/src/base/feedback/feedback-command.ts +16 -5
- package/src/base/feedback/index.ts +3 -1
- package/src/base/feedback/set-model-command.ts +45 -0
- package/src/base/feedback/update-model-command.ts +9 -46
- package/src/base/index.ts +2 -1
- package/src/base/model/diagram-loader.ts +21 -14
- package/src/base/model/glsp-model-source.ts +1 -1
- package/src/base/ranked.ts +15 -1
- package/src/base/selection-service.spec.ts +8 -2
- package/src/base/selection-service.ts +22 -21
- package/src/base/tool-manager/tool-manager.ts +27 -23
- package/src/base/ui-extension-registry.ts +33 -0
- package/src/base/view/key-tool.ts +16 -4
- package/src/base/view/mouse-tool.ts +23 -6
- package/src/default-modules.ts +1 -1
- package/src/features/bounds/glsp-hidden-bounds-updater.ts +27 -5
- package/src/features/bounds/local-bounds.ts +24 -7
- package/src/features/bounds/set-bounds-feedback-command.ts +5 -3
- package/src/features/change-bounds/position-snapper.ts +1 -1
- package/src/features/command-palette/command-palette-module.ts +3 -2
- package/src/features/command-palette/command-palette.ts +34 -0
- package/src/features/command-palette/index.ts +1 -0
- package/src/features/element-template/add-template-element.ts +6 -5
- package/src/features/helper-lines/helper-line-feedback.ts +9 -3
- package/src/features/helper-lines/helper-line-manager-default.ts +1 -1
- package/src/features/helper-lines/helper-line-manager.ts +1 -1
- package/src/features/hints/type-hint-provider.ts +6 -6
- package/src/features/label-edit-ui/label-edit-ui-module.ts +24 -0
- package/src/features/label-edit-ui/label-edit-ui.ts +33 -0
- package/src/features/navigation/navigation-action-handler.ts +2 -2
- package/src/features/tools/change-bounds/change-bounds-tool-feedback.ts +1 -1
- package/src/features/tools/marquee-selection/marquee-behavior.spec.ts +1 -1
- package/src/features/validation/validate.ts +19 -12
- package/src/utils/gmodel-util.ts +16 -5
- package/src/utils/html-utils.ts +1 -1
- package/lib/tsconfig.tsbuildinfo +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 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,6 +21,7 @@ import {
|
|
|
21
21
|
EMPTY_ROOT,
|
|
22
22
|
GLSPClient,
|
|
23
23
|
InitializeParameters,
|
|
24
|
+
LazyInjector,
|
|
24
25
|
MaybePromise,
|
|
25
26
|
RequestModelAction,
|
|
26
27
|
SetModelAction,
|
|
@@ -28,7 +29,7 @@ import {
|
|
|
28
29
|
TYPES,
|
|
29
30
|
hasNumberProp
|
|
30
31
|
} from '@eclipse-glsp/sprotty';
|
|
31
|
-
import { inject, injectable
|
|
32
|
+
import { inject, injectable } from 'inversify';
|
|
32
33
|
import { GLSPActionDispatcher } from '../action-dispatcher';
|
|
33
34
|
import { Ranked } from '../ranked';
|
|
34
35
|
import { GLSPModelSource } from './glsp-model-source';
|
|
@@ -69,22 +70,27 @@ export interface IDiagramOptions {
|
|
|
69
70
|
*/
|
|
70
71
|
export interface IDiagramStartup extends Partial<Ranked> {
|
|
71
72
|
/**
|
|
72
|
-
* Hook for services that
|
|
73
|
+
* Hook for services that want to execute code before the diagram loading routine is started. This is the
|
|
74
|
+
* first hook that is invoked directly after {@link DiagramLoader.load} is called.
|
|
75
|
+
*/
|
|
76
|
+
preLoadDiagram?(): MaybePromise<void>;
|
|
77
|
+
/**
|
|
78
|
+
* Hook for services that want to execute code before the underlying GLSP client is configured and the server is initialized.
|
|
73
79
|
*/
|
|
74
80
|
preInitialize?(): MaybePromise<void>;
|
|
75
81
|
/**
|
|
76
|
-
* Hook for services that
|
|
82
|
+
* Hook for services that want to execute code before the initial model loading request (i.e. `RequestModelAction`) but
|
|
77
83
|
* after the underlying GLSP client has been configured and the server is initialized.
|
|
78
84
|
*/
|
|
79
85
|
preRequestModel?(): MaybePromise<void>;
|
|
80
86
|
/**
|
|
81
|
-
* Hook for services that
|
|
87
|
+
* Hook for services that want to execute code after the initial model loading request (i.e. `RequestModelAction`).
|
|
82
88
|
* Note that this hook is invoked directly after the `RequestModelAction` has been dispatched. It does not necessarily wait
|
|
83
89
|
* until the client-server update roundtrip is completed. If you need to wait until the diagram is fully initialized use the
|
|
84
90
|
* {@link postModelInitialization} hook.
|
|
85
91
|
*/
|
|
86
92
|
postRequestModel?(): MaybePromise<void>;
|
|
87
|
-
/* Hook for services that
|
|
93
|
+
/* Hook for services that want to execute code after the diagram model is fully initialized
|
|
88
94
|
* (i.e. `ModelInitializationConstraint` is completed).
|
|
89
95
|
*/
|
|
90
96
|
postModelInitialization?(): MaybePromise<void>;
|
|
@@ -95,7 +101,8 @@ export namespace IDiagramStartup {
|
|
|
95
101
|
return (
|
|
96
102
|
AnyObject.is(object) &&
|
|
97
103
|
hasNumberProp(object, 'rank', true) &&
|
|
98
|
-
('
|
|
104
|
+
('preLoadDiagram' in object ||
|
|
105
|
+
'preInitialize' in object ||
|
|
99
106
|
'preRequestModel' in object ||
|
|
100
107
|
'postRequestModel' in object ||
|
|
101
108
|
'postModelInitialization' in object)
|
|
@@ -144,22 +151,22 @@ export class DiagramLoader {
|
|
|
144
151
|
@inject(GLSPActionDispatcher)
|
|
145
152
|
protected actionDispatcher: GLSPActionDispatcher;
|
|
146
153
|
|
|
147
|
-
@multiInject(TYPES.IDiagramStartup)
|
|
148
|
-
@optional()
|
|
149
|
-
protected diagramStartups: IDiagramStartup[] = [];
|
|
150
|
-
|
|
151
154
|
@inject(GLSPModelSource)
|
|
152
155
|
protected modelSource: GLSPModelSource;
|
|
153
156
|
|
|
154
157
|
@inject(ModelInitializationConstraint)
|
|
155
158
|
protected modelInitializationConstraint: ModelInitializationConstraint;
|
|
156
159
|
|
|
157
|
-
@
|
|
158
|
-
protected
|
|
159
|
-
|
|
160
|
+
@inject(LazyInjector)
|
|
161
|
+
protected lazyInjector: LazyInjector;
|
|
162
|
+
|
|
163
|
+
get diagramStartups(): IDiagramStartup[] {
|
|
164
|
+
return this.lazyInjector.getAll<IDiagramStartup>(TYPES.IDiagramStartup);
|
|
160
165
|
}
|
|
161
166
|
|
|
162
167
|
async load(options: DiagramLoadingOptions = {}): Promise<void> {
|
|
168
|
+
this.diagramStartups.sort(Ranked.sort);
|
|
169
|
+
await this.invokeStartupHook('preLoadDiagram');
|
|
163
170
|
const resolvedOptions: ResolvedDiagramLoadingOptions = {
|
|
164
171
|
requestModelOptions: {
|
|
165
172
|
sourceUri: this.options.sourceUri ?? '',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
package/src/base/ranked.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2024 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,11 +21,16 @@ import { AnyObject, hasNumberProp } from '@eclipse-glsp/sprotty';
|
|
|
21
21
|
* orderable by a type or rank/priority.
|
|
22
22
|
*/
|
|
23
23
|
export interface Ranked {
|
|
24
|
+
/**
|
|
25
|
+
* A rank implies the position of this element within a sequence of other ranked elements.
|
|
26
|
+
* A lower rank implies a position earlier in the list.
|
|
27
|
+
*/
|
|
24
28
|
rank: number;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export namespace Ranked {
|
|
28
32
|
export const DEFAULT_RANK = 0;
|
|
33
|
+
|
|
29
34
|
export function is(object: unknown): object is Ranked {
|
|
30
35
|
return AnyObject.is(object) && hasNumberProp(object, 'rank');
|
|
31
36
|
}
|
|
@@ -39,4 +44,13 @@ export namespace Ranked {
|
|
|
39
44
|
export function getRank(object: unknown): number {
|
|
40
45
|
return is(object) ? object.rank : DEFAULT_RANK;
|
|
41
46
|
}
|
|
47
|
+
|
|
48
|
+
/** Sort function for lowest rank first. */
|
|
49
|
+
export const sortAsc = (left: unknown, right: unknown): number => getRank(left) - getRank(right);
|
|
50
|
+
|
|
51
|
+
/** Sort function for highest rank first. */
|
|
52
|
+
export const sortDesc = (left: unknown, right: unknown): number => getRank(right) - getRank(left);
|
|
53
|
+
|
|
54
|
+
/** Default sort function for rank: Lowest rank first */
|
|
55
|
+
export const sort = sortAsc;
|
|
42
56
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2020-
|
|
2
|
+
* Copyright (c) 2020-2024 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, Disposable, GModelRoot, GNode, TYPES, initializeContainer } from '@eclipse-glsp/sprotty';
|
|
16
|
+
import { Action, Command, CommandExecutionContext, Disposable, GModelRoot, GNode, TYPES, initializeContainer } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import { AssertionError, expect } from 'chai';
|
|
18
18
|
import { Container, injectable } from 'inversify';
|
|
19
19
|
import * as sinon from 'sinon';
|
|
@@ -44,6 +44,12 @@ class MockFeedbackActionDispatcher implements IFeedbackActionDispatcher {
|
|
|
44
44
|
const actions = this.getRegisteredFeedback();
|
|
45
45
|
return actions.length === 1 ? (actions[0] as SelectFeedbackAction) : undefined;
|
|
46
46
|
}
|
|
47
|
+
|
|
48
|
+
getFeedbackCommands(): Command[] {
|
|
49
|
+
return [];
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
async applyFeedbackCommands(context: CommandExecutionContext): Promise<void> {}
|
|
47
53
|
}
|
|
48
54
|
|
|
49
55
|
class MockSelectionListener implements ISelectionListener {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2024 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,6 +25,7 @@ import {
|
|
|
25
25
|
GModelElement,
|
|
26
26
|
GModelRoot,
|
|
27
27
|
ILogger,
|
|
28
|
+
LazyInjector,
|
|
28
29
|
SelectAction,
|
|
29
30
|
SelectAllAction,
|
|
30
31
|
Selectable,
|
|
@@ -35,10 +36,11 @@ import {
|
|
|
35
36
|
isSelectable,
|
|
36
37
|
pluck
|
|
37
38
|
} from '@eclipse-glsp/sprotty';
|
|
38
|
-
import { inject, injectable,
|
|
39
|
+
import { inject, injectable, postConstruct, preDestroy } from 'inversify';
|
|
39
40
|
import { getElements, getMatchingElements } from '../utils/gmodel-util';
|
|
40
|
-
import {
|
|
41
|
+
import { IGModelRootListener } from './editor-context-service';
|
|
41
42
|
import { IFeedbackActionDispatcher } from './feedback/feedback-action-dispatcher';
|
|
43
|
+
import { IDiagramStartup } from './model';
|
|
42
44
|
|
|
43
45
|
export interface ISelectionListener {
|
|
44
46
|
selectionChanged(root: Readonly<GModelRoot>, selectedElements: string[], deselectedElements?: string[]): void;
|
|
@@ -51,35 +53,34 @@ export interface SelectionChange {
|
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
@injectable()
|
|
54
|
-
export class SelectionService implements IGModelRootListener, Disposable {
|
|
55
|
-
protected root: Readonly<GModelRoot>;
|
|
56
|
-
protected selectedElementIDs: Set<string> = new Set();
|
|
57
|
-
|
|
56
|
+
export class SelectionService implements IGModelRootListener, Disposable, IDiagramStartup {
|
|
58
57
|
@inject(TYPES.IFeedbackActionDispatcher)
|
|
59
58
|
protected feedbackDispatcher: IFeedbackActionDispatcher;
|
|
60
59
|
|
|
60
|
+
@inject(LazyInjector)
|
|
61
|
+
protected lazyInjector: LazyInjector;
|
|
62
|
+
|
|
61
63
|
@inject(TYPES.ILogger)
|
|
62
64
|
protected logger: ILogger;
|
|
63
65
|
|
|
64
|
-
|
|
65
|
-
protected
|
|
66
|
-
|
|
67
|
-
@multiInject(TYPES.ISelectionListener)
|
|
68
|
-
@optional()
|
|
69
|
-
protected selectionListeners: ISelectionListener[] = [];
|
|
66
|
+
protected root: Readonly<GModelRoot>;
|
|
67
|
+
protected selectedElementIDs: Set<string> = new Set();
|
|
70
68
|
|
|
71
69
|
protected toDispose = new DisposableCollection();
|
|
72
70
|
|
|
73
71
|
@postConstruct()
|
|
74
72
|
protected initialize(): void {
|
|
75
|
-
this.toDispose.push(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
73
|
+
this.toDispose.push(this.onSelectionChangedEmitter);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
preLoadDiagram(): void {
|
|
77
|
+
this.lazyInjector
|
|
78
|
+
.getAll<ISelectionListener>('selectionListener')
|
|
79
|
+
.forEach(listener =>
|
|
80
|
+
this.onSelectionChanged(change =>
|
|
81
|
+
listener.selectionChanged(change.root, change.selectedElements, change.deselectedElements)
|
|
82
|
+
)
|
|
83
|
+
);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
@preDestroy()
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2024 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -14,19 +14,23 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
|
|
17
|
-
import { inject, injectable, multiInject, optional } from 'inversify';
|
|
18
17
|
import {
|
|
19
18
|
Action,
|
|
20
19
|
EditMode,
|
|
20
|
+
GModelElement,
|
|
21
21
|
IActionHandler,
|
|
22
22
|
ICommand,
|
|
23
23
|
KeyListener,
|
|
24
|
-
|
|
24
|
+
LazyInjector,
|
|
25
|
+
MaybePromise,
|
|
25
26
|
TYPES,
|
|
26
27
|
distinctAdd,
|
|
27
28
|
matchesKeystroke
|
|
28
29
|
} from '@eclipse-glsp/sprotty';
|
|
29
|
-
import {
|
|
30
|
+
import { inject, injectable } from 'inversify';
|
|
31
|
+
import { EditorContextService, IEditModeListener } from '../editor-context-service';
|
|
32
|
+
import { IDiagramStartup } from '../model';
|
|
33
|
+
import { Ranked } from '../ranked';
|
|
30
34
|
import { EnableDefaultToolsAction, EnableToolsAction, Tool } from './tool';
|
|
31
35
|
/**
|
|
32
36
|
* A tool manager coordinates the state of tools in the context of an editor.
|
|
@@ -75,27 +79,23 @@ export interface IToolManager {
|
|
|
75
79
|
* registration of tools via Dependency Injection.
|
|
76
80
|
*/
|
|
77
81
|
@injectable()
|
|
78
|
-
export class ToolManager implements IToolManager {
|
|
79
|
-
|
|
82
|
+
export class ToolManager implements IToolManager, IDiagramStartup, IEditModeListener {
|
|
83
|
+
@inject(EditorContextService)
|
|
84
|
+
protected editorContext: EditorContextService;
|
|
85
|
+
|
|
86
|
+
@inject(LazyInjector)
|
|
87
|
+
protected readonly lazyInjector: LazyInjector;
|
|
80
88
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
@inject(TYPES.IEditorContextServiceProvider) protected contextServiceProvider: EditorContextServiceProvider
|
|
91
|
-
) {
|
|
92
|
-
this.registerTools(...this.tools);
|
|
93
|
-
this.registerDefaultTools(...this.defaultTools);
|
|
89
|
+
readonly actives: Tool[] = [];
|
|
90
|
+
readonly tools: Tool[] = [];
|
|
91
|
+
readonly defaultTools: Tool[] = [];
|
|
92
|
+
|
|
93
|
+
preLoadDiagram(): MaybePromise<void> {
|
|
94
|
+
const tools: Tool[] = this.lazyInjector.getAll(TYPES.ITool);
|
|
95
|
+
const defaultTools: Tool[] = this.lazyInjector.getAll(TYPES.IDefaultTool);
|
|
96
|
+
this.registerTools(...tools);
|
|
97
|
+
this.registerDefaultTools(...defaultTools);
|
|
94
98
|
this.enableDefaultTools();
|
|
95
|
-
this.contextServiceProvider().then(editorContext => {
|
|
96
|
-
editorContext.onEditModeChanged(change => this.editModeChanged(change.newValue, change.oldValue));
|
|
97
|
-
this.editorContext = editorContext;
|
|
98
|
-
});
|
|
99
99
|
}
|
|
100
100
|
|
|
101
101
|
get managedTools(): Tool[] {
|
|
@@ -106,6 +106,10 @@ export class ToolManager implements IToolManager {
|
|
|
106
106
|
return this.actives;
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
+
get rank(): number {
|
|
110
|
+
return Ranked.DEFAULT_RANK - 100;
|
|
111
|
+
}
|
|
112
|
+
|
|
109
113
|
registerDefaultTools(...tools: Tool[]): void {
|
|
110
114
|
distinctAdd(this.defaultTools, ...tools);
|
|
111
115
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2024 EclipseSource and others.
|
|
3
|
+
*
|
|
4
|
+
* This program and the accompanying materials are made available under the
|
|
5
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
*
|
|
8
|
+
* This Source Code may also be made available under the following Secondary
|
|
9
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
* with the GNU Classpath Exception which is available at
|
|
12
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
*
|
|
14
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
********************************************************************************/
|
|
16
|
+
|
|
17
|
+
import { IUIExtension, LazyInjector, MaybePromise, TYPES, UIExtensionRegistry } from '@eclipse-glsp/sprotty';
|
|
18
|
+
import { inject, injectable, optional } from 'inversify';
|
|
19
|
+
import { IDiagramStartup } from './model';
|
|
20
|
+
|
|
21
|
+
@injectable()
|
|
22
|
+
export class GLSPUIExtensionRegistry extends UIExtensionRegistry implements IDiagramStartup {
|
|
23
|
+
@inject(LazyInjector)
|
|
24
|
+
protected lazyInjector: LazyInjector;
|
|
25
|
+
|
|
26
|
+
constructor(@optional() extensions: IUIExtension[] = []) {
|
|
27
|
+
super(extensions);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
preLoadDiagram(): MaybePromise<void> {
|
|
31
|
+
this.lazyInjector.getAll<IUIExtension>(TYPES.IUIExtension).forEach(extension => this.register(extension.id(), extension));
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 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,13 +13,25 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
16
|
+
import { Disposable, KeyListener, KeyTool, LazyInjector, MaybePromise, TYPES } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { inject, injectable, optional } from 'inversify';
|
|
18
|
+
import { IDiagramStartup } from '../model';
|
|
18
19
|
|
|
19
20
|
@injectable()
|
|
20
|
-
export class GLSPKeyTool extends KeyTool {
|
|
21
|
+
export class GLSPKeyTool extends KeyTool implements IDiagramStartup {
|
|
22
|
+
@inject(LazyInjector)
|
|
23
|
+
protected lazyInjector: LazyInjector;
|
|
24
|
+
|
|
25
|
+
constructor(@optional() keyListeners: KeyListener[] = []) {
|
|
26
|
+
super(keyListeners);
|
|
27
|
+
}
|
|
28
|
+
|
|
21
29
|
registerListener(keyListener: KeyListener): Disposable {
|
|
22
30
|
super.register(keyListener);
|
|
23
31
|
return Disposable.create(() => this.deregister(keyListener));
|
|
24
32
|
}
|
|
33
|
+
|
|
34
|
+
preLoadDiagram(): MaybePromise<void> {
|
|
35
|
+
this.lazyInjector.getAll<KeyListener>(TYPES.KeyListener).forEach(listener => this.register(listener));
|
|
36
|
+
}
|
|
25
37
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2024 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,8 +13,19 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
|
|
16
|
+
import {
|
|
17
|
+
Action,
|
|
18
|
+
Disposable,
|
|
19
|
+
GModelElement,
|
|
20
|
+
GModelRoot,
|
|
21
|
+
LazyInjector,
|
|
22
|
+
MaybePromise,
|
|
23
|
+
MouseListener,
|
|
24
|
+
MouseTool,
|
|
25
|
+
TYPES
|
|
26
|
+
} from '@eclipse-glsp/sprotty';
|
|
27
|
+
import { inject, injectable, optional } from 'inversify';
|
|
28
|
+
import { IDiagramStartup } from '../model';
|
|
18
29
|
import { Ranked } from '../ranked';
|
|
19
30
|
|
|
20
31
|
/**
|
|
@@ -24,12 +35,18 @@ import { Ranked } from '../ranked';
|
|
|
24
35
|
type MouseListenerMethods = keyof Omit<MouseListener, 'decorate'>;
|
|
25
36
|
|
|
26
37
|
@injectable()
|
|
27
|
-
export class GLSPMouseTool extends MouseTool {
|
|
38
|
+
export class GLSPMouseTool extends MouseTool implements IDiagramStartup {
|
|
39
|
+
@inject(LazyInjector)
|
|
40
|
+
protected lazyInjector: LazyInjector;
|
|
41
|
+
|
|
28
42
|
protected rankedMouseListeners: Map<number, MouseListener[]>;
|
|
29
43
|
|
|
30
|
-
constructor(@
|
|
44
|
+
constructor(@optional() mouseListeners: MouseListener[] = []) {
|
|
31
45
|
super(mouseListeners);
|
|
32
|
-
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
preLoadDiagram(): MaybePromise<void> {
|
|
49
|
+
this.lazyInjector.getAll<MouseListener>(TYPES.MouseListener).forEach(listener => this.register(listener));
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
override register(mouseListener: MouseListener): void {
|
package/src/default-modules.ts
CHANGED
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
edgeLayoutModule,
|
|
27
27
|
expandModule,
|
|
28
28
|
fadeModule,
|
|
29
|
-
labelEditUiModule,
|
|
30
29
|
modelSourceModule,
|
|
31
30
|
resolveContainerConfiguration,
|
|
32
31
|
zorderModule
|
|
@@ -61,6 +60,7 @@ import { nodeCreationToolModule } from './features/tools/node-creation/node-crea
|
|
|
61
60
|
import { toolFocusLossModule } from './features/tools/tool-focus-loss-module';
|
|
62
61
|
import { markerNavigatorModule, validationModule } from './features/validation/validation-modules';
|
|
63
62
|
import { viewportModule } from './features/viewport/viewport-modules';
|
|
63
|
+
import { labelEditUiModule } from './features/label-edit-ui/label-edit-ui-module';
|
|
64
64
|
|
|
65
65
|
export const DEFAULT_MODULES = [
|
|
66
66
|
defaultModule,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-
|
|
2
|
+
* Copyright (c) 2022-2024 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,20 +16,21 @@
|
|
|
16
16
|
|
|
17
17
|
import {
|
|
18
18
|
Action,
|
|
19
|
+
BoundsData,
|
|
19
20
|
ComputedBoundsAction,
|
|
20
21
|
Deferred,
|
|
21
22
|
EdgeRouterRegistry,
|
|
22
23
|
ElementAndRoutingPoints,
|
|
23
24
|
GModelElement,
|
|
24
|
-
GRoutableElement,
|
|
25
25
|
HiddenBoundsUpdater,
|
|
26
26
|
IActionDispatcher,
|
|
27
|
+
ModelIndexImpl,
|
|
27
28
|
RequestAction,
|
|
28
29
|
ResponseAction
|
|
29
30
|
} from '@eclipse-glsp/sprotty';
|
|
30
31
|
import { inject, injectable, optional } from 'inversify';
|
|
31
32
|
import { VNode } from 'snabbdom';
|
|
32
|
-
import { calcElementAndRoute, isRoutable } from '../../utils/gmodel-util';
|
|
33
|
+
import { BoundsAwareModelElement, calcElementAndRoute, getDescendantIds, isRoutable } from '../../utils/gmodel-util';
|
|
33
34
|
import { LocalComputedBoundsAction, LocalRequestBoundsAction } from './local-bounds';
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -42,8 +43,10 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
42
43
|
@inject(EdgeRouterRegistry) @optional() protected readonly edgeRouterRegistry?: EdgeRouterRegistry;
|
|
43
44
|
|
|
44
45
|
protected element2route: ElementAndRoutingPoints[] = [];
|
|
45
|
-
|
|
46
|
-
protected
|
|
46
|
+
|
|
47
|
+
protected getElement2BoundsData(): Map<BoundsAwareModelElement, BoundsData> {
|
|
48
|
+
return this['element2boundsData'];
|
|
49
|
+
}
|
|
47
50
|
|
|
48
51
|
override decorate(vnode: VNode, element: GModelElement): VNode {
|
|
49
52
|
super.decorate(vnode, element);
|
|
@@ -54,6 +57,9 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
54
57
|
}
|
|
55
58
|
|
|
56
59
|
override postUpdate(cause?: Action): void {
|
|
60
|
+
if (LocalRequestBoundsAction.is(cause) && cause.elementIDs) {
|
|
61
|
+
this.focusOnElements(cause.elementIDs);
|
|
62
|
+
}
|
|
57
63
|
const actions = this.captureActions(() => super.postUpdate(cause));
|
|
58
64
|
actions
|
|
59
65
|
.filter(action => ComputedBoundsAction.is(action))
|
|
@@ -61,6 +67,22 @@ export class GLSPHiddenBoundsUpdater extends HiddenBoundsUpdater {
|
|
|
61
67
|
this.element2route = [];
|
|
62
68
|
}
|
|
63
69
|
|
|
70
|
+
protected focusOnElements(elementIDs: string[]): void {
|
|
71
|
+
const data = this.getElement2BoundsData();
|
|
72
|
+
if (data.size > 0) {
|
|
73
|
+
// expand given IDs to their descendent element IDs as we need their bounding boxes as well
|
|
74
|
+
const index = [...data.keys()][0].index;
|
|
75
|
+
const relevantIds = new Set(elementIDs.flatMap(elementId => this.expandElementId(elementId, index, elementIDs)));
|
|
76
|
+
|
|
77
|
+
// ensure we only keep the bounds of the elements we are interested in
|
|
78
|
+
data.forEach((_bounds, element) => !relevantIds.has(element.id) && data.delete(element));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
protected expandElementId(id: string, index: ModelIndexImpl, elementIDs: string[]): string[] {
|
|
83
|
+
return getDescendantIds(index.getById(id));
|
|
84
|
+
}
|
|
85
|
+
|
|
64
86
|
protected captureActions(call: () => void): Action[] {
|
|
65
87
|
const capturingActionDispatcher = new CapturingActionDispatcher();
|
|
66
88
|
const actualActionDispatcher = this.actionDispatcher;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 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
|
|
@@ -26,21 +26,38 @@ import {
|
|
|
26
26
|
GModelRootSchema,
|
|
27
27
|
RequestBoundsAction,
|
|
28
28
|
TYPES,
|
|
29
|
-
ViewerOptions
|
|
29
|
+
ViewerOptions,
|
|
30
|
+
hasArrayProp
|
|
30
31
|
} from '@eclipse-glsp/sprotty';
|
|
31
32
|
import { inject, injectable } from 'inversify';
|
|
32
33
|
import { ServerAction } from '../../base/model/glsp-model-source';
|
|
33
34
|
|
|
35
|
+
export interface LocalRequestBoundsAction extends RequestBoundsAction {
|
|
36
|
+
elementIDs?: string[];
|
|
37
|
+
}
|
|
38
|
+
|
|
34
39
|
export namespace LocalRequestBoundsAction {
|
|
35
|
-
export function is(object: unknown): object is
|
|
36
|
-
return RequestBoundsAction.is(object) && !ServerAction.is(object);
|
|
40
|
+
export function is(object: unknown): object is LocalRequestBoundsAction {
|
|
41
|
+
return RequestBoundsAction.is(object) && !ServerAction.is(object) && hasArrayProp(object, 'elementIDs', true);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function create(newRoot: GModelRootSchema, elementIDs?: string[]): LocalRequestBoundsAction {
|
|
45
|
+
return {
|
|
46
|
+
...RequestBoundsAction.create(newRoot),
|
|
47
|
+
elementIDs
|
|
48
|
+
};
|
|
37
49
|
}
|
|
38
50
|
|
|
39
|
-
export function fromCommand(
|
|
51
|
+
export function fromCommand(
|
|
52
|
+
{ root }: CommandExecutionContext,
|
|
53
|
+
actionDispatcher: ActionDispatcher,
|
|
54
|
+
cause?: Action,
|
|
55
|
+
elementIDs?: string[]
|
|
56
|
+
): CommandResult {
|
|
40
57
|
// do not modify the main model (modelChanged = false) but request local bounds calculation on hidden model
|
|
41
|
-
actionDispatcher.dispatch(
|
|
58
|
+
actionDispatcher.dispatch(LocalRequestBoundsAction.create(root as unknown as GModelRootSchema, elementIDs));
|
|
42
59
|
return {
|
|
43
|
-
model:
|
|
60
|
+
model: root,
|
|
44
61
|
modelChanged: false,
|
|
45
62
|
cause
|
|
46
63
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 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,6 +24,7 @@ import {
|
|
|
24
24
|
isLayoutContainer
|
|
25
25
|
} from '@eclipse-glsp/sprotty';
|
|
26
26
|
import { inject, injectable } from 'inversify';
|
|
27
|
+
import { Ranked } from '../../base';
|
|
27
28
|
import { GLSPActionDispatcher } from '../../base/action-dispatcher';
|
|
28
29
|
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
29
30
|
import { LocalRequestBoundsAction } from './local-bounds';
|
|
@@ -48,7 +49,7 @@ export namespace SetBoundsFeedbackAction {
|
|
|
48
49
|
export class SetBoundsFeedbackCommand extends SetBoundsCommand implements FeedbackCommand {
|
|
49
50
|
static override readonly KIND: string = SetBoundsFeedbackAction.KIND;
|
|
50
51
|
|
|
51
|
-
readonly
|
|
52
|
+
readonly rank: number = Ranked.DEFAULT_RANK;
|
|
52
53
|
|
|
53
54
|
@inject(TYPES.IActionDispatcher) protected actionDispatcher: GLSPActionDispatcher;
|
|
54
55
|
|
|
@@ -65,6 +66,7 @@ export class SetBoundsFeedbackCommand extends SetBoundsCommand implements Feedba
|
|
|
65
66
|
element.layoutOptions = options;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
|
-
|
|
69
|
+
const elementIDs = this.action.bounds.map(bounds => bounds.elementId);
|
|
70
|
+
return LocalRequestBoundsAction.fromCommand(context, this.actionDispatcher, this.action, elementIDs);
|
|
69
71
|
}
|
|
70
72
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2023-2024 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,13 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
16
|
+
import { CommandPaletteActionProviderRegistry, FeatureModule, TYPES, bindAsService } from '@eclipse-glsp/sprotty';
|
|
17
17
|
import '../../../css/command-palette.css';
|
|
18
|
+
import { GlspCommandPalette } from './command-palette';
|
|
18
19
|
import { CommandPaletteTool } from './command-palette-tool';
|
|
19
20
|
import { ServerCommandPaletteActionProvider } from './server-command-palette-provider';
|
|
20
21
|
|
|
21
22
|
export const commandPaletteModule = new FeatureModule(bind => {
|
|
22
|
-
bindAsService(bind, TYPES.IUIExtension,
|
|
23
|
+
bindAsService(bind, TYPES.IUIExtension, GlspCommandPalette);
|
|
23
24
|
bind(TYPES.ICommandPaletteActionProviderRegistry).to(CommandPaletteActionProviderRegistry).inSingletonScope();
|
|
24
25
|
bindAsService(bind, TYPES.ICommandPaletteActionProvider, ServerCommandPaletteActionProvider);
|
|
25
26
|
bindAsService(bind, TYPES.IDefaultTool, CommandPaletteTool);
|