@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
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.EditorContextService = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2020-
|
|
14
|
+
* Copyright (c) 2020-2024 EclipseSource and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,8 +25,8 @@ exports.EditorContextService = void 0;
|
|
|
25
25
|
*
|
|
26
26
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
27
|
********************************************************************************/
|
|
28
|
-
const inversify_1 = require("inversify");
|
|
29
28
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
30
|
const action_dispatcher_1 = require("./action-dispatcher");
|
|
31
31
|
const selection_service_1 = require("./selection-service");
|
|
32
32
|
/**
|
|
@@ -43,9 +43,9 @@ const selection_service_1 = require("./selection-service");
|
|
|
43
43
|
*/
|
|
44
44
|
let EditorContextService = class EditorContextService {
|
|
45
45
|
constructor() {
|
|
46
|
-
this.editModeListeners = [];
|
|
47
46
|
this.onEditModeChangedEmitter = new sprotty_1.Emitter();
|
|
48
47
|
this.onDirtyStateChangedEmitter = new sprotty_1.Emitter();
|
|
48
|
+
this.onModelRootChangedEmitter = new sprotty_1.Emitter();
|
|
49
49
|
this.toDispose = new sprotty_1.DisposableCollection();
|
|
50
50
|
}
|
|
51
51
|
get onEditModeChanged() {
|
|
@@ -54,11 +54,21 @@ let EditorContextService = class EditorContextService {
|
|
|
54
54
|
get onDirtyStateChanged() {
|
|
55
55
|
return this.onDirtyStateChangedEmitter.event;
|
|
56
56
|
}
|
|
57
|
+
get onModelRootChanged() {
|
|
58
|
+
return this.onModelRootChangedEmitter.event;
|
|
59
|
+
}
|
|
57
60
|
initialize() {
|
|
58
61
|
var _a;
|
|
59
62
|
this._editMode = (_a = this.diagramOptions.editMode) !== null && _a !== void 0 ? _a : sprotty_1.EditMode.EDITABLE;
|
|
60
63
|
this.toDispose.push(this.onEditModeChangedEmitter, this.onDirtyStateChangedEmitter);
|
|
61
|
-
|
|
64
|
+
}
|
|
65
|
+
preLoadDiagram() {
|
|
66
|
+
this.lazyInjector.getAll(sprotty_1.TYPES.IGModelRootListener).forEach(listener => {
|
|
67
|
+
this.onModelRootChanged(event => listener.modelRootChanged(event));
|
|
68
|
+
});
|
|
69
|
+
this.lazyInjector.getAll(sprotty_1.TYPES.IEditModeListener).forEach(listener => {
|
|
70
|
+
this.onEditModeChanged(event => listener.editModeChanged(event.newValue, event.oldValue));
|
|
71
|
+
});
|
|
62
72
|
}
|
|
63
73
|
dispose() {
|
|
64
74
|
this.toDispose.dispose();
|
|
@@ -77,6 +87,20 @@ let EditorContextService = class EditorContextService {
|
|
|
77
87
|
args
|
|
78
88
|
};
|
|
79
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* Notifies the service about a model root change. This method should not be called
|
|
92
|
+
* directly. It is called by the `CommandStack` after a model update has been processed.
|
|
93
|
+
* @throws an error if the notifier is not a `CommandStack`
|
|
94
|
+
* @param root the new model root
|
|
95
|
+
* @param notifier the object that triggered the model root change
|
|
96
|
+
*/
|
|
97
|
+
notifyModelRootChanged(root, notifier) {
|
|
98
|
+
if (!(notifier instanceof sprotty_1.CommandStack)) {
|
|
99
|
+
throw new Error('Invalid model root change notification. Notifier is not an instance of `CommandStack`.');
|
|
100
|
+
}
|
|
101
|
+
this._modelRoot = root;
|
|
102
|
+
this.onModelRootChangedEmitter.fire(root);
|
|
103
|
+
}
|
|
80
104
|
handle(action) {
|
|
81
105
|
if (sprotty_1.SetEditModeAction.is(action)) {
|
|
82
106
|
this.handleSetEditModeAction(action);
|
|
@@ -109,7 +133,10 @@ let EditorContextService = class EditorContextService {
|
|
|
109
133
|
return this.diagramOptions.clientId;
|
|
110
134
|
}
|
|
111
135
|
get modelRoot() {
|
|
112
|
-
|
|
136
|
+
if (!this._modelRoot) {
|
|
137
|
+
throw new Error('Model root not available yet');
|
|
138
|
+
}
|
|
139
|
+
return this._modelRoot;
|
|
113
140
|
}
|
|
114
141
|
get selectedElements() {
|
|
115
142
|
return this.selectionService.getSelectedElements();
|
|
@@ -120,9 +147,6 @@ let EditorContextService = class EditorContextService {
|
|
|
120
147
|
get isDirty() {
|
|
121
148
|
return this._isDirty;
|
|
122
149
|
}
|
|
123
|
-
postRequestModel() {
|
|
124
|
-
this.actionDispatcher.dispatch(sprotty_1.SetEditModeAction.create(this.editMode));
|
|
125
|
-
}
|
|
126
150
|
};
|
|
127
151
|
exports.EditorContextService = EditorContextService;
|
|
128
152
|
__decorate([
|
|
@@ -133,15 +157,14 @@ __decorate([
|
|
|
133
157
|
(0, inversify_1.inject)(sprotty_1.MousePositionTracker),
|
|
134
158
|
__metadata("design:type", sprotty_1.MousePositionTracker)
|
|
135
159
|
], EditorContextService.prototype, "mousePositionTracker", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
(0, inversify_1.inject)(sprotty_1.LazyInjector),
|
|
162
|
+
__metadata("design:type", Object)
|
|
163
|
+
], EditorContextService.prototype, "lazyInjector", void 0);
|
|
136
164
|
__decorate([
|
|
137
165
|
(0, inversify_1.inject)(sprotty_1.TYPES.IDiagramOptions),
|
|
138
166
|
__metadata("design:type", Object)
|
|
139
167
|
], EditorContextService.prototype, "diagramOptions", void 0);
|
|
140
|
-
__decorate([
|
|
141
|
-
(0, inversify_1.multiInject)(sprotty_1.TYPES.IEditModeListener),
|
|
142
|
-
(0, inversify_1.optional)(),
|
|
143
|
-
__metadata("design:type", Array)
|
|
144
|
-
], EditorContextService.prototype, "editModeListeners", void 0);
|
|
145
168
|
__decorate([
|
|
146
169
|
(0, inversify_1.inject)(action_dispatcher_1.GLSPActionDispatcher),
|
|
147
170
|
__metadata("design:type", action_dispatcher_1.GLSPActionDispatcher)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor-context-service.js","sourceRoot":"","sources":["../../src/base/editor-context-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"editor-context-service.js","sourceRoot":"","sources":["../../src/base/editor-context-service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAqB+B;AAC/B,yCAA0E;AAC1E,2DAA2D;AAE3D,2DAAuD;AAwBvD;;;;;;;;;;;GAWG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAoB;IAA1B;QAiBO,6BAAwB,GAAG,IAAI,iBAAO,EAAuB,CAAC;QAM9D,+BAA0B,GAAG,IAAI,iBAAO,EAAoB,CAAC;QAM7D,8BAAyB,GAAG,IAAI,iBAAO,EAAwB,CAAC;QAKhE,cAAS,GAAG,IAAI,8BAAoB,EAAE,CAAC;IA4GrD,CAAC;IA5HG,IAAI,iBAAiB;QACjB,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC;IAC/C,CAAC;IAID,IAAI,mBAAmB;QACnB,OAAO,IAAI,CAAC,0BAA0B,CAAC,KAAK,CAAC;IACjD,CAAC;IAID,IAAI,kBAAkB;QAClB,OAAO,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC;IAChD,CAAC;IAKS,UAAU;;QAChB,IAAI,CAAC,SAAS,GAAG,MAAA,IAAI,CAAC,cAAc,CAAC,QAAQ,mCAAI,kBAAQ,CAAC,QAAQ,CAAC;QACnE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,IAAI,CAAC,0BAA0B,CAAC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AAU,CAAC;IAC3B,CAAC;IAED,IAAI,gBAAgB;QAChB,OAAO,IAAI,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,CAAC;IACvD,CAAC;IAED,IAAI,UAAU;QACV,OAAO,IAAI,CAAC,QAAQ,KAAK,kBAAQ,CAAC,QAAQ,CAAC;IAC/C,CAAC;IAED,IAAI,OAAO;QACP,OAAO,IAAI,CAAC,QAAQ,CAAC;IACzB,CAAC;CACJ,CAAA;AA9IY,oDAAoB;AAEnB;IADT,IAAA,kBAAM,EAAC,oCAAgB,CAAC;8BACG,oCAAgB;8DAAC;AAGnC;IADT,IAAA,kBAAM,EAAC,8BAAoB,CAAC;8BACG,8BAAoB;kEAAC;AAG3C;IADT,IAAA,kBAAM,EAAC,sBAAY,CAAC;;0DACgB;AAG3B;IADT,IAAA,kBAAM,EAAC,eAAK,CAAC,eAAe,CAAC;;4DACY;AAGhC;IADT,IAAA,kBAAM,EAAC,wCAAoB,CAAC;8BACD,wCAAoB;8DAAC;AAuBvC;IADT,IAAA,yBAAa,GAAE;;;;sDAIf;AAYD;IADC,IAAA,sBAAU,GAAE;;;;mDAGZ;+BAtDQ,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CA8IhC"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019-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 { Action, ActionHandlerRegistry, Command, CommandExecutionContext, Disposable, IActionDispatcher, ICommand, ILogger } from '@eclipse-glsp/sprotty';
|
|
2
17
|
export interface IFeedbackEmitter {
|
|
3
18
|
}
|
|
4
19
|
/**
|
|
@@ -38,15 +53,27 @@ export interface IFeedbackActionDispatcher {
|
|
|
38
53
|
* Retrieve all `actions` sent out by currently registered `feedbackEmitter`.
|
|
39
54
|
*/
|
|
40
55
|
getRegisteredFeedback(): Action[];
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves all commands based on the registered feedback actions, ordered by their rank (lowest rank first).
|
|
58
|
+
*/
|
|
59
|
+
getFeedbackCommands(): Command[];
|
|
60
|
+
/**
|
|
61
|
+
* Applies all current feedback commands to the given command execution context.
|
|
62
|
+
*/
|
|
63
|
+
applyFeedbackCommands(context: CommandExecutionContext): Promise<void>;
|
|
41
64
|
}
|
|
42
65
|
export declare class FeedbackActionDispatcher implements IFeedbackActionDispatcher {
|
|
43
66
|
protected registeredFeedback: Map<IFeedbackEmitter, Action[]>;
|
|
44
67
|
protected actionDispatcher: () => Promise<IActionDispatcher>;
|
|
45
68
|
protected logger: ILogger;
|
|
69
|
+
protected actionHandlerRegistry: ActionHandlerRegistry;
|
|
46
70
|
registerFeedback(feedbackEmitter: IFeedbackEmitter, feedbackActions: Action[], cleanupActions?: Action[] | undefined): Disposable;
|
|
47
71
|
deregisterFeedback(feedbackEmitter: IFeedbackEmitter, cleanupActions?: Action[] | undefined): void;
|
|
48
72
|
getRegisteredFeedback(): Action[];
|
|
49
73
|
getRegisteredFeedbackEmitters(action: Action): IFeedbackEmitter[];
|
|
74
|
+
getFeedbackCommands(): Command[];
|
|
75
|
+
applyFeedbackCommands(context: CommandExecutionContext): Promise<void>;
|
|
76
|
+
protected actionToCommands(action: Action): ICommand[];
|
|
50
77
|
protected dispatchFeedback(actions: Action[], feedbackEmitter: IFeedbackEmitter): Promise<void>;
|
|
51
78
|
}
|
|
52
79
|
//# sourceMappingURL=feedback-action-dispatcher.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-action-dispatcher.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/feedback-action-dispatcher.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"feedback-action-dispatcher.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/feedback-action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,MAAM,EACN,qBAAqB,EACrB,OAAO,EAEP,uBAAuB,EACvB,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,OAAO,EAGV,MAAM,uBAAuB,CAAC;AAI/B,MAAM,WAAW,gBAAgB;CAAG;AAEpC;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,yBAAyB;IACtC;;;;;;OAMG;IACH,gBAAgB,CAAC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,UAAU,CAAC;IAEtH;;;;;;;;;OASG;IACH,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAEvF;;OAEG;IACH,qBAAqB,IAAI,MAAM,EAAE,CAAC;IAElC;;OAEG;IACH,mBAAmB,IAAI,OAAO,EAAE,CAAC;IAEjC;;OAEG;IACH,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1E;AAED,qBACa,wBAAyB,YAAW,yBAAyB;IACtE,SAAS,CAAC,kBAAkB,EAAE,GAAG,CAAC,gBAAgB,EAAE,MAAM,EAAE,CAAC,CAAa;IAEjC,SAAS,CAAC,gBAAgB,EAAE,MAAM,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC/E,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAElB,SAAS,CAAC,qBAAqB,EAAE,qBAAqB,CAAC;IAEtF,gBAAgB,CAAC,eAAe,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,EAAE,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,UAAU;IAQjI,kBAAkB,CAAC,eAAe,EAAE,gBAAgB,EAAE,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,GAAG,IAAI;IAOlG,qBAAqB,IAAI,MAAM,EAAE;IAMjC,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,gBAAgB,EAAE;IAUjE,mBAAmB,IAAI,OAAO,EAAE;IAM1B,qBAAqB,CAAC,OAAO,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5E,SAAS,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,QAAQ,EAAE;cAStC,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,eAAe,EAAE,gBAAgB,GAAG,OAAO,CAAC,IAAI,CAAC;CASxG"}
|
|
@@ -11,7 +11,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.FeedbackActionDispatcher = void 0;
|
|
13
13
|
/********************************************************************************
|
|
14
|
-
* Copyright (c) 2019-
|
|
14
|
+
* Copyright (c) 2019-2024 EclipseSource and others.
|
|
15
15
|
*
|
|
16
16
|
* This program and the accompanying materials are made available under the
|
|
17
17
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -25,8 +25,9 @@ exports.FeedbackActionDispatcher = void 0;
|
|
|
25
25
|
*
|
|
26
26
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
27
27
|
********************************************************************************/
|
|
28
|
-
const inversify_1 = require("inversify");
|
|
29
28
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
29
|
+
const inversify_1 = require("inversify");
|
|
30
|
+
const feedback_command_1 = require("./feedback-command");
|
|
30
31
|
let FeedbackActionDispatcher = class FeedbackActionDispatcher {
|
|
31
32
|
constructor() {
|
|
32
33
|
this.registeredFeedback = new Map();
|
|
@@ -58,6 +59,26 @@ let FeedbackActionDispatcher = class FeedbackActionDispatcher {
|
|
|
58
59
|
});
|
|
59
60
|
return result;
|
|
60
61
|
}
|
|
62
|
+
getFeedbackCommands() {
|
|
63
|
+
return this.getRegisteredFeedback()
|
|
64
|
+
.flatMap(action => this.actionToCommands(action))
|
|
65
|
+
.sort((left, right) => (0, feedback_command_1.getFeedbackRank)(left) - (0, feedback_command_1.getFeedbackRank)(right));
|
|
66
|
+
}
|
|
67
|
+
async applyFeedbackCommands(context) {
|
|
68
|
+
var _a;
|
|
69
|
+
const feedbackCommands = (_a = this.getFeedbackCommands()) !== null && _a !== void 0 ? _a : [];
|
|
70
|
+
if ((feedbackCommands === null || feedbackCommands === void 0 ? void 0 : feedbackCommands.length) > 0) {
|
|
71
|
+
const results = feedbackCommands.map(command => command.execute(context));
|
|
72
|
+
await Promise.all(results);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
actionToCommands(action) {
|
|
76
|
+
var _a;
|
|
77
|
+
return ((_a = this.actionHandlerRegistry
|
|
78
|
+
.get(action.kind)
|
|
79
|
+
.filter((0, sprotty_1.toTypeGuard)(sprotty_1.CommandActionHandler))
|
|
80
|
+
.map(handler => handler.handle(action))) !== null && _a !== void 0 ? _a : []);
|
|
81
|
+
}
|
|
61
82
|
async dispatchFeedback(actions, feedbackEmitter) {
|
|
62
83
|
try {
|
|
63
84
|
const actionDispatcher = await this.actionDispatcher();
|
|
@@ -78,6 +99,10 @@ __decorate([
|
|
|
78
99
|
(0, inversify_1.inject)(sprotty_1.TYPES.ILogger),
|
|
79
100
|
__metadata("design:type", Object)
|
|
80
101
|
], FeedbackActionDispatcher.prototype, "logger", void 0);
|
|
102
|
+
__decorate([
|
|
103
|
+
(0, inversify_1.inject)(sprotty_1.ActionHandlerRegistry),
|
|
104
|
+
__metadata("design:type", sprotty_1.ActionHandlerRegistry)
|
|
105
|
+
], FeedbackActionDispatcher.prototype, "actionHandlerRegistry", void 0);
|
|
81
106
|
exports.FeedbackActionDispatcher = FeedbackActionDispatcher = __decorate([
|
|
82
107
|
(0, inversify_1.injectable)()
|
|
83
108
|
], FeedbackActionDispatcher);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-action-dispatcher.js","sourceRoot":"","sources":["../../../src/base/feedback/feedback-action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"feedback-action-dispatcher.js","sourceRoot":"","sources":["../../../src/base/feedback/feedback-action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAY+B;AAC/B,yCAA+C;AAC/C,yDAAqD;AAwD9C,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IAA9B;QACO,uBAAkB,GAAoC,IAAI,GAAG,EAAE,CAAC;IAsE9E,CAAC;IA/DG,gBAAgB,CAAC,eAAiC,EAAE,eAAyB,EAAE,cAAqC;QAChH,IAAI,eAAe,CAAC,MAAM,GAAG,CAAC,EAAE;YAC5B,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;YAC9D,IAAI,CAAC,gBAAgB,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC;SAC3D;QACD,OAAO,oBAAU,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,eAAe,EAAE,cAAc,CAAC,CAAC,CAAC;IAC7F,CAAC;IAED,kBAAkB,CAAC,eAAiC,EAAE,cAAqC;QACvF,IAAI,CAAC,k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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,10 +13,15 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Command, CommandExecutionContext, CommandReturn } from '@eclipse-glsp/sprotty';
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
import { Command, CommandExecutionContext, CommandReturn, ICommand } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { Ranked } from '../ranked';
|
|
18
|
+
export declare abstract class FeedbackCommand extends Command implements Ranked {
|
|
19
|
+
/** @deprecated Use rank instead. Please note that a lower rank implies higher priority, so the order is reversed. */
|
|
20
|
+
readonly priority?: number;
|
|
21
|
+
readonly rank: number;
|
|
19
22
|
undo(context: CommandExecutionContext): CommandReturn;
|
|
20
23
|
redo(context: CommandExecutionContext): CommandReturn;
|
|
21
24
|
}
|
|
25
|
+
/** Used for backwards compatibility, otherwise use Ranked.getRank or Ranked sort functions. */
|
|
26
|
+
export declare function getFeedbackRank(command: ICommand): number;
|
|
22
27
|
//# sourceMappingURL=feedback-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-command.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/feedback-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;
|
|
1
|
+
{"version":3,"file":"feedback-command.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/feedback-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,OAAO,EAAE,uBAAuB,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAEnC,8BAAsB,eAAgB,SAAQ,OAAQ,YAAW,MAAM;IACnE,qHAAqH;IACrH,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAK;IAG/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAwD;IAE7E,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa;IAIrD,IAAI,CAAC,OAAO,EAAE,uBAAuB,GAAG,aAAa;CAGxD;AAED,+FAA+F;AAC/F,wBAAgB,eAAe,CAAC,OAAO,EAAE,QAAQ,GAAG,MAAM,CAGzD"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FeedbackCommand = void 0;
|
|
3
|
+
exports.getFeedbackRank = exports.FeedbackCommand = void 0;
|
|
4
4
|
/********************************************************************************
|
|
5
|
-
* Copyright (c) 2019-
|
|
5
|
+
* Copyright (c) 2019-2024 EclipseSource and others.
|
|
6
6
|
*
|
|
7
7
|
* This program and the accompanying materials are made available under the
|
|
8
8
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -16,12 +16,16 @@ exports.FeedbackCommand = void 0;
|
|
|
16
16
|
*
|
|
17
17
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
18
18
|
********************************************************************************/
|
|
19
|
+
/* eslint-disable deprecation/deprecation */
|
|
19
20
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
21
|
+
const ranked_1 = require("../ranked");
|
|
20
22
|
class FeedbackCommand extends sprotty_1.Command {
|
|
21
23
|
constructor() {
|
|
22
24
|
super(...arguments);
|
|
23
|
-
|
|
25
|
+
/** @deprecated Use rank instead. Please note that a lower rank implies higher priority, so the order is reversed. */
|
|
24
26
|
this.priority = 0;
|
|
27
|
+
// backwards compatibility: convert any existing priority to an equivalent rank
|
|
28
|
+
this.rank = this.priority ? -this.priority : ranked_1.Ranked.DEFAULT_RANK;
|
|
25
29
|
}
|
|
26
30
|
undo(context) {
|
|
27
31
|
return context.root;
|
|
@@ -31,4 +35,11 @@ class FeedbackCommand extends sprotty_1.Command {
|
|
|
31
35
|
}
|
|
32
36
|
}
|
|
33
37
|
exports.FeedbackCommand = FeedbackCommand;
|
|
38
|
+
/** Used for backwards compatibility, otherwise use Ranked.getRank or Ranked sort functions. */
|
|
39
|
+
function getFeedbackRank(command) {
|
|
40
|
+
var _a;
|
|
41
|
+
const feedbackCommand = command;
|
|
42
|
+
return (feedbackCommand === null || feedbackCommand === void 0 ? void 0 : feedbackCommand.priority) ? -feedbackCommand.priority : (_a = feedbackCommand.rank) !== null && _a !== void 0 ? _a : ranked_1.Ranked.DEFAULT_RANK;
|
|
43
|
+
}
|
|
44
|
+
exports.getFeedbackRank = getFeedbackRank;
|
|
34
45
|
//# sourceMappingURL=feedback-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feedback-command.js","sourceRoot":"","sources":["../../../src/base/feedback/feedback-command.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"feedback-command.js","sourceRoot":"","sources":["../../../src/base/feedback/feedback-command.ts"],"names":[],"mappings":";;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,4CAA4C;AAC5C,mDAAkG;AAClG,sCAAmC;AAEnC,MAAsB,eAAgB,SAAQ,iBAAO;IAArD;;QACI,qHAAqH;QAC5G,aAAQ,GAAY,CAAC,CAAC;QAE/B,+EAA+E;QACtE,SAAI,GAAW,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,eAAM,CAAC,YAAY,CAAC;IASjF,CAAC;IAPG,IAAI,CAAC,OAAgC;QACjC,OAAO,OAAO,CAAC,IAAI,CAAC;IACxB,CAAC;IAED,IAAI,CAAC,OAAgC;QACjC,OAAO,OAAO,CAAC,IAAI,CAAC;IACxB,CAAC;CACJ;AAdD,0CAcC;AAED,+FAA+F;AAC/F,SAAgB,eAAe,CAAC,OAAiB;;IAC7C,MAAM,eAAe,GAAG,OAAmC,CAAC;IAC5D,OAAO,CAAA,eAAe,aAAf,eAAe,uBAAf,eAAe,CAAE,QAAQ,EAAC,CAAC,CAAC,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAA,eAAe,CAAC,IAAI,mCAAI,eAAM,CAAC,YAAY,CAAC;AAC/G,CAAC;AAHD,0CAGC"}
|
|
@@ -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
|
|
@@ -16,5 +16,6 @@
|
|
|
16
16
|
export * from './css-feedback';
|
|
17
17
|
export * from './feedback-action-dispatcher';
|
|
18
18
|
export * from './feedback-command';
|
|
19
|
+
export * from './set-model-command';
|
|
19
20
|
export * from './update-model-command';
|
|
20
21
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,cAAc,gBAAgB,CAAC;AAC/B,cAAc,8BAA8B,CAAC;AAC7C,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,wBAAwB,CAAC"}
|
|
@@ -15,7 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
/********************************************************************************
|
|
18
|
-
* Copyright (c) 2023 EclipseSource and others.
|
|
18
|
+
* Copyright (c) 2023-2024 EclipseSource and others.
|
|
19
19
|
*
|
|
20
20
|
* This program and the accompanying materials are made available under the
|
|
21
21
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -32,5 +32,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
32
32
|
__exportStar(require("./css-feedback"), exports);
|
|
33
33
|
__exportStar(require("./feedback-action-dispatcher"), exports);
|
|
34
34
|
__exportStar(require("./feedback-command"), exports);
|
|
35
|
+
__exportStar(require("./set-model-command"), exports);
|
|
35
36
|
__exportStar(require("./update-model-command"), exports);
|
|
36
37
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/feedback/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA+B;AAC/B,+DAA6C;AAC7C,qDAAmC;AACnC,yDAAuC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/base/feedback/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,iDAA+B;AAC/B,+DAA6C;AAC7C,qDAAmC;AACnC,sDAAoC;AACpC,yDAAuC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
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 { CommandExecutionContext, GModelRoot, ILogger, SetModelAction, SetModelCommand } from '@eclipse-glsp/sprotty';
|
|
17
|
+
import { IFeedbackActionDispatcher } from './feedback-action-dispatcher';
|
|
18
|
+
export declare class FeedbackAwareSetModelCommand extends SetModelCommand {
|
|
19
|
+
protected logger: ILogger;
|
|
20
|
+
protected feedbackActionDispatcher?: IFeedbackActionDispatcher;
|
|
21
|
+
constructor(action: SetModelAction);
|
|
22
|
+
execute(context: CommandExecutionContext): GModelRoot;
|
|
23
|
+
protected applyFeedback(newRoot: GModelRoot, context: CommandExecutionContext): void;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=set-model-command.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-model-command.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/set-model-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,uBAAuB,EAAE,UAAU,EAAE,OAAO,EAAE,cAAc,EAAE,eAAe,EAAS,MAAM,uBAAuB,CAAC;AAE7H,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE,qBACa,4BAA6B,SAAQ,eAAe;IAE7D,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAI1B,SAAS,CAAC,wBAAwB,CAAC,EAAE,yBAAyB,CAAC;gBAE7B,MAAM,EAAE,cAAc;IAI/C,OAAO,CAAC,OAAO,EAAE,uBAAuB,GAAG,UAAU;IAM9D,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,GAAG,IAAI;CAMvF"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
+
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.FeedbackAwareSetModelCommand = void 0;
|
|
16
|
+
/********************************************************************************
|
|
17
|
+
* Copyright (c) 2024 EclipseSource and others.
|
|
18
|
+
*
|
|
19
|
+
* This program and the accompanying materials are made available under the
|
|
20
|
+
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
21
|
+
* http://www.eclipse.org/legal/epl-2.0.
|
|
22
|
+
*
|
|
23
|
+
* This Source Code may also be made available under the following Secondary
|
|
24
|
+
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
25
|
+
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
26
|
+
* with the GNU Classpath Exception which is available at
|
|
27
|
+
* https://www.gnu.org/software/classpath/license.html.
|
|
28
|
+
*
|
|
29
|
+
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
30
|
+
********************************************************************************/
|
|
31
|
+
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
32
|
+
const inversify_1 = require("inversify");
|
|
33
|
+
let FeedbackAwareSetModelCommand = class FeedbackAwareSetModelCommand extends sprotty_1.SetModelCommand {
|
|
34
|
+
constructor(action) {
|
|
35
|
+
super(action);
|
|
36
|
+
}
|
|
37
|
+
execute(context) {
|
|
38
|
+
const root = super.execute(context);
|
|
39
|
+
this.applyFeedback(root, context);
|
|
40
|
+
return root;
|
|
41
|
+
}
|
|
42
|
+
applyFeedback(newRoot, context) {
|
|
43
|
+
var _a;
|
|
44
|
+
// Create a temporary context which defines the `newRoot` as `root`
|
|
45
|
+
// This way we do not corrupt the redo/undo behavior of the super class
|
|
46
|
+
const tempContext = Object.assign(Object.assign({}, context), { root: newRoot });
|
|
47
|
+
(_a = this.feedbackActionDispatcher) === null || _a === void 0 ? void 0 : _a.applyFeedbackCommands(tempContext);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
exports.FeedbackAwareSetModelCommand = FeedbackAwareSetModelCommand;
|
|
51
|
+
__decorate([
|
|
52
|
+
(0, inversify_1.inject)(sprotty_1.TYPES.ILogger),
|
|
53
|
+
__metadata("design:type", Object)
|
|
54
|
+
], FeedbackAwareSetModelCommand.prototype, "logger", void 0);
|
|
55
|
+
__decorate([
|
|
56
|
+
(0, inversify_1.inject)(sprotty_1.TYPES.IFeedbackActionDispatcher),
|
|
57
|
+
(0, inversify_1.optional)(),
|
|
58
|
+
__metadata("design:type", Object)
|
|
59
|
+
], FeedbackAwareSetModelCommand.prototype, "feedbackActionDispatcher", void 0);
|
|
60
|
+
exports.FeedbackAwareSetModelCommand = FeedbackAwareSetModelCommand = __decorate([
|
|
61
|
+
(0, inversify_1.injectable)(),
|
|
62
|
+
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
63
|
+
__metadata("design:paramtypes", [Object])
|
|
64
|
+
], FeedbackAwareSetModelCommand);
|
|
65
|
+
//# sourceMappingURL=set-model-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-model-command.js","sourceRoot":"","sources":["../../../src/base/feedback/set-model-command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,mDAA6H;AAC7H,yCAAyD;AAIlD,IAAM,4BAA4B,GAAlC,MAAM,4BAA6B,SAAQ,yBAAe;IAQ7D,YAAkC,MAAsB;QACpD,KAAK,CAAC,MAAM,CAAC,CAAC;IAClB,CAAC;IAEQ,OAAO,CAAC,OAAgC;QAC7C,MAAM,IAAI,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QACpC,IAAI,CAAC,aAAa,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,IAAI,CAAC;IAChB,CAAC;IAES,aAAa,CAAC,OAAmB,EAAE,OAAgC;;QACzE,mEAAmE;QACnE,uEAAuE;QACvE,MAAM,WAAW,mCAAiC,OAAO,KAAE,IAAI,EAAE,OAAO,GAAE,CAAC;QAC3E,MAAA,IAAI,CAAC,wBAAwB,0CAAE,qBAAqB,CAAC,WAAW,CAAC,CAAC;IACtE,CAAC;CACJ,CAAA;AAxBY,oEAA4B;AAE3B;IADT,IAAA,kBAAM,EAAC,eAAK,CAAC,OAAO,CAAC;;4DACI;AAIhB;IAFT,IAAA,kBAAM,EAAC,eAAK,CAAC,yBAAyB,CAAC;IACvC,IAAA,oBAAQ,GAAE;;8EACoD;uCANtD,4BAA4B;IADxC,IAAA,sBAAU,GAAE;IASI,WAAA,IAAA,kBAAM,EAAC,eAAK,CAAC,MAAM,CAAC,CAAA;;GARxB,4BAA4B,CAwBxC"}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2019-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 { Animation, CommandExecutionContext, CommandReturn, GModelRoot, ILogger, UpdateAnimationData, UpdateModelAction, UpdateModelCommand } from '@eclipse-glsp/sprotty';
|
|
2
17
|
import { IFeedbackActionDispatcher } from './feedback-action-dispatcher';
|
|
3
|
-
import { FeedbackCommand } from './feedback-command';
|
|
4
18
|
/**
|
|
5
19
|
* A special {@link UpdateModelCommand} that retrieves all registered {@link Action}s from the {@link IFeedbackActionDispatcher}
|
|
6
20
|
* (if present) and applies their feedback to the `newRoot` before performing the update. This enables persistent client-side feedback
|
|
@@ -9,11 +23,8 @@ import { FeedbackCommand } from './feedback-command';
|
|
|
9
23
|
export declare class FeedbackAwareUpdateModelCommand extends UpdateModelCommand {
|
|
10
24
|
protected logger: ILogger;
|
|
11
25
|
protected feedbackActionDispatcher: IFeedbackActionDispatcher;
|
|
12
|
-
|
|
13
|
-
constructor(action: UpdateModelAction, actionHandlerRegistryProvider: () => Promise<ActionHandlerRegistry>);
|
|
26
|
+
constructor(action: UpdateModelAction);
|
|
14
27
|
protected performUpdate(oldRoot: GModelRoot, newRoot: GModelRoot, context: CommandExecutionContext): CommandReturn;
|
|
15
|
-
protected getFeedbackCommands(registry: ActionHandlerRegistry): Command[];
|
|
16
|
-
protected getPriority(command: Partial<FeedbackCommand>): number;
|
|
17
28
|
protected createAnimations(data: UpdateAnimationData, root: GModelRoot, context: CommandExecutionContext): Animation[];
|
|
18
29
|
}
|
|
19
30
|
//# sourceMappingURL=update-model-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-model-command.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/update-model-command.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"update-model-command.d.ts","sourceRoot":"","sources":["../../../src/base/feedback/update-model-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EACH,SAAS,EACT,uBAAuB,EACvB,aAAa,EACb,UAAU,EACV,OAAO,EAGP,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAE,yBAAyB,EAAE,MAAM,8BAA8B,CAAC;AAEzE;;;;GAIG;AACH,qBACa,+BAAgC,SAAQ,kBAAkB;IAEnE,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAI1B,SAAS,CAAC,wBAAwB,EAAE,yBAAyB,CAAC;gBAE5B,MAAM,EAAE,iBAAiB;cAIxC,aAAa,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,GAAG,aAAa;cAUxG,gBAAgB,CAAC,IAAI,EAAE,mBAAmB,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,uBAAuB,GAAG,SAAS,EAAE;CAIlI"}
|
|
@@ -14,7 +14,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
15
|
exports.FeedbackAwareUpdateModelCommand = void 0;
|
|
16
16
|
/********************************************************************************
|
|
17
|
-
* Copyright (c) 2019-
|
|
17
|
+
* Copyright (c) 2019-2024 EclipseSource and others.
|
|
18
18
|
*
|
|
19
19
|
* This program and the accompanying materials are made available under the
|
|
20
20
|
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
@@ -28,43 +28,24 @@ exports.FeedbackAwareUpdateModelCommand = void 0;
|
|
|
28
28
|
*
|
|
29
29
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
30
30
|
********************************************************************************/
|
|
31
|
-
const inversify_1 = require("inversify");
|
|
32
31
|
const sprotty_1 = require("@eclipse-glsp/sprotty");
|
|
32
|
+
const inversify_1 = require("inversify");
|
|
33
33
|
/**
|
|
34
34
|
* A special {@link UpdateModelCommand} that retrieves all registered {@link Action}s from the {@link IFeedbackActionDispatcher}
|
|
35
35
|
* (if present) and applies their feedback to the `newRoot` before performing the update. This enables persistent client-side feedback
|
|
36
36
|
* across model updates initiated by the GLSP server.
|
|
37
37
|
*/
|
|
38
38
|
let FeedbackAwareUpdateModelCommand = class FeedbackAwareUpdateModelCommand extends sprotty_1.UpdateModelCommand {
|
|
39
|
-
constructor(action
|
|
39
|
+
constructor(action) {
|
|
40
40
|
super(Object.assign({ animate: true }, action));
|
|
41
|
-
actionHandlerRegistryProvider().then(registry => (this.actionHandlerRegistry = registry));
|
|
42
41
|
}
|
|
43
42
|
performUpdate(oldRoot, newRoot, context) {
|
|
44
|
-
if (this.feedbackActionDispatcher && this.actionHandlerRegistry) {
|
|
45
|
-
// Create a temporary context which defines the `newRoot` as `root`
|
|
46
|
-
// This way we do not corrupt the redo/undo behavior of the super class
|
|
47
|
-
const tempContext = Object.assign(Object.assign({}, context), { root: newRoot });
|
|
48
|
-
const feedbackCommands = this.getFeedbackCommands(this.actionHandlerRegistry);
|
|
49
|
-
feedbackCommands.forEach(command => command.execute(tempContext));
|
|
50
|
-
}
|
|
51
|
-
return super.performUpdate(oldRoot, newRoot, context);
|
|
52
|
-
}
|
|
53
|
-
getFeedbackCommands(registry) {
|
|
54
|
-
const result = [];
|
|
55
|
-
this.feedbackActionDispatcher.getRegisteredFeedback().forEach(action => {
|
|
56
|
-
const commands = registry
|
|
57
|
-
.get(action.kind)
|
|
58
|
-
.filter((0, sprotty_1.toTypeGuard)(sprotty_1.CommandActionHandler))
|
|
59
|
-
.map(handler => handler.handle(action));
|
|
60
|
-
result.push(...commands);
|
|
61
|
-
});
|
|
62
|
-
// sort commands descanting by priority
|
|
63
|
-
return result.sort((a, b) => this.getPriority(b) - this.getPriority(a));
|
|
64
|
-
}
|
|
65
|
-
getPriority(command) {
|
|
66
43
|
var _a;
|
|
67
|
-
|
|
44
|
+
// Create a temporary context which defines the `newRoot` as `root`
|
|
45
|
+
// This way we do not corrupt the redo/undo behavior of the super class
|
|
46
|
+
const tempContext = Object.assign(Object.assign({}, context), { root: newRoot });
|
|
47
|
+
(_a = this.feedbackActionDispatcher) === null || _a === void 0 ? void 0 : _a.applyFeedbackCommands(tempContext);
|
|
48
|
+
return super.performUpdate(oldRoot, newRoot, context);
|
|
68
49
|
}
|
|
69
50
|
// Override the `createAnimations` implementation and remove the animation for edge morphing. Otherwise routing & reconnect
|
|
70
51
|
// handles flicker after each server update.
|
|
@@ -86,7 +67,6 @@ __decorate([
|
|
|
86
67
|
exports.FeedbackAwareUpdateModelCommand = FeedbackAwareUpdateModelCommand = __decorate([
|
|
87
68
|
(0, inversify_1.injectable)(),
|
|
88
69
|
__param(0, (0, inversify_1.inject)(sprotty_1.TYPES.Action)),
|
|
89
|
-
|
|
90
|
-
__metadata("design:paramtypes", [Object, Function])
|
|
70
|
+
__metadata("design:paramtypes", [Object])
|
|
91
71
|
], FeedbackAwareUpdateModelCommand);
|
|
92
72
|
//# sourceMappingURL=update-model-command.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-model-command.js","sourceRoot":"","sources":["../../../src/base/feedback/update-model-command.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"update-model-command.js","sourceRoot":"","sources":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
CHANGED
|
@@ -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
|
|
@@ -28,5 +28,6 @@ export * from './ranked';
|
|
|
28
28
|
export * from './selection-clearing-mouse-listener';
|
|
29
29
|
export * from './selection-service';
|
|
30
30
|
export * from './tool-manager';
|
|
31
|
+
export * from './ui-extension-registry';
|
|
31
32
|
export * from './view';
|
|
32
33
|
//# sourceMappingURL=index.d.ts.map
|