@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
|
@@ -0,0 +1,34 @@
|
|
|
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 { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS, CommandPalette } from '@eclipse-glsp/sprotty';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
19
|
+
|
|
20
|
+
@injectable()
|
|
21
|
+
export class GlspCommandPalette extends CommandPalette {
|
|
22
|
+
protected override initializeContents(containerElement: HTMLElement): void {
|
|
23
|
+
super.initializeContents(containerElement);
|
|
24
|
+
containerElement.classList.add(CSS_UI_EXTENSION_CLASS);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
protected override setContainerVisible(visible: boolean): void {
|
|
28
|
+
if (visible) {
|
|
29
|
+
this.containerElement?.classList.remove(CSS_HIDDEN_EXTENSION_CLASS);
|
|
30
|
+
} else {
|
|
31
|
+
this.containerElement?.classList.add(CSS_HIDDEN_EXTENSION_CLASS);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
+
export * from './command-palette';
|
|
16
17
|
export * from './command-palette-module';
|
|
17
18
|
export * from './command-palette-tool';
|
|
18
19
|
export * from './server-command-palette-provider';
|
|
@@ -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
|
|
@@ -64,13 +64,14 @@ export class AddTemplateElementsFeedbackCommand extends FeedbackCommand {
|
|
|
64
64
|
}
|
|
65
65
|
|
|
66
66
|
override execute(context: CommandExecutionContext): CommandResult {
|
|
67
|
-
this.action.templates
|
|
67
|
+
const templateElements = this.action.templates
|
|
68
68
|
.map(template => templateToSchema(template, context))
|
|
69
69
|
.filter(isNotUndefined)
|
|
70
70
|
.map(schema => context.modelFactory.createElement(schema))
|
|
71
|
-
.map(element => this.applyRootCssClasses(element, this.action.addClasses, this.action.removeClasses))
|
|
72
|
-
|
|
73
|
-
|
|
71
|
+
.map(element => this.applyRootCssClasses(element, this.action.addClasses, this.action.removeClasses));
|
|
72
|
+
templateElements.forEach(templateElement => context.root.add(templateElement));
|
|
73
|
+
const templateElementIDs = templateElements.map(element => element.id);
|
|
74
|
+
return LocalRequestBoundsAction.fromCommand(context, this.actionDispatcher, this.action, templateElementIDs);
|
|
74
75
|
}
|
|
75
76
|
|
|
76
77
|
protected applyRootCssClasses(element: GChildElement, addClasses?: string[], removeClasses?: string[]): GChildElement {
|
|
@@ -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
|
|
@@ -64,6 +64,7 @@ import {
|
|
|
64
64
|
isVisibleOnCanvas
|
|
65
65
|
} from '../../utils/gmodel-util';
|
|
66
66
|
import { getViewportBounds, toAbsoluteBounds } from '../../utils/viewpoint-util';
|
|
67
|
+
import { feedbackEdgeEndId, feedbackEdgeId } from '../tools';
|
|
67
68
|
import { HelperLine, HelperLineType, SelectionBounds, isHelperLine, isSelectionBounds } from './model';
|
|
68
69
|
|
|
69
70
|
export type ViewportLineType = typeof HelperLineType.Center | typeof HelperLineType.Middle | string;
|
|
@@ -90,7 +91,12 @@ export const DEFAULT_ELEMENT_LINES = ALL_ELEMENT_LINE_TYPES;
|
|
|
90
91
|
export const DEFAULT_VIEWPORT_LINES = ALL_VIEWPORT_LINE_TYPES;
|
|
91
92
|
export const DEFAULT_EPSILON = 1;
|
|
92
93
|
export const DEFAULT_ALIGNABLE_ELEMENT_FILTER = (element: BoundsAwareModelElement): boolean =>
|
|
93
|
-
isVisibleOnCanvas(element) &&
|
|
94
|
+
isVisibleOnCanvas(element) &&
|
|
95
|
+
!isRoutable(element) &&
|
|
96
|
+
!(element instanceof GLabel) &&
|
|
97
|
+
!(element.id === feedbackEdgeId(element.root)) &&
|
|
98
|
+
!(element.id === feedbackEdgeEndId(element.root)) &&
|
|
99
|
+
!isDecoration(element);
|
|
94
100
|
export const DEFAULT_DEBUG = false;
|
|
95
101
|
|
|
96
102
|
export namespace DrawHelperLinesFeedbackAction {
|
|
@@ -294,7 +300,7 @@ export class DrawHelperLinesFeedbackCommand extends FeedbackCommand {
|
|
|
294
300
|
}
|
|
295
301
|
|
|
296
302
|
protected isMatch(leftCoordinate: number, rightCoordinate: number, epsilon: number): boolean {
|
|
297
|
-
return Math.abs(leftCoordinate - rightCoordinate)
|
|
303
|
+
return Math.abs(leftCoordinate - rightCoordinate) <= epsilon;
|
|
298
304
|
}
|
|
299
305
|
|
|
300
306
|
protected log(message: string, ...params: any[]): void {
|
|
@@ -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
|
|
@@ -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
|
|
@@ -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,19 +13,18 @@
|
|
|
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
|
Action,
|
|
19
18
|
CommandExecutionContext,
|
|
20
19
|
Connectable,
|
|
21
20
|
EdgeTypeHint,
|
|
22
|
-
IActionHandler,
|
|
23
|
-
RequestTypeHintsAction,
|
|
24
21
|
GModelElement,
|
|
25
22
|
GModelElementSchema,
|
|
26
23
|
GModelRoot,
|
|
27
24
|
GRoutableElement,
|
|
28
25
|
GShapeElement,
|
|
26
|
+
IActionHandler,
|
|
27
|
+
RequestTypeHintsAction,
|
|
29
28
|
SetTypeHintsAction,
|
|
30
29
|
ShapeTypeHint,
|
|
31
30
|
TYPES,
|
|
@@ -36,16 +35,17 @@ import {
|
|
|
36
35
|
isConnectable,
|
|
37
36
|
moveFeature
|
|
38
37
|
} from '@eclipse-glsp/sprotty';
|
|
38
|
+
import { inject, injectable } from 'inversify';
|
|
39
39
|
|
|
40
40
|
import { GLSPActionDispatcher } from '../../base/action-dispatcher';
|
|
41
41
|
import { IFeedbackActionDispatcher } from '../../base/feedback/feedback-action-dispatcher';
|
|
42
42
|
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
43
43
|
import { IDiagramStartup } from '../../base/model/diagram-loader';
|
|
44
|
+
import { GEdge } from '../../model';
|
|
44
45
|
import { getElementTypeId } from '../../utils/gmodel-util';
|
|
45
46
|
import { resizeFeature } from '../change-bounds/model';
|
|
46
47
|
import { reconnectFeature } from '../reconnect/model';
|
|
47
48
|
import { containerFeature, isContainable, reparentFeature } from './model';
|
|
48
|
-
import { GEdge } from '../../model';
|
|
49
49
|
|
|
50
50
|
/**
|
|
51
51
|
* Is dispatched by the {@link TypeHintProvider} to apply the type hints received from the server
|
|
@@ -78,7 +78,7 @@ type CanConnectFn = Connectable['canConnect'];
|
|
|
78
78
|
@injectable()
|
|
79
79
|
export class ApplyTypeHintsCommand extends FeedbackCommand {
|
|
80
80
|
public static KIND = ApplyTypeHintsAction.KIND;
|
|
81
|
-
public override readonly
|
|
81
|
+
public override readonly rank: number = -10;
|
|
82
82
|
|
|
83
83
|
@inject(TYPES.ITypeHintProvider)
|
|
84
84
|
protected typeHintProvider: ITypeHintProvider;
|
|
@@ -0,0 +1,24 @@
|
|
|
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
|
+
import { EditLabelAction, EditLabelActionHandler, FeatureModule, TYPES, configureActionHandler } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { GlspEditLabelUI } from './label-edit-ui';
|
|
18
|
+
|
|
19
|
+
export const labelEditUiModule = new FeatureModule((bind, unbind, isBound, rebind, ...rest) => {
|
|
20
|
+
const context = { bind, unbind, isBound, rebind };
|
|
21
|
+
configureActionHandler(context, EditLabelAction.KIND, EditLabelActionHandler);
|
|
22
|
+
bind(GlspEditLabelUI).toSelf().inSingletonScope();
|
|
23
|
+
bind(TYPES.IUIExtension).toService(GlspEditLabelUI);
|
|
24
|
+
});
|
|
@@ -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
|
+
import { CSS_HIDDEN_EXTENSION_CLASS, CSS_UI_EXTENSION_CLASS, EditLabelUI } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { injectable } from 'inversify';
|
|
18
|
+
|
|
19
|
+
@injectable()
|
|
20
|
+
export class GlspEditLabelUI extends EditLabelUI {
|
|
21
|
+
protected override initializeContents(containerElement: HTMLElement): void {
|
|
22
|
+
super.initializeContents(containerElement);
|
|
23
|
+
containerElement.classList.add(CSS_UI_EXTENSION_CLASS);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
protected override setContainerVisible(visible: boolean): void {
|
|
27
|
+
if (visible) {
|
|
28
|
+
this.containerElement?.classList.remove(CSS_HIDDEN_EXTENSION_CLASS);
|
|
29
|
+
} else {
|
|
30
|
+
this.containerElement?.classList.add(CSS_HIDDEN_EXTENSION_CLASS);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -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,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
|
Action,
|
|
19
18
|
ActionHandlerRegistry,
|
|
@@ -38,6 +37,7 @@ import {
|
|
|
38
37
|
hasObjectProp,
|
|
39
38
|
hasStringProp
|
|
40
39
|
} from '@eclipse-glsp/sprotty';
|
|
40
|
+
import { inject, injectable } from 'inversify';
|
|
41
41
|
import { EditorContextServiceProvider } from '../../base/editor-context-service';
|
|
42
42
|
import { NavigationTargetResolver } from './navigation-target-resolver';
|
|
43
43
|
|
|
@@ -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
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2021 EclipseSource and others.
|
|
2
|
+
* Copyright (c) 2021-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -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,26 +13,26 @@
|
|
|
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, optional } from 'inversify';
|
|
17
16
|
import {
|
|
18
17
|
Action,
|
|
19
18
|
CommandExecutionContext,
|
|
20
19
|
CommandReturn,
|
|
21
20
|
DeleteMarkersAction,
|
|
21
|
+
GParentElement,
|
|
22
22
|
IActionDispatcher,
|
|
23
23
|
IActionHandler,
|
|
24
24
|
ICommand,
|
|
25
25
|
Marker,
|
|
26
|
-
GParentElement,
|
|
27
26
|
SetMarkersAction,
|
|
28
27
|
TYPES,
|
|
29
28
|
hasArrayProp
|
|
30
29
|
} from '@eclipse-glsp/sprotty';
|
|
30
|
+
import { inject, injectable, optional } from 'inversify';
|
|
31
31
|
import { EditorContextService } from '../../base/editor-context-service';
|
|
32
32
|
import { IFeedbackActionDispatcher, IFeedbackEmitter } from '../../base/feedback/feedback-action-dispatcher';
|
|
33
33
|
import { FeedbackCommand } from '../../base/feedback/feedback-command';
|
|
34
34
|
import { removeCssClasses } from '../../utils/gmodel-util';
|
|
35
|
-
import { GIssueMarker, createGIssue,
|
|
35
|
+
import { GIssueMarker, createGIssue, getGIssueMarker, getOrCreateGIssueMarker, getSeverity } from './issue-marker';
|
|
36
36
|
|
|
37
37
|
/**
|
|
38
38
|
* Feedback emitter sending actions for visualizing model validation feedback and
|
|
@@ -42,9 +42,7 @@ import { GIssueMarker, createGIssue, getOrCreateGIssueMarker, getGIssueMarker, g
|
|
|
42
42
|
export class ValidationFeedbackEmitter implements IFeedbackEmitter {
|
|
43
43
|
@inject(TYPES.IFeedbackActionDispatcher) protected feedbackActionDispatcher: IFeedbackActionDispatcher;
|
|
44
44
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
protected registeredFeedbackByReason: Map<string, ApplyMarkersAction> = new Map();
|
|
45
|
+
protected registeredFeedbackByReason: Map<string, { action: ApplyMarkersAction; emitter: IFeedbackEmitter }> = new Map();
|
|
48
46
|
|
|
49
47
|
/**
|
|
50
48
|
* Register the action that should be emitted for visualizing validation feedback.
|
|
@@ -54,15 +52,24 @@ export class ValidationFeedbackEmitter implements IFeedbackEmitter {
|
|
|
54
52
|
registerValidationFeedbackAction(action: ApplyMarkersAction, reason = ''): void {
|
|
55
53
|
// De-register feedback and clear existing markers with the same reason
|
|
56
54
|
const previousFeedbackWithSameReason = this.registeredFeedbackByReason.get(reason);
|
|
55
|
+
let emitter: IFeedbackEmitter | undefined;
|
|
57
56
|
if (previousFeedbackWithSameReason) {
|
|
58
|
-
|
|
59
|
-
const deleteMarkersAction = DeleteMarkersAction.create(previousFeedbackWithSameReason.markers);
|
|
60
|
-
this.
|
|
57
|
+
emitter = previousFeedbackWithSameReason.emitter;
|
|
58
|
+
const deleteMarkersAction = DeleteMarkersAction.create(previousFeedbackWithSameReason.action.markers);
|
|
59
|
+
this.feedbackActionDispatcher.deregisterFeedback(emitter, [deleteMarkersAction]);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (!emitter) {
|
|
63
|
+
emitter = this.createEmitter(reason);
|
|
61
64
|
}
|
|
62
65
|
|
|
63
66
|
// Register new action responsible for applying markers and re-applying them when the model is updated
|
|
64
|
-
this.registeredFeedbackByReason.set(reason, action);
|
|
65
|
-
this.feedbackActionDispatcher.registerFeedback(
|
|
67
|
+
this.registeredFeedbackByReason.set(reason, { action, emitter });
|
|
68
|
+
this.feedbackActionDispatcher.registerFeedback(emitter, [action]);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
protected createEmitter(reason: string): IFeedbackEmitter {
|
|
72
|
+
return { id: 'validationFeedbackEmitter_' + reason };
|
|
66
73
|
}
|
|
67
74
|
}
|
|
68
75
|
|
package/src/utils/gmodel-util.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
|
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
GChildElement,
|
|
23
23
|
GModelElement,
|
|
24
24
|
GModelElementSchema,
|
|
25
|
+
GParentElement,
|
|
25
26
|
GRoutableElement,
|
|
26
27
|
GRoutingHandle,
|
|
27
28
|
ModelIndexImpl,
|
|
@@ -30,13 +31,12 @@ import {
|
|
|
30
31
|
Selectable,
|
|
31
32
|
TypeGuard,
|
|
32
33
|
distinctAdd,
|
|
33
|
-
findParentByFeature,
|
|
34
34
|
getAbsoluteBounds,
|
|
35
|
+
getZoom,
|
|
35
36
|
isBoundsAware,
|
|
36
37
|
isMoveable,
|
|
37
38
|
isSelectable,
|
|
38
39
|
isSelected,
|
|
39
|
-
isViewport,
|
|
40
40
|
remove
|
|
41
41
|
} from '@eclipse-glsp/sprotty';
|
|
42
42
|
|
|
@@ -346,8 +346,7 @@ export function findTopLevelElementByFeature<T>(
|
|
|
346
346
|
|
|
347
347
|
export function calculateDeltaBetweenPoints(target: Point, source: Point, element: GModelElement): Point {
|
|
348
348
|
const delta = Point.subtract(target, source);
|
|
349
|
-
const
|
|
350
|
-
const zoom = viewport?.zoom ?? 1;
|
|
349
|
+
const zoom = getZoom(element);
|
|
351
350
|
const adaptedDelta = { x: delta.x / zoom, y: delta.y / zoom };
|
|
352
351
|
return adaptedDelta;
|
|
353
352
|
}
|
|
@@ -362,3 +361,15 @@ export function isVisibleOnCanvas(model: BoundsAwareModelElement): boolean {
|
|
|
362
361
|
modelBounds.y + modelBounds.height >= 0
|
|
363
362
|
);
|
|
364
363
|
}
|
|
364
|
+
|
|
365
|
+
export function getDescendantIds(element?: GModelElement, skip?: (t: GModelElement) => boolean): string[] {
|
|
366
|
+
if (!element || skip?.(element)) {
|
|
367
|
+
return [];
|
|
368
|
+
}
|
|
369
|
+
const parent = element;
|
|
370
|
+
const ids = [parent.id];
|
|
371
|
+
if (parent instanceof GParentElement) {
|
|
372
|
+
ids.push(...parent.children.flatMap(child => getDescendantIds(child, skip)));
|
|
373
|
+
}
|
|
374
|
+
return ids;
|
|
375
|
+
}
|
package/src/utils/html-utils.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2019-
|
|
2
|
+
* Copyright (c) 2019-2023 EclipseSource and others.
|
|
3
3
|
*
|
|
4
4
|
* This program and the accompanying materials are made available under the
|
|
5
5
|
* terms of the Eclipse Public License v. 2.0 which is available at
|