@eclipse-glsp/client 2.3.0-next.391 → 2.3.0-next.395

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.
Files changed (68) hide show
  1. package/lib/base/action-dispatcher.d.ts +4 -1
  2. package/lib/base/action-dispatcher.d.ts.map +1 -1
  3. package/lib/base/action-dispatcher.js +10 -4
  4. package/lib/base/action-dispatcher.js.map +1 -1
  5. package/lib/base/default.module.d.ts.map +1 -1
  6. package/lib/base/default.module.js +4 -2
  7. package/lib/base/default.module.js.map +1 -1
  8. package/lib/base/feedback/feedback-action-dispatcher.d.ts +18 -5
  9. package/lib/base/feedback/feedback-action-dispatcher.d.ts.map +1 -1
  10. package/lib/base/feedback/feedback-action-dispatcher.js +113 -10
  11. package/lib/base/feedback/feedback-action-dispatcher.js.map +1 -1
  12. package/lib/base/feedback/feedback-emitter.d.ts +2 -2
  13. package/lib/base/feedback/feedback-emitter.d.ts.map +1 -1
  14. package/lib/base/feedback/feedback-emitter.js +1 -2
  15. package/lib/base/feedback/feedback-emitter.js.map +1 -1
  16. package/lib/features/context-menu/delete-element-context-menu.d.ts +19 -2
  17. package/lib/features/context-menu/delete-element-context-menu.d.ts.map +1 -1
  18. package/lib/features/context-menu/delete-element-context-menu.js +11 -7
  19. package/lib/features/context-menu/delete-element-context-menu.js.map +1 -1
  20. package/lib/features/helper-lines/helper-line-manager.d.ts +78 -2
  21. package/lib/features/helper-lines/helper-line-manager.d.ts.map +1 -1
  22. package/lib/features/helper-lines/helper-line-manager.js +194 -0
  23. package/lib/features/helper-lines/helper-line-manager.js.map +1 -1
  24. package/lib/features/helper-lines/helper-line-module.js +2 -2
  25. package/lib/features/helper-lines/helper-line-module.js.map +1 -1
  26. package/lib/features/navigation/navigation-action-handler.d.ts +5 -1
  27. package/lib/features/navigation/navigation-action-handler.d.ts.map +1 -1
  28. package/lib/features/navigation/navigation-action-handler.js +11 -4
  29. package/lib/features/navigation/navigation-action-handler.js.map +1 -1
  30. package/lib/features/navigation/navigation-target-resolver.d.ts +15 -0
  31. package/lib/features/navigation/navigation-target-resolver.d.ts.map +1 -1
  32. package/lib/features/navigation/navigation-target-resolver.js +5 -3
  33. package/lib/features/navigation/navigation-target-resolver.js.map +1 -1
  34. package/lib/features/routing/edge-router.d.ts +1 -2
  35. package/lib/features/routing/edge-router.d.ts.map +1 -1
  36. package/lib/features/routing/edge-router.js +0 -45
  37. package/lib/features/routing/edge-router.js.map +1 -1
  38. package/lib/features/tools/base-tools.d.ts +2 -2
  39. package/lib/features/tools/base-tools.d.ts.map +1 -1
  40. package/lib/features/tools/base-tools.js.map +1 -1
  41. package/lib/index.d.ts +0 -2
  42. package/lib/index.d.ts.map +1 -1
  43. package/lib/index.js +0 -2
  44. package/lib/index.js.map +1 -1
  45. package/package.json +3 -3
  46. package/src/base/action-dispatcher.ts +11 -5
  47. package/src/base/default.module.ts +3 -1
  48. package/src/base/feedback/feedback-action-dispatcher.ts +114 -11
  49. package/src/base/feedback/feedback-emitter.ts +2 -2
  50. package/src/features/context-menu/delete-element-context-menu.ts +11 -7
  51. package/src/features/helper-lines/helper-line-manager.ts +234 -2
  52. package/src/features/helper-lines/helper-line-module.ts +1 -1
  53. package/src/features/hints/type-hint-provider.spec.ts +1 -1
  54. package/src/features/navigation/navigation-action-handler.ts +9 -5
  55. package/src/features/navigation/navigation-target-resolver.ts +6 -3
  56. package/src/features/routing/edge-router.ts +1 -43
  57. package/src/features/tools/base-tools.ts +2 -2
  58. package/src/index.ts +0 -2
  59. package/lib/base/feedback/feedback-action-dispatcher-default.d.ts +0 -36
  60. package/lib/base/feedback/feedback-action-dispatcher-default.d.ts.map +0 -1
  61. package/lib/base/feedback/feedback-action-dispatcher-default.js +0 -133
  62. package/lib/base/feedback/feedback-action-dispatcher-default.js.map +0 -1
  63. package/lib/features/helper-lines/helper-line-manager-default.d.ts +0 -95
  64. package/lib/features/helper-lines/helper-line-manager-default.d.ts.map +0 -1
  65. package/lib/features/helper-lines/helper-line-manager-default.js +0 -197
  66. package/lib/features/helper-lines/helper-line-manager-default.js.map +0 -1
  67. package/src/base/feedback/feedback-action-dispatcher-default.ts +0 -130
  68. package/src/features/helper-lines/helper-line-manager-default.ts +0 -250
package/lib/index.js CHANGED
@@ -43,7 +43,6 @@ __exportStar(require("./base/drag-aware-mouse-listener"), exports);
43
43
  __exportStar(require("./base/editor-context-service"), exports);
44
44
  __exportStar(require("./base/feedback/css-feedback"), exports);
45
45
  __exportStar(require("./base/feedback/feedback-action-dispatcher"), exports);
46
- __exportStar(require("./base/feedback/feedback-action-dispatcher-default"), exports);
47
46
  __exportStar(require("./base/feedback/feedback-command"), exports);
48
47
  __exportStar(require("./base/feedback/feedback-emitter"), exports);
49
48
  __exportStar(require("./base/feedback/set-model-command"), exports);
@@ -161,7 +160,6 @@ __exportStar(require("./features/grid/grid-snapper"), exports);
161
160
  __exportStar(require("./features/grid/grid-style"), exports);
162
161
  __exportStar(require("./features/helper-lines/helper-line-feedback"), exports);
163
162
  __exportStar(require("./features/helper-lines/helper-line-manager"), exports);
164
- __exportStar(require("./features/helper-lines/helper-line-manager-default"), exports);
165
163
  __exportStar(require("./features/helper-lines/helper-line-module"), exports);
166
164
  __exportStar(require("./features/helper-lines/model"), exports);
167
165
  __exportStar(require("./features/helper-lines/view"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,2DAAyC;AACzC,iEAA+C;AAC/C,sDAAoC;AACpC,6EAA2D;AAC3D,4EAA0D;AAC1D,yFAAuE;AACvE,iFAA+D;AAC/D,4EAA0D;AAC1D,uDAAqC;AACrC,wDAAsC;AACtC,mEAAiD;AACjD,gEAA8C;AAC9C,+DAA6C;AAC7C,6EAA2D;AAC3D,qFAAmE;AACnE,mEAAiD;AACjD,mEAAiD;AACjD,oEAAkD;AAClD,uEA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AC5D,4EAA0D;AAC1D,qFAAmE;AACnE,sFAAoE;AACpE,wFAAsE;AACtE,8FAA4E;AAC5E,kFAAgE;AAChE,2FAAyE;AACzE,2EAAyD;AACzD,0EAAwD;AACxD,mFAAiE;AACjE,kFAAgE;AAChE,sFAAoE;AACpE,oFAAkE;AAClE,qFAAmE;AACnE,0EAAwD;AACxD,8EAA4D;AAC5D,wEAAsD;AACtD,qEAAmD;AACnD,yEAAuD;AACvD,iEAA+C;AAC/C,2EAAyD;AACzD,iFAA+D;AAC/D,sEAAoD;AACpD,iEAA+C;AAC/C,uEAAqD;AACrD,uEAAqD;AACrD,0CAAwB;AACxB,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,wDAAsC;AACtC,sDAAoC;AACpC,qDAAmC;AACnC,uDAAqC;AACrC,iDAA+B;AAC/B,yDAAuC;AACvC,2DAAyC;AACzC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,yDAAuC;AACvC,8DAA4C"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,2DAAyC;AACzC,iEAA+C;AAC/C,sDAAoC;AACpC,6EAA2D;AAC3D,4EAA0D;AAC1D,yFAAuE;AACvE,iFAA+D;AAC/D,4EAA0D;AAC1D,uDAAqC;AACrC,wDAAsC;AACtC,mEAAiD;AACjD,gEAA8C;AAC9C,+DAA6C;AAC7C,6EAA2D;AAC3D,mEAAiD;AACjD,mEAAiD;AACjD,oEAAkD;AAClD,uEAAqD;AACrD,yEAAuD;AACvD,6DAA2C;AAC3C,8DAA4C;AAC5C,iEAA+C;AAC/C,+EAA6D;AAC7D,8DAA4C;AAC5C,gEAA8C;AAC9C,gDAA8B;AAC9B,2EAAyD;AACzD,2DAAyC;AACzC,2DAAyC;AACzC,mEAAiD;AACjD,mEAAiD;AACjD,4E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,8EAA4D;AAC5D,wEAAsD;AACtD,qEAAmD;AACnD,yEAAuD;AACvD,iEAA+C;AAC/C,2EAAyD;AACzD,iFAA+D;AAC/D,sEAAoD;AACpD,iEAA+C;AAC/C,uEAAqD;AACrD,uEAAqD;AACrD,0CAAwB;AACxB,+CAA6B;AAC7B,uDAAqC;AACrC,yDAAuC;AACvC,wDAAsC;AACtC,sDAAoC;AACpC,qDAAmC;AACnC,uDAAqC;AACrC,iDAA+B;AAC/B,yDAAuC;AACvC,2DAAyC;AACzC,uDAAqC;AACrC,qDAAmC;AACnC,sDAAoC;AACpC,+DAA6C;AAC7C,4DAA0C;AAC1C,yDAAuC;AACvC,8DAA4C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp/client",
3
- "version": "2.3.0-next.391+dd011ea",
3
+ "version": "2.3.0-next.395+8de5d13",
4
4
  "description": "A sprotty-based client for GLSP",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -46,7 +46,7 @@
46
46
  "watch": "tsc -w"
47
47
  },
48
48
  "dependencies": {
49
- "@eclipse-glsp/sprotty": "2.3.0-next.391+dd011ea",
49
+ "@eclipse-glsp/sprotty": "2.3.0-next.395+8de5d13",
50
50
  "autocompleter": "^9.1.2",
51
51
  "file-saver": "^2.0.5",
52
52
  "lodash": "4.17.21",
@@ -63,5 +63,5 @@
63
63
  "publishConfig": {
64
64
  "access": "public"
65
65
  },
66
- "gitHead": "dd011eae4f7a629cc2431e5e6d832ddb9483554b"
66
+ "gitHead": "8de5d139f94af875d6c073bf8d89107020f7a64d"
67
67
  }
@@ -16,12 +16,14 @@
16
16
  import {
17
17
  Action,
18
18
  ActionDispatcher,
19
+ ActionHandlerRegistry,
19
20
  EMPTY_ROOT,
20
21
  GModelRoot,
21
22
  IActionDispatcher,
22
23
  RequestAction,
23
24
  ResponseAction,
24
- SetModelAction
25
+ SetModelAction,
26
+ TYPES
25
27
  } from '@eclipse-glsp/sprotty';
26
28
  import { inject, injectable } from 'inversify';
27
29
  import { GLSPActionHandlerRegistry } from './action-handler-registry';
@@ -37,6 +39,12 @@ export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRoo
37
39
  @inject(ModelInitializationConstraint)
38
40
  protected initializationConstraint: ModelInitializationConstraint;
39
41
 
42
+ @inject(ActionHandlerRegistry)
43
+ protected override actionHandlerRegistry: ActionHandlerRegistry;
44
+
45
+ /** @deprecated No longer in used. The {@link ActionHandlerRegistry} is now directly injected */
46
+ // eslint-disable-next-line deprecation/deprecation
47
+ @inject(TYPES.ActionHandlerRegistryProvider) protected override actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>;
40
48
  protected postUpdateQueue: Action[] = [];
41
49
 
42
50
  override initialize(): Promise<void> {
@@ -47,10 +55,8 @@ export class GLSPActionDispatcher extends ActionDispatcher implements IGModelRoo
47
55
  }
48
56
 
49
57
  protected async doInitialize(): Promise<void> {
50
- const registry = await this.actionHandlerRegistryProvider();
51
- this.actionHandlerRegistry = registry;
52
- if (registry instanceof GLSPActionHandlerRegistry) {
53
- registry.initialize();
58
+ if (this.actionHandlerRegistry instanceof GLSPActionHandlerRegistry) {
59
+ this.actionHandlerRegistry.initialize();
54
60
  }
55
61
  this.handleAction(SetModelAction.create(EMPTY_ROOT)).catch(() => {
56
62
  /* Logged in handleAction method */
@@ -39,7 +39,7 @@ import { GLSPActionHandlerRegistry } from './action-handler-registry';
39
39
  import { GLSPCommandStack } from './command-stack';
40
40
  import { EditorContextService } from './editor-context-service';
41
41
  import { ModifyCssFeedbackCommand } from './feedback/css-feedback';
42
- import { FeedbackActionDispatcher } from './feedback/feedback-action-dispatcher-default';
42
+ import { FeedbackActionDispatcher } from './feedback/feedback-action-dispatcher';
43
43
  import { FeedbackAwareSetModelCommand } from './feedback/set-model-command';
44
44
  import { FeedbackAwareUpdateModelCommand } from './feedback/update-model-command';
45
45
  import { FocusStateChangedAction } from './focus/focus-state-change-action';
@@ -72,6 +72,7 @@ export const defaultModule = new FeatureModule(
72
72
 
73
73
  bind(EditorContextService).toSelf().inSingletonScope();
74
74
  bind(TYPES.IDiagramStartup).toService(EditorContextService);
75
+ // eslint-disable-next-line deprecation/deprecation
75
76
  bind(TYPES.IEditorContextServiceProvider).toProvider<EditorContextService>(
76
77
  ctx => async () => ctx.container.get(EditorContextService)
77
78
  );
@@ -80,6 +81,7 @@ export const defaultModule = new FeatureModule(
80
81
  configureActionHandler(context, SetDirtyStateAction.KIND, EditorContextService);
81
82
 
82
83
  bind(FocusTracker).toSelf().inSingletonScope();
84
+ bind(TYPES.IDiagramStartup).toService(FocusTracker);
83
85
  configureActionHandler(context, FocusStateChangedAction.KIND, FocusTracker);
84
86
 
85
87
  // Model update initialization ------------------------------------
@@ -13,23 +13,29 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { Action, Command, CommandExecutionContext, Disposable, MaybeFunction, call, asArray as toArray } from '@eclipse-glsp/sprotty';
16
+ import {
17
+ Action,
18
+ ActionHandlerRegistry,
19
+ Command,
20
+ CommandActionHandler,
21
+ CommandExecutionContext,
22
+ Disposable,
23
+ GModelElement,
24
+ IActionDispatcher,
25
+ ICommand,
26
+ ILogger,
27
+ MaybeActions,
28
+ TYPES,
29
+ toTypeGuard
30
+ } from '@eclipse-glsp/sprotty';
31
+ import { inject, injectable, preDestroy } from 'inversify';
32
+ import { getFeedbackRank } from './feedback-command';
17
33
  import { FeedbackEmitter } from './feedback-emitter';
18
34
 
19
35
  export interface IFeedbackEmitter {}
20
36
 
21
37
  export const feedbackFeature = Symbol('feedbackFeature');
22
38
 
23
- export type MaybeActions = MaybeFunction<Action[] | Action | undefined>;
24
-
25
- export namespace MaybeActions {
26
- // eslint-disable-next-line @typescript-eslint/no-shadow
27
- export function asArray(actions?: MaybeActions): Action[] {
28
- const cleanup = actions ? call(actions) : [];
29
- return cleanup ? toArray(cleanup) : [];
30
- }
31
- }
32
-
33
39
  /**
34
40
  * Dispatcher for actions that are meant to show visual feedback on
35
41
  * the diagram that is not part of the diagram sent from the server
@@ -86,3 +92,100 @@ export interface IFeedbackActionDispatcher {
86
92
  */
87
93
  createEmitter(): FeedbackEmitter;
88
94
  }
95
+
96
+ @injectable()
97
+ export class FeedbackActionDispatcher implements IFeedbackActionDispatcher, Disposable {
98
+ protected registeredFeedback: Map<IFeedbackEmitter, Action[]> = new Map();
99
+
100
+ @inject(TYPES.IActionDispatcher) protected actionDispatcher: IActionDispatcher;
101
+
102
+ @inject(TYPES.ILogger) protected logger: ILogger;
103
+
104
+ @inject(ActionHandlerRegistry) protected actionHandlerRegistry: ActionHandlerRegistry;
105
+
106
+ protected isDisposed = false;
107
+
108
+ registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: MaybeActions): Disposable {
109
+ if (feedbackEmitter instanceof GModelElement) {
110
+ this.logger.log(
111
+ this,
112
+ // eslint-disable-next-line max-len
113
+ 'GModelElements as feedback emitters are discouraged, as they usually change between model updates and are considered unstable.'
114
+ );
115
+ }
116
+ if (feedbackActions.length > 0) {
117
+ this.registeredFeedback.set(feedbackEmitter, feedbackActions);
118
+ this.dispatchFeedback(feedbackActions, feedbackEmitter);
119
+ }
120
+ return Disposable.create(() => this.deregisterFeedback(feedbackEmitter, cleanupActions));
121
+ }
122
+
123
+ deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: MaybeActions): void {
124
+ this.registeredFeedback.delete(feedbackEmitter);
125
+ const actions = MaybeActions.asArray(cleanupActions);
126
+ if (actions.length > 0) {
127
+ this.dispatchFeedback(actions, feedbackEmitter);
128
+ }
129
+ }
130
+
131
+ getRegisteredFeedback(): Action[] {
132
+ const result: Action[] = [];
133
+ this.registeredFeedback.forEach(actions => result.push(...actions));
134
+ return result;
135
+ }
136
+
137
+ getRegisteredFeedbackEmitters(action: Action): IFeedbackEmitter[] {
138
+ const result: IFeedbackEmitter[] = [];
139
+ this.registeredFeedback.forEach((actions, emitter) => {
140
+ if (actions.includes(action)) {
141
+ result.push(emitter);
142
+ }
143
+ });
144
+ return result;
145
+ }
146
+
147
+ getFeedbackCommands(): Command[] {
148
+ return this.getRegisteredFeedback()
149
+ .flatMap(action => this.actionToCommands(action))
150
+ .sort((left, right) => getFeedbackRank(left) - getFeedbackRank(right));
151
+ }
152
+
153
+ async applyFeedbackCommands(context: CommandExecutionContext): Promise<void> {
154
+ const feedbackCommands = this.getFeedbackCommands() ?? [];
155
+ if (feedbackCommands?.length > 0) {
156
+ const results = feedbackCommands.map(command => command.execute(context));
157
+ await Promise.all(results);
158
+ }
159
+ }
160
+
161
+ protected actionToCommands(action: Action): ICommand[] {
162
+ return (
163
+ this.actionHandlerRegistry
164
+ .get(action.kind)
165
+ .filter(toTypeGuard(CommandActionHandler))
166
+ .map(handler => handler.handle(action)) ?? []
167
+ );
168
+ }
169
+
170
+ createEmitter(): FeedbackEmitter {
171
+ return new FeedbackEmitter(this);
172
+ }
173
+
174
+ protected async dispatchFeedback(actions: Action[], feedbackEmitter: IFeedbackEmitter): Promise<void> {
175
+ try {
176
+ if (this.isDisposed) {
177
+ return;
178
+ }
179
+ await this.actionDispatcher.dispatchAll(actions);
180
+ this.logger.info(this, `Dispatched feedback actions for ${feedbackEmitter}`);
181
+ } catch (reason) {
182
+ this.logger.error(this, 'Failed to dispatch feedback actions', reason);
183
+ }
184
+ }
185
+
186
+ @preDestroy()
187
+ dispose(): void {
188
+ this.registeredFeedback.clear();
189
+ this.isDisposed = true;
190
+ }
191
+ }
@@ -14,8 +14,8 @@
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
16
 
17
- import { Action, Disposable, arrayOf } from '@eclipse-glsp/sprotty';
18
- import { IFeedbackActionDispatcher, IFeedbackEmitter, MaybeActions } from './feedback-action-dispatcher';
17
+ import { Action, Disposable, MaybeActions, arrayOf } from '@eclipse-glsp/sprotty';
18
+ import type { IFeedbackActionDispatcher, IFeedbackEmitter } from './feedback-action-dispatcher';
19
19
 
20
20
  // counter for internal id, mainly useful for debugging
21
21
  let idCounter = 0;
@@ -1,5 +1,5 @@
1
1
  /********************************************************************************
2
- * Copyright (c) 2019-2023 EclipseSource and others.
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,27 +13,31 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { DeleteElementOperation, GModelRoot, IContextMenuItemProvider, MenuItem, Point, TYPES } from '@eclipse-glsp/sprotty';
16
17
  import { inject, injectable } from 'inversify';
17
- import { DeleteElementOperation, IContextMenuItemProvider, MenuItem, Point, GModelRoot, TYPES } from '@eclipse-glsp/sprotty';
18
18
  import { EditorContextService, EditorContextServiceProvider } from '../../base/editor-context-service';
19
19
 
20
20
  @injectable()
21
21
  export class DeleteElementContextMenuItemProvider implements IContextMenuItemProvider {
22
+ /** @deprecated No longer used. The {@link EditorContextService} is now directly injected.*/
23
+ // eslint-disable-next-line deprecation/deprecation
22
24
  @inject(TYPES.IEditorContextServiceProvider) editorContextServiceProvider: EditorContextServiceProvider;
23
25
 
26
+ @inject(EditorContextService)
27
+ protected editorContext: EditorContextService;
28
+
24
29
  async getItems(_root: Readonly<GModelRoot>, _lastMousePosition?: Point): Promise<MenuItem[]> {
25
- const editorContextService = await this.editorContextServiceProvider();
26
- return [this.createDeleteMenuItem(editorContextService)];
30
+ return [this.createDeleteMenuItem()];
27
31
  }
28
32
 
29
- protected createDeleteMenuItem(editorContextService: EditorContextService): MenuItem {
33
+ protected createDeleteMenuItem(): MenuItem {
30
34
  return {
31
35
  id: 'delete',
32
36
  label: 'Delete',
33
37
  sortString: 'd',
34
38
  group: 'edit',
35
- actions: [DeleteElementOperation.create(editorContextService.selectedElements.map(e => e.id))],
36
- isEnabled: () => !editorContextService.isReadonly && editorContextService.selectedElements.length > 0
39
+ actions: [DeleteElementOperation.create(this.editorContext.selectedElements.map(e => e.id))],
40
+ isEnabled: () => !this.editorContext.isReadonly && this.editorContext.selectedElements.length > 0
37
41
  };
38
42
  }
39
43
  }
@@ -13,8 +13,38 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { GModelElement, Vector } from '@eclipse-glsp/sprotty';
17
- import { Direction } from './model';
16
+ import {
17
+ Action,
18
+ GModelElement,
19
+ GModelRoot,
20
+ IActionHandler,
21
+ MoveAction,
22
+ Point,
23
+ SetBoundsAction,
24
+ TYPES,
25
+ Vector,
26
+ Writable
27
+ } from '@eclipse-glsp/sprotty';
28
+ import { inject, injectable, optional, postConstruct } from 'inversify';
29
+ import { IFeedbackActionDispatcher } from '../../base/feedback/feedback-action-dispatcher';
30
+ import { FeedbackEmitter } from '../../base/feedback/feedback-emitter';
31
+ import { ISelectionListener, SelectionService } from '../../base/selection-service';
32
+ import { SetBoundsFeedbackAction } from '../bounds/set-bounds-feedback-command';
33
+ import { GResizeHandle, ResizeHandleLocation } from '../change-bounds/model';
34
+ import { Grid } from '../grid/grid';
35
+ import { MoveFinishedEventAction, MoveInitializedEventAction } from '../tools/change-bounds/change-bounds-tool-feedback';
36
+ import {
37
+ AlignmentElementFilter,
38
+ DEFAULT_ALIGNABLE_ELEMENT_FILTER,
39
+ DEFAULT_DEBUG,
40
+ DEFAULT_ELEMENT_LINES,
41
+ DEFAULT_EPSILON,
42
+ DEFAULT_VIEWPORT_LINES,
43
+ DrawHelperLinesFeedbackAction,
44
+ RemoveHelperLinesFeedbackAction,
45
+ ViewportLineType
46
+ } from './helper-line-feedback';
47
+ import { Direction, HelperLine, HelperLineType, isHelperLine } from './model';
18
48
 
19
49
  export interface IHelperLineManager {
20
50
  /**
@@ -35,3 +65,205 @@ export interface IHelperLineManager {
35
65
  */
36
66
  getMinimumMoveVector(element: GModelElement, isSnap: boolean, directions: Direction[]): Vector | undefined;
37
67
  }
68
+
69
+ export interface IHelperLineOptions {
70
+ /**
71
+ * A list of helper line types that should be rendered when elements are aligned.
72
+ * Defaults to all possible alignments.
73
+ */
74
+ elementLines?: HelperLineType[];
75
+ /**
76
+ * A list of helper line types that should be rendered when an element is aligned with the viewport.
77
+ * Defaults to middle and center alignment.
78
+ */
79
+ viewportLines?: ViewportLineType[];
80
+ /**
81
+ * The minimum difference between two coordinates
82
+ * Defaults to 1 or zero (perfect match) if the optional grid module is loaded.
83
+ */
84
+ alignmentEpsilon?: number;
85
+ /**
86
+ * A filter that is applied to determine on which elements the alignment calculation is performed.
87
+ * By default all top-level bounds-aware, non-routable elements that are visible on the canvas are considered.
88
+ */
89
+ alignmentElementFilter?: AlignmentElementFilter;
90
+ /**
91
+ * The minimum move delta that is necessary for an element to break through a helper line.
92
+ * Defaults to { x: 1, y: 1 } whereas the x represents the horizontal distance and y represents the vertical distance.
93
+ * If the optional grid module is loaded, defaults to twice the grid size, i.e., two grid moves to break through a helper line.
94
+ */
95
+ minimumMoveDelta?: Point;
96
+
97
+ /**
98
+ * Produces debug output.
99
+ * Defaults to false.
100
+ */
101
+ debug?: boolean;
102
+ }
103
+
104
+ export const DEFAULT_MOVE_DELTA = { x: 1, y: 1 };
105
+
106
+ export const DEFAULT_HELPER_LINE_OPTIONS: Required<IHelperLineOptions> = {
107
+ elementLines: DEFAULT_ELEMENT_LINES,
108
+ viewportLines: DEFAULT_VIEWPORT_LINES,
109
+ alignmentEpsilon: DEFAULT_EPSILON,
110
+ alignmentElementFilter: DEFAULT_ALIGNABLE_ELEMENT_FILTER,
111
+ minimumMoveDelta: DEFAULT_MOVE_DELTA,
112
+ debug: DEFAULT_DEBUG
113
+ };
114
+
115
+ @injectable()
116
+ export class HelperLineManager implements IActionHandler, ISelectionListener, IHelperLineManager {
117
+ @inject(TYPES.IFeedbackActionDispatcher) protected feedbackDispatcher: IFeedbackActionDispatcher;
118
+ @inject(SelectionService) protected selectionService: SelectionService;
119
+ @optional() @inject(TYPES.IHelperLineOptions) protected userOptions?: IHelperLineOptions;
120
+ @optional() @inject(TYPES.Grid) protected grid?: Grid;
121
+
122
+ protected options: Required<IHelperLineOptions>;
123
+ protected feedback: FeedbackEmitter;
124
+
125
+ @postConstruct()
126
+ protected init(): void {
127
+ this.feedback = this.feedbackDispatcher.createEmitter();
128
+ const dynamicOptions: IHelperLineOptions = {};
129
+ if (this.grid) {
130
+ dynamicOptions.alignmentEpsilon = 0;
131
+ dynamicOptions.minimumMoveDelta = Point.multiplyScalar(this.grid, 2);
132
+ }
133
+ this.options = { ...DEFAULT_HELPER_LINE_OPTIONS, ...dynamicOptions, ...this.userOptions };
134
+ this.selectionService.addListener(this);
135
+ }
136
+
137
+ handle(action: Action): void {
138
+ if (MoveInitializedEventAction.is(action)) {
139
+ this.handleMoveInitializedAction(action);
140
+ } else if (MoveAction.is(action)) {
141
+ this.handleMoveAction(action);
142
+ } else if (MoveFinishedEventAction.is(action)) {
143
+ this.handleMoveFinishedAction(action);
144
+ } else if (SetBoundsAction.is(action) || SetBoundsFeedbackAction.is(action)) {
145
+ this.handleSetBoundsAction(action);
146
+ }
147
+ }
148
+
149
+ protected handleMoveInitializedAction(_action: MoveInitializedEventAction): void {
150
+ this.submitHelperLineFeedback();
151
+ }
152
+
153
+ protected handleMoveFinishedAction(_action: MoveFinishedEventAction): void {
154
+ this.feedback.dispose();
155
+ }
156
+
157
+ protected handleMoveAction(action: MoveAction): void {
158
+ if (!action.finished) {
159
+ this.submitHelperLineFeedback(action.moves.map(move => move.elementId));
160
+ } else {
161
+ this.feedback.dispose();
162
+ }
163
+ }
164
+
165
+ protected submitHelperLineFeedback(elementIds: string[] = this.selectionService.getSelectedElementIDs()): void {
166
+ const feedback = this.createHelperLineFeedback(elementIds);
167
+ this.feedback.add(feedback, [RemoveHelperLinesFeedbackAction.create()]).submit();
168
+ }
169
+
170
+ protected createHelperLineFeedback(elementIds: string[]): DrawHelperLinesFeedbackAction {
171
+ return DrawHelperLinesFeedbackAction.create({ elementIds, ...this.options });
172
+ }
173
+
174
+ protected handleSetBoundsAction(action: SetBoundsAction | SetBoundsFeedbackAction): void {
175
+ this.submitHelperLineFeedback(action.bounds.map(bound => bound.elementId));
176
+ }
177
+
178
+ selectionChanged(root: Readonly<GModelRoot>, selectedElements: string[], deselectedElements?: string[] | undefined): void {
179
+ this.feedback.dispose();
180
+ }
181
+
182
+ getMinimumMoveDelta(element: GModelElement, isSnap: boolean, direction: Direction): number {
183
+ if (!isSnap) {
184
+ return 0;
185
+ }
186
+ const minimumMoveDelta = this.options.minimumMoveDelta;
187
+ return direction === Direction.Left || direction === Direction.Right ? minimumMoveDelta.x : minimumMoveDelta.y;
188
+ }
189
+
190
+ getMinimumMoveVector(element: GModelElement, isSnap: boolean, move: Direction[]): Vector | undefined {
191
+ if (!isSnap) {
192
+ return undefined;
193
+ }
194
+
195
+ const state = this.getHelperLineState(element);
196
+ if (state.helperLines.length === 0) {
197
+ return undefined;
198
+ }
199
+
200
+ const minimum: Writable<Vector> = { ...Vector.ZERO };
201
+ const resize =
202
+ element instanceof GResizeHandle
203
+ ? ResizeHandleLocation.direction(element.location)
204
+ : [Direction.Left, Direction.Right, Direction.Up, Direction.Down];
205
+
206
+ if ((state.types.left || state.types.center) && move.includes(Direction.Left) && resize.includes(Direction.Left)) {
207
+ minimum.x = this.getMinimumMoveDelta(element, isSnap, Direction.Left);
208
+ } else if ((state.types.right || state.types.center) && move.includes(Direction.Right) && resize.includes(Direction.Right)) {
209
+ minimum.x = this.getMinimumMoveDelta(element, isSnap, Direction.Right);
210
+ }
211
+ if ((state.types.top || state.types.middle) && move.includes(Direction.Up) && resize.includes(Direction.Up)) {
212
+ minimum.y = this.getMinimumMoveDelta(element, isSnap, Direction.Up);
213
+ } else if ((state.types.bottom || state.types.middle) && move.includes(Direction.Down) && resize.includes(Direction.Down)) {
214
+ minimum.y = this.getMinimumMoveDelta(element, isSnap, Direction.Down);
215
+ }
216
+ return Vector.isZero(minimum) ? undefined : minimum;
217
+ }
218
+
219
+ protected getHelperLineState(element: GModelElement): HelperLineState {
220
+ const helperLines = element.root.children.filter(isHelperLine) || [];
221
+ const types = {
222
+ left: false,
223
+ right: false,
224
+ top: false,
225
+ bottom: false,
226
+ center: false,
227
+ middle: false
228
+ };
229
+ for (const line of helperLines) {
230
+ switch (line.lineType) {
231
+ case HelperLineType.Left:
232
+ case HelperLineType.LeftRight:
233
+ types.left = true;
234
+ break;
235
+ case HelperLineType.Right:
236
+ case HelperLineType.RightLeft:
237
+ types.right = true;
238
+ break;
239
+ case HelperLineType.Top:
240
+ case HelperLineType.TopBottom:
241
+ types.top = true;
242
+ break;
243
+ case HelperLineType.Bottom:
244
+ case HelperLineType.BottomTop:
245
+ types.bottom = true;
246
+ break;
247
+ case HelperLineType.Center:
248
+ types.center = true;
249
+ break;
250
+ case HelperLineType.Middle:
251
+ types.middle = true;
252
+ break;
253
+ }
254
+ }
255
+ return { helperLines, types };
256
+ }
257
+ }
258
+
259
+ export interface HelperLineState {
260
+ helperLines: HelperLine[];
261
+ types: {
262
+ left: boolean;
263
+ right: boolean;
264
+ top: boolean;
265
+ bottom: boolean;
266
+ center: boolean;
267
+ middle: boolean;
268
+ };
269
+ }
@@ -27,7 +27,7 @@ import {
27
27
  import { SetBoundsFeedbackAction } from '../bounds/set-bounds-feedback-command';
28
28
  import { MoveFinishedEventAction, MoveInitializedEventAction } from '../tools/change-bounds/change-bounds-tool-feedback';
29
29
  import { DrawHelperLinesFeedbackCommand, RemoveHelperLinesFeedbackCommand } from './helper-line-feedback';
30
- import { HelperLineManager } from './helper-line-manager-default';
30
+ import { HelperLineManager } from './helper-line-manager';
31
31
  import { HELPER_LINE, HelperLine, SELECTION_BOUNDS, SelectionBounds } from './model';
32
32
  import { HelperLineView, SelectionBoundsView } from './view';
33
33
 
@@ -36,7 +36,7 @@ import { expect } from 'chai';
36
36
  import { Container } from 'inversify';
37
37
  import * as sinon from 'sinon';
38
38
  import { GLSPActionDispatcher } from '../../base/action-dispatcher';
39
- import { FeedbackActionDispatcher } from '../../base/feedback/feedback-action-dispatcher-default';
39
+ import { FeedbackActionDispatcher } from '../../base/feedback/feedback-action-dispatcher';
40
40
  import { FeedbackEmitter } from '../../base/feedback/feedback-emitter';
41
41
  import { GEdge } from '../../model';
42
42
  import { isResizable } from '../change-bounds/model';
@@ -38,7 +38,7 @@ import {
38
38
  hasStringProp
39
39
  } from '@eclipse-glsp/sprotty';
40
40
  import { inject, injectable } from 'inversify';
41
- import { EditorContextServiceProvider } from '../../base/editor-context-service';
41
+ import { EditorContextService, EditorContextServiceProvider } from '../../base/editor-context-service';
42
42
  import { NavigationTargetResolver } from './navigation-target-resolver';
43
43
 
44
44
  /**
@@ -140,9 +140,15 @@ export class NavigationActionHandler implements IActionHandler {
140
140
 
141
141
  @inject(TYPES.ILogger) protected logger: ILogger;
142
142
  @inject(TYPES.IActionDispatcher) protected dispatcher: IActionDispatcher;
143
+ /** @deprecated No longer in used. The {@link ActionHandlerRegistry} is now directly injected */
144
+ // eslint-disable-next-line deprecation/deprecation
143
145
  @inject(TYPES.ActionHandlerRegistryProvider) protected actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>;
146
+ /** @deprecated No longer in used. The {@link EditorContextService} is now directly injected */
147
+ // eslint-disable-next-line deprecation/deprecation
144
148
  @inject(TYPES.IEditorContextServiceProvider) protected editorContextService: EditorContextServiceProvider;
149
+ @inject(ActionHandlerRegistry) protected actionHandlerRegistry: ActionHandlerRegistry;
145
150
  @inject(NavigationTargetResolver) protected resolver: NavigationTargetResolver;
151
+ @inject(EditorContextService) protected editorContext: EditorContextService;
146
152
 
147
153
  handle(action: Action): ICommand | Action | void {
148
154
  if (NavigateAction.is(action)) {
@@ -158,8 +164,7 @@ export class NavigationActionHandler implements IActionHandler {
158
164
 
159
165
  protected async handleNavigateAction(action: NavigateAction): Promise<void> {
160
166
  try {
161
- const editorContextService = await this.editorContextService();
162
- const editorContext = editorContextService.get(action.args);
167
+ const editorContext = this.editorContext.get(action.args);
163
168
  const response = await this.dispatcher.request(
164
169
  RequestNavigationTargetsAction.create({ targetTypeId: action.targetTypeId, editorContext })
165
170
  );
@@ -250,8 +255,7 @@ export class NavigationActionHandler implements IActionHandler {
250
255
  }
251
256
 
252
257
  protected async handleNavigateToExternalTarget(action: NavigateToExternalTargetAction): Promise<void> {
253
- const registry = await this.actionHandlerRegistryProvider();
254
- const handlers = registry.get(NavigateToExternalTargetAction.KIND);
258
+ const handlers = this.actionHandlerRegistry.get(NavigateToExternalTargetAction.KIND);
255
259
  if (handlers.length === 1) {
256
260
  // we are the only handler so we know nobody took care of it
257
261
  this.warnAboutFailedNavigation('Could not resolve or navigate to target', action.target);
@@ -13,7 +13,6 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { inject, injectable } from 'inversify';
17
16
  import {
18
17
  IActionDispatcher,
19
18
  ILogger,
@@ -23,6 +22,7 @@ import {
23
22
  SetResolvedNavigationTargetAction,
24
23
  TYPES
25
24
  } from '@eclipse-glsp/sprotty';
25
+ import { inject, injectable } from 'inversify';
26
26
  import { IDiagramOptions } from '../../base/model/diagram-loader';
27
27
 
28
28
  /**
@@ -51,9 +51,12 @@ export class NavigationTargetResolver {
51
51
  target: NavigationTarget
52
52
  ): Promise<SetResolvedNavigationTargetAction | undefined> {
53
53
  const targetUri = decodeURIComponent(target.uri);
54
- if (sourceUri && sourceUri !== targetUri && `file://${sourceUri}` !== targetUri) {
54
+ const normalizedSourceUri = sourceUri?.replace(/^file:\/\//, '');
55
+ const normalizedTargetUri = targetUri.replace(/^file:\/\//, '');
56
+
57
+ if (normalizedSourceUri && normalizedSourceUri !== normalizedTargetUri) {
55
58
  // different URI, so we can't resolve it locally
56
- this.logger.info("Source and Target URI are different. Can't resolve locally.", sourceUri, targetUri);
59
+ this.logger.info("Source and Target URI are different. Can't resolve locally.", normalizedSourceUri, normalizedTargetUri);
57
60
  return undefined;
58
61
  }
59
62
  if (NavigationTarget.getElementIds(target).length > 0) {