@eclipse-glsp/server 1.1.0-next.f0fc2cf.63 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/browser/launch/worker-server-launcher.js +2 -1
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/action-dispatcher.d.ts +2 -1
- package/lib/common/actions/action-dispatcher.d.ts.map +1 -1
- package/lib/common/actions/action-dispatcher.js +9 -6
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/action-handler-registry.js +4 -2
- package/lib/common/actions/action-handler-registry.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +17 -8
- package/lib/common/actions/client-action-handler.d.ts.map +1 -1
- package/lib/common/actions/client-action-handler.js +32 -21
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/actions/global-action-provider.d.ts +6 -21
- package/lib/common/actions/global-action-provider.d.ts.map +1 -1
- package/lib/common/actions/global-action-provider.js +17 -21
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/command/command-stack.js +2 -1
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/recording-command.d.ts +9 -15
- package/lib/common/command/recording-command.d.ts.map +1 -1
- package/lib/common/command/recording-command.js +12 -26
- package/lib/common/command/recording-command.js.map +1 -1
- package/lib/common/command/undo-redo-action-handler.js +2 -1
- package/lib/common/command/undo-redo-action-handler.js.map +1 -1
- package/lib/common/di/client-session-module.d.ts +9 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +9 -9
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/diagram-module.d.ts +20 -1
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +17 -56
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.js +2 -1
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/server-module.d.ts +0 -1
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +0 -1
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.d.ts.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js.map +1 -1
- package/lib/common/features/contextactions/command-palette-action-provider.js +2 -1
- package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js +2 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js +2 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -2
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js +2 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
- package/lib/common/features/directediting/label-edit-validator.js +2 -1
- package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js +2 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +2 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +2 -1
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/gmodel-factory.js +2 -1
- package/lib/common/features/model/gmodel-factory.js.map +1 -1
- package/lib/common/features/model/gmodel-index.js +2 -1
- package/lib/common/features/model/gmodel-index.js.map +1 -1
- package/lib/common/features/model/gmodel-serializer.d.ts +10 -10
- package/lib/common/features/model/gmodel-serializer.d.ts.map +1 -1
- package/lib/common/features/model/gmodel-serializer.js +2 -1
- package/lib/common/features/model/gmodel-serializer.js.map +1 -1
- package/lib/common/features/model/model-state.d.ts.map +1 -1
- package/lib/common/features/model/model-state.js +5 -1
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +28 -3
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +63 -8
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/request-model-action-handler.js +5 -4
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +2 -1
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-resolver.js +2 -1
- package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js +2 -1
- package/lib/common/features/navigation/resolve-navigation-targets-action-handler.js.map +1 -1
- package/lib/common/features/popup/request-popup-model-action-handler.js +2 -1
- package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
- package/lib/common/features/progress/progress-service.js +2 -1
- package/lib/common/features/progress/progress-service.js.map +1 -1
- package/lib/common/features/type-hints/edge-creation-checker.d.ts +42 -0
- package/lib/common/features/type-hints/edge-creation-checker.d.ts.map +1 -0
- package/lib/common/features/type-hints/edge-creation-checker.js +20 -0
- package/lib/common/features/type-hints/edge-creation-checker.js.map +1 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.d.ts +29 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.d.ts.map +1 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.js +72 -0
- package/lib/common/features/type-hints/request-check-edge-action-handler.js.map +1 -0
- package/lib/common/{diagram → features/type-hints}/request-type-hints-action-handler.d.ts +2 -3
- package/lib/common/features/type-hints/request-type-hints-action-handler.d.ts.map +1 -0
- package/lib/common/{diagram → features/type-hints}/request-type-hints-action-handler.js +3 -3
- package/lib/common/features/type-hints/request-type-hints-action-handler.js.map +1 -0
- package/lib/common/features/validation/model-validator.js +2 -1
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +2 -1
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +2 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.js +7 -4
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.d.ts +1 -1
- package/lib/common/gmodel/delete-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +7 -6
- package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +3 -3
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +3 -3
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +2 -1
- package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +2 -1
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
- package/lib/common/index.d.ts +3 -1
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +3 -1
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -1
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +2 -1
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
- package/lib/common/operations/compound-operation-handler.d.ts +5 -0
- package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/compound-operation-handler.js +8 -2
- package/lib/common/operations/compound-operation-handler.js.map +1 -1
- package/lib/common/operations/create-operation-handler.d.ts +19 -5
- package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/create-operation-handler.js +2 -1
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/operations/json-operation-handler.d.ts +94 -0
- package/lib/common/operations/json-operation-handler.d.ts.map +1 -0
- package/lib/common/operations/json-operation-handler.js +120 -0
- package/lib/common/operations/json-operation-handler.js.map +1 -0
- package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-action-handler.js +3 -2
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/operations/operation-handler-registry.d.ts +1 -9
- package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
- package/lib/common/operations/operation-handler-registry.js +4 -12
- package/lib/common/operations/operation-handler-registry.js.map +1 -1
- package/lib/common/operations/operation-handler.d.ts +2 -2
- package/lib/common/operations/operation-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-handler.js +2 -1
- package/lib/common/operations/operation-handler.js.map +1 -1
- package/lib/common/protocol/client-action.d.ts +31 -0
- package/lib/common/protocol/client-action.d.ts.map +1 -0
- package/lib/common/protocol/client-action.js +35 -0
- package/lib/common/protocol/client-action.js.map +1 -0
- package/lib/common/protocol/glsp-server.d.ts +1 -1
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +9 -10
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.js +5 -4
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.js +2 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/utils/console-logger.js +2 -1
- package/lib/common/utils/console-logger.js.map +1 -1
- package/lib/common/utils/logger.js +2 -1
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/common/utils/promise-queue.d.ts.map +1 -1
- package/lib/common/utils/promise-queue.js +3 -6
- package/lib/common/utils/promise-queue.js.map +1 -1
- package/lib/common/utils/registry.d.ts +3 -1
- package/lib/common/utils/registry.d.ts.map +1 -1
- package/lib/common/utils/registry.js +15 -4
- package/lib/common/utils/registry.js.map +1 -1
- package/lib/node/abstract-json-model-storage.js +2 -1
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/gmodel/gmodel-storage.d.ts.map +1 -1
- package/lib/node/gmodel/gmodel-storage.js +4 -2
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +2 -1
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +2 -1
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +4 -4
- package/src/common/actions/action-dispatcher.spec.ts +3 -2
- package/src/common/actions/action-dispatcher.ts +8 -5
- package/src/common/actions/client-action-handler.ts +28 -18
- package/src/common/actions/global-action-provider.spec.ts +4 -15
- package/src/common/actions/global-action-provider.ts +21 -25
- package/src/common/command/recording-command.spec.ts +15 -5
- package/src/common/command/recording-command.ts +16 -27
- package/src/common/di/client-session-module.ts +17 -10
- package/src/common/di/diagram-module.ts +23 -75
- package/src/common/di/server-module.ts +0 -1
- package/src/common/features/clipboard/request-clipboard-data-action-handler.ts +3 -3
- package/src/common/features/model/gmodel-serializer.ts +11 -11
- package/src/common/features/model/model-state.ts +3 -0
- package/src/common/features/model/model-submission-handler.ts +52 -7
- package/src/common/features/model/request-model-action-handler.ts +4 -4
- package/src/common/features/type-hints/edge-creation-checker.ts +44 -0
- package/src/common/features/type-hints/request-check-edge-action-handler.ts +62 -0
- package/src/common/{diagram → features/type-hints}/request-type-hints-action-handler.spec.ts +2 -2
- package/src/common/{diagram → features/type-hints}/request-type-hints-action-handler.ts +2 -3
- package/src/common/gmodel/cut-operation-handler.ts +5 -3
- package/src/common/gmodel/delete-operation-handler.ts +6 -5
- package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +3 -3
- package/src/common/gmodel/gmodel-create-node-operation-handler.ts +3 -3
- package/src/common/gmodel/paste-operation-handler.ts +2 -2
- package/src/common/index.ts +3 -1
- package/src/common/operations/compound-operation-handler.ts +6 -1
- package/src/common/operations/create-operation-handler.ts +22 -5
- package/src/common/operations/json-operation-handler.ts +147 -0
- package/src/common/operations/operation-action-handler.ts +2 -2
- package/src/common/operations/operation-handler-registry.ts +1 -12
- package/src/common/operations/operation-handler.ts +2 -2
- package/src/common/protocol/client-action.ts +38 -0
- package/src/common/protocol/glsp-server.spec.ts +11 -10
- package/src/common/protocol/glsp-server.ts +11 -14
- package/src/common/session/client-session-factory.spec.ts +2 -2
- package/src/common/session/client-session-factory.ts +3 -3
- package/src/common/session/client-session-manager.spec.ts +4 -3
- package/src/common/utils/promise-queue.ts +4 -5
- package/src/common/utils/registry.spec.ts +3 -1
- package/src/common/utils/registry.ts +8 -3
- package/src/node/gmodel/gmodel-storage.ts +3 -3
- package/lib/common/diagram/request-type-hints-action-handler.d.ts.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.js.map +0 -1
|
@@ -26,7 +26,7 @@ const inversify_1 = require("inversify");
|
|
|
26
26
|
const jsonrpc = require("vscode-jsonrpc/browser");
|
|
27
27
|
const jsonrpc_server_launcher_1 = require("../../common/launch/jsonrpc-server-launcher");
|
|
28
28
|
exports.START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed.';
|
|
29
|
-
let WorkerServerLauncher =
|
|
29
|
+
let WorkerServerLauncher = class WorkerServerLauncher extends jsonrpc_server_launcher_1.JsonRpcGLSPServerLauncher {
|
|
30
30
|
run(options) {
|
|
31
31
|
if (this.connection) {
|
|
32
32
|
throw new Error('Error during launch. Server already has an active client connection');
|
|
@@ -50,6 +50,7 @@ let WorkerServerLauncher = exports.WorkerServerLauncher = class WorkerServerLaun
|
|
|
50
50
|
return jsonrpc.createMessageConnection(new jsonrpc.BrowserMessageReader((_a = options.context) !== null && _a !== void 0 ? _a : self), new jsonrpc.BrowserMessageWriter((_b = options.context) !== null && _b !== void 0 ? _b : self));
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
+
exports.WorkerServerLauncher = WorkerServerLauncher;
|
|
53
54
|
exports.WorkerServerLauncher = WorkerServerLauncher = __decorate([
|
|
54
55
|
(0, inversify_1.injectable)()
|
|
55
56
|
], WorkerServerLauncher);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"worker-server-launcher.js","sourceRoot":"","sources":["../../../src/browser/launch/worker-server-launcher.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;kFAckF;;;;;;;;;AAElF,yCAAuC;AACvC,kDAAkD;AAElD,yFAA+G;AAKlG,QAAA,qBAAqB,GAAG,kCAAkC,CAAC;AAGjE,IAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"worker-server-launcher.js","sourceRoot":"","sources":["../../../src/browser/launch/worker-server-launcher.ts"],"names":[],"mappings":";AAAA;;;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CACJ,CAAA;AA5BY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAU,GAAE;GACA,oBAAoB,CA4BhC"}
|
|
@@ -17,6 +17,7 @@ import { Action, Disposable, MaybeArray } from '@eclipse-glsp/protocol';
|
|
|
17
17
|
import { PromiseQueue } from '../utils/promise-queue';
|
|
18
18
|
import { ActionHandler } from './action-handler';
|
|
19
19
|
import { ActionHandlerRegistry } from './action-handler-registry';
|
|
20
|
+
import { ClientActionForwarder } from './client-action-handler';
|
|
20
21
|
export declare const ActionDispatcher: unique symbol;
|
|
21
22
|
/**
|
|
22
23
|
* The central component that process all {@link Action}s by dispatching them to their designated
|
|
@@ -50,7 +51,7 @@ export interface ActionDispatcher {
|
|
|
50
51
|
}
|
|
51
52
|
export declare class DefaultActionDispatcher implements ActionDispatcher, Disposable {
|
|
52
53
|
protected actionHandlerRegistry: ActionHandlerRegistry;
|
|
53
|
-
protected
|
|
54
|
+
protected clientActionForwarder: ClientActionForwarder;
|
|
54
55
|
private logger;
|
|
55
56
|
protected clientId: string;
|
|
56
57
|
protected actionQueue: PromiseQueue<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAY,UAAU,EAAoD,MAAM,wBAAwB,CAAC;AAKpI,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"action-dispatcher.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAE,UAAU,EAAY,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O,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAK1F,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS7D,WAAW,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAS5D,uBAAuB,CAAC,GAAG,OAAO,EAAE,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,IAAI;IAM/D,OAAO,IAAI,IAAI;CAGlB;AAED;;;;;;GAMG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAKjE"}
|
|
@@ -32,23 +32,25 @@ const glsp_server_error_1 = require("../utils/glsp-server-error");
|
|
|
32
32
|
const logger_1 = require("../utils/logger");
|
|
33
33
|
const promise_queue_1 = require("../utils/promise-queue");
|
|
34
34
|
const action_handler_registry_1 = require("./action-handler-registry");
|
|
35
|
+
const client_action_handler_1 = require("./client-action-handler");
|
|
35
36
|
exports.ActionDispatcher = Symbol('ActionDispatcher');
|
|
36
|
-
let DefaultActionDispatcher =
|
|
37
|
+
let DefaultActionDispatcher = class DefaultActionDispatcher {
|
|
37
38
|
constructor() {
|
|
38
39
|
this.actionQueue = new promise_queue_1.PromiseQueue();
|
|
39
40
|
this.postUpdateQueue = [];
|
|
40
41
|
}
|
|
41
42
|
dispatch(action) {
|
|
42
43
|
// Dont queue actions that are just delegated to the client
|
|
43
|
-
if (this.
|
|
44
|
+
if (this.clientActionForwarder.shouldForwardToClient(action)) {
|
|
44
45
|
return this.doDispatch(action);
|
|
45
46
|
}
|
|
46
47
|
return this.actionQueue.enqueue(() => this.doDispatch(action));
|
|
47
48
|
}
|
|
48
49
|
async doDispatch(action) {
|
|
49
50
|
this.logger.debug('Dispatch action:', action.kind);
|
|
51
|
+
const handledOnClient = this.clientActionForwarder.handle(action);
|
|
50
52
|
const actionHandlers = this.actionHandlerRegistry.get(action.kind);
|
|
51
|
-
if (actionHandlers.length === 0) {
|
|
53
|
+
if (!handledOnClient && actionHandlers.length === 0) {
|
|
52
54
|
throw new glsp_server_error_1.GLSPServerError(`No handler registered for action kind: ${action.kind}`);
|
|
53
55
|
}
|
|
54
56
|
const responses = [];
|
|
@@ -91,14 +93,15 @@ let DefaultActionDispatcher = exports.DefaultActionDispatcher = class DefaultAct
|
|
|
91
93
|
this.actionQueue.clear();
|
|
92
94
|
}
|
|
93
95
|
};
|
|
96
|
+
exports.DefaultActionDispatcher = DefaultActionDispatcher;
|
|
94
97
|
__decorate([
|
|
95
98
|
(0, inversify_1.inject)(action_handler_registry_1.ActionHandlerRegistry),
|
|
96
99
|
__metadata("design:type", action_handler_registry_1.ActionHandlerRegistry)
|
|
97
100
|
], DefaultActionDispatcher.prototype, "actionHandlerRegistry", void 0);
|
|
98
101
|
__decorate([
|
|
99
|
-
(0, inversify_1.inject)(
|
|
100
|
-
__metadata("design:type",
|
|
101
|
-
], DefaultActionDispatcher.prototype, "
|
|
102
|
+
(0, inversify_1.inject)(client_action_handler_1.ClientActionForwarder),
|
|
103
|
+
__metadata("design:type", client_action_handler_1.ClientActionForwarder)
|
|
104
|
+
], DefaultActionDispatcher.prototype, "clientActionForwarder", void 0);
|
|
102
105
|
__decorate([
|
|
103
106
|
(0, inversify_1.inject)(logger_1.Logger),
|
|
104
107
|
__metadata("design:type", logger_1.Logger)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.js","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAoI;AACpI,yCAA+C;AAC/C,
|
|
1
|
+
{"version":3,"file":"action-dispatcher.js","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF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mBAAQ,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;IAED,uBAAuB,CAAC,GAAG,OAA6B;QACpD,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE;YACtB,IAAA,mBAAQ,EAAC,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,CAAC;SAC3C;IACL,CAAC;IAED,OAAO;QACH,IAAI,CAAC,WAAW,CAAC,KAAK,EAAE,CAAC;IAC7B,CAAC;CACJ,CAAA;AA/EY,0DAAuB;AAEtB;IADT,IAAA,kBAAM,EAAC,+CAAqB,CAAC;8BACG,+CAAqB;sEAAC;AAG7C;IADT,IAAA,kBAAM,EAAC,6CAAqB,CAAC;8BACG,6CAAqB;sEAAC;AAG/C;IADP,IAAA,kBAAM,EAAC,eAAM,CAAC;8BACC,eAAM;uDAAC;AAGb;IADT,IAAA,kBAAM,EAAC,8BAAQ,CAAC;;yDACU;kCAXlB,uBAAuB;IADnC,IAAA,sBAAU,GAAE;GACA,uBAAuB,CA+EnC;AAED;;;;;;GAMG;AACH,SAAgB,OAAO,CAAC,OAAe,EAAE,QAAgB;IACrD,IAAI,wBAAa,CAAC,EAAE,CAAC,OAAO,CAAC,IAAI,yBAAc,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE;QACzD,QAAgB,CAAC,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC;KACpD;IACD,OAAO,QAAQ,CAAC;AACpB,CAAC;AALD,0BAKC"}
|
|
@@ -16,7 +16,7 @@ const action_handler_1 = require("./action-handler");
|
|
|
16
16
|
/**
|
|
17
17
|
* An action handler registry keeps track of registered action handlers for a certain action.
|
|
18
18
|
*/
|
|
19
|
-
let ActionHandlerRegistry =
|
|
19
|
+
let ActionHandlerRegistry = class ActionHandlerRegistry extends registry_1.MultiRegistry {
|
|
20
20
|
registerHandler(handler) {
|
|
21
21
|
return handler.actionKinds.forEach(kind => this.register(kind, handler));
|
|
22
22
|
}
|
|
@@ -32,10 +32,11 @@ let ActionHandlerRegistry = exports.ActionHandlerRegistry = class ActionHandlerR
|
|
|
32
32
|
return result.sort((a, b) => { var _a, _b; return (_a = a.priority) !== null && _a !== void 0 ? _a : 0 - ((_b = b.priority) !== null && _b !== void 0 ? _b : 0); });
|
|
33
33
|
}
|
|
34
34
|
};
|
|
35
|
+
exports.ActionHandlerRegistry = ActionHandlerRegistry;
|
|
35
36
|
exports.ActionHandlerRegistry = ActionHandlerRegistry = __decorate([
|
|
36
37
|
(0, inversify_1.injectable)()
|
|
37
38
|
], ActionHandlerRegistry);
|
|
38
|
-
let ActionHandlerRegistryInitializer =
|
|
39
|
+
let ActionHandlerRegistryInitializer = class ActionHandlerRegistryInitializer {
|
|
39
40
|
constructor() {
|
|
40
41
|
this.handlerConstructors = [];
|
|
41
42
|
}
|
|
@@ -44,6 +45,7 @@ let ActionHandlerRegistryInitializer = exports.ActionHandlerRegistryInitializer
|
|
|
44
45
|
handlers.forEach(handler => this.registry.registerHandler(handler));
|
|
45
46
|
}
|
|
46
47
|
};
|
|
48
|
+
exports.ActionHandlerRegistryInitializer = ActionHandlerRegistryInitializer;
|
|
47
49
|
__decorate([
|
|
48
50
|
(0, inversify_1.inject)(action_handler_1.ActionHandlerFactory),
|
|
49
51
|
__metadata("design:type", Function)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler-registry.js","sourceRoot":"","sources":["../../../src/common/actions/action-handler-registry.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAAyD;AAEzD,gDAAkD;AAClD,qDAAiG;AAEjG;;GAEG;AAEI,IAAM,qBAAqB,
|
|
1
|
+
{"version":3,"file":"action-handler-registry.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iEACW;AAI9B;IAFT,IAAA,kBAAM,EAAC,yCAAwB,CAAC;IAChC,IAAA,oBAAQ,GAAE;;6EACoD;AAGrD;IADT,IAAA,kBAAM,EAAC,qBAAqB,CAAC;8BACV,qBAAqB;kEAAC;2CATjC,gCAAgC;IAD5C,IAAA,sBAAU,GAAE;GACA,gCAAgC,CAe5C"}
|
|
@@ -15,15 +15,24 @@
|
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { Action, GLSPClientProxy } from '@eclipse-glsp/protocol';
|
|
17
17
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
18
|
+
* Component responsible for forwarding actions that are (also) handled by the
|
|
19
|
+
* client
|
|
20
20
|
*/
|
|
21
|
-
export declare class
|
|
22
|
-
actionKinds: string
|
|
23
|
-
protected glspClient
|
|
21
|
+
export declare class ClientActionForwarder {
|
|
22
|
+
actionKinds: Set<string>;
|
|
23
|
+
protected glspClient: GLSPClientProxy;
|
|
24
24
|
protected readonly clientId: string;
|
|
25
|
-
constructor(actionKinds
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
constructor(actionKinds: Set<string>);
|
|
26
|
+
/**
|
|
27
|
+
* Processes the given action and checks wether it is a
|
|
28
|
+
* `clientAction` i.e. an action that should be forwarded to
|
|
29
|
+
* the client to be handled there. If the check is successful
|
|
30
|
+
* the action is wrapped in an {@link ActionMessage} and sent to the client.
|
|
31
|
+
*
|
|
32
|
+
* @param action The action to check and forward
|
|
33
|
+
* @return `true` if the action was forwarded to the client, `false` otherwise
|
|
34
|
+
*/
|
|
35
|
+
handle(action: Action): boolean;
|
|
36
|
+
shouldForwardToClient(action: Action): boolean;
|
|
28
37
|
}
|
|
29
38
|
//# sourceMappingURL=client-action-handler.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/actions/client-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAiB,eAAe,
|
|
1
|
+
{"version":3,"file":"client-action-handler.d.ts","sourceRoot":"","sources":["../../../src/common/actions/client-action-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAClF,OAAO,EAAE,MAAM,EAAiB,eAAe,EAAkB,MAAM,wBAAwB,CAAC;AAKhG;;;GAGG;AACH,qBACa,qBAAqB;IAOgB,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC;IALtE,SAAS,CAAC,UAAU,EAAE,eAAe,CAAC;IAGtC,SAAS,CAAC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;gBAEU,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC;IAEtE;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;IAS/B,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO;CAMjD"}
|
|
@@ -12,7 +12,7 @@ var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
13
|
};
|
|
14
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.
|
|
15
|
+
exports.ClientActionForwarder = void 0;
|
|
16
16
|
/********************************************************************************
|
|
17
17
|
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
18
18
|
*
|
|
@@ -31,40 +31,51 @@ exports.ClientActionHandler = void 0;
|
|
|
31
31
|
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
32
32
|
const inversify_1 = require("inversify");
|
|
33
33
|
const service_identifiers_1 = require("../di/service-identifiers");
|
|
34
|
+
const client_action_1 = require("../protocol/client-action");
|
|
34
35
|
/**
|
|
35
|
-
*
|
|
36
|
-
*
|
|
36
|
+
* Component responsible for forwarding actions that are (also) handled by the
|
|
37
|
+
* client
|
|
37
38
|
*/
|
|
38
|
-
let
|
|
39
|
-
constructor(actionKinds
|
|
39
|
+
let ClientActionForwarder = class ClientActionForwarder {
|
|
40
|
+
constructor(actionKinds) {
|
|
40
41
|
this.actionKinds = actionKinds;
|
|
41
42
|
}
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
/**
|
|
44
|
+
* Processes the given action and checks wether it is a
|
|
45
|
+
* `clientAction` i.e. an action that should be forwarded to
|
|
46
|
+
* the client to be handled there. If the check is successful
|
|
47
|
+
* the action is wrapped in an {@link ActionMessage} and sent to the client.
|
|
48
|
+
*
|
|
49
|
+
* @param action The action to check and forward
|
|
50
|
+
* @return `true` if the action was forwarded to the client, `false` otherwise
|
|
51
|
+
*/
|
|
52
|
+
handle(action) {
|
|
53
|
+
if (this.shouldForwardToClient(action)) {
|
|
54
|
+
const message = { action, clientId: this.clientId };
|
|
49
55
|
this.glspClient.process(message);
|
|
50
|
-
return;
|
|
56
|
+
return true;
|
|
57
|
+
}
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
shouldForwardToClient(action) {
|
|
61
|
+
if (client_action_1.ClientAction.is(action)) {
|
|
62
|
+
return false;
|
|
51
63
|
}
|
|
52
|
-
|
|
64
|
+
return this.actionKinds.has(action.kind) || protocol_1.ResponseAction.is(action);
|
|
53
65
|
}
|
|
54
66
|
};
|
|
67
|
+
exports.ClientActionForwarder = ClientActionForwarder;
|
|
55
68
|
__decorate([
|
|
56
69
|
(0, inversify_1.inject)(protocol_1.GLSPClientProxy),
|
|
57
|
-
(0, inversify_1.optional)(),
|
|
58
70
|
__metadata("design:type", Object)
|
|
59
|
-
],
|
|
71
|
+
], ClientActionForwarder.prototype, "glspClient", void 0);
|
|
60
72
|
__decorate([
|
|
61
73
|
(0, inversify_1.inject)(service_identifiers_1.ClientId),
|
|
62
74
|
__metadata("design:type", String)
|
|
63
|
-
],
|
|
64
|
-
exports.
|
|
75
|
+
], ClientActionForwarder.prototype, "clientId", void 0);
|
|
76
|
+
exports.ClientActionForwarder = ClientActionForwarder = __decorate([
|
|
65
77
|
(0, inversify_1.injectable)(),
|
|
66
78
|
__param(0, (0, inversify_1.inject)(service_identifiers_1.ClientActionKinds)),
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
], ClientActionHandler);
|
|
79
|
+
__metadata("design:paramtypes", [Set])
|
|
80
|
+
], ClientActionForwarder);
|
|
70
81
|
//# sourceMappingURL=client-action-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-action-handler.js","sourceRoot":"","sources":["../../../src/common/actions/client-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,
|
|
1
|
+
{"version":3,"file":"client-action-handler.js","sourceRoot":"","sources":["../../../src/common/actions/client-action-handler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,qDAAgG;AAChG,yCAA+C;AAC/C,mEAAwE;AACxE,6DAAyD;AAEzD;;;GAGG;AAEI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAO9B,YAA8C,WAAwB;QAAxB,gBAAW,GAAX,WAAW,CAAa;IAAG,CAAC;IAE1E;;;;;;;;OAQG;IACH,MAAM,CAAC,MAAc;QACjB,IAAI,IAAI,CAAC,qBAAqB,CAAC,MAAM,CAAC,EAAE;YACpC,MAAM,OAAO,GAAkB,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC;YACnE,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;YACjC,OAAO,IAAI,CAAC;SACf;QACD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,qBAAqB,CAAC,MAAc;QAChC,IAAI,4BAAY,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE;YACzB,OAAO,KAAK,CAAC;SAChB;QACD,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,yBAAc,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IAC1E,CAAC;CACJ,CAAA;AAjCY,sDAAqB;AAEpB;IADT,IAAA,kBAAM,EAAC,0BAAe,CAAC;;yDACc;AAGnB;IADlB,IAAA,kBAAM,EAAC,8BAAQ,CAAC;;uDACmB;gCAL3B,qBAAqB;IADjC,IAAA,sBAAU,GAAE;IAQI,WAAA,IAAA,kBAAM,EAAC,uCAAiB,CAAC,CAAA;qCAAqB,GAAG;GAPrD,qBAAqB,CAiCjC"}
|
|
@@ -1,30 +1,15 @@
|
|
|
1
|
-
/********************************************************************************
|
|
2
|
-
* Copyright (c) 2022-2023 STMicroelectronics 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
1
|
import { Container, ContainerModule } from 'inversify';
|
|
17
2
|
export declare const GlobalActionProvider: unique symbol;
|
|
3
|
+
/**
|
|
4
|
+
* Provides a map of handled action kinds grouped by `diagramType`
|
|
5
|
+
*/
|
|
18
6
|
export interface GlobalActionProvider {
|
|
19
|
-
readonly
|
|
20
|
-
readonly clientActionKinds: Map<string, string[]>;
|
|
7
|
+
readonly actionKinds: Map<string, string[]>;
|
|
21
8
|
}
|
|
22
9
|
export declare class DefaultGlobalActionProvider implements GlobalActionProvider {
|
|
23
|
-
readonly
|
|
24
|
-
readonly clientActionKinds: Map<string, string[]>;
|
|
10
|
+
readonly actionKinds: Map<string, string[]>;
|
|
25
11
|
constructor(serverContainer: Container, diagramModules: Map<string, ContainerModule[]>);
|
|
26
12
|
createDiagramContainer(serverContainer: Container, modules: ContainerModule[]): Container;
|
|
27
|
-
|
|
28
|
-
loadClientActionKinds(diagramType: string, diagramContainer: Container): void;
|
|
13
|
+
loadActionKinds(diagramType: string, diagramContainer: Container): void;
|
|
29
14
|
}
|
|
30
15
|
//# sourceMappingURL=global-action-provider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-action-provider.d.ts","sourceRoot":"","sources":["../../../src/common/actions/global-action-provider.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"global-action-provider.d.ts","sourceRoot":"","sources":["../../../src/common/actions/global-action-provider.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAsB,MAAM,WAAW,CAAC;AAM3E,eAAO,MAAM,oBAAoB,eAAiC,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACjC,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CAC/C;AAED,qBACa,2BAA4B,YAAW,oBAAoB;IACpE,SAAgB,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;gBAGnB,eAAe,EAAE,SAAS,EAC9B,cAAc,EAAE,GAAG,CAAC,MAAM,EAAE,eAAe,EAAE,CAAC;IAY1E,sBAAsB,CAAC,eAAe,EAAE,SAAS,EAAE,OAAO,EAAE,eAAe,EAAE,GAAG,SAAS;IAYzF,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,gBAAgB,EAAE,SAAS,GAAG,IAAI;CAM1E"}
|
|
@@ -28,48 +28,44 @@ exports.DefaultGlobalActionProvider = exports.GlobalActionProvider = 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 protocol_1 = require("@eclipse-glsp/protocol");
|
|
31
32
|
const inversify_1 = require("inversify");
|
|
33
|
+
const client_session_module_1 = require("../di/client-session-module");
|
|
32
34
|
const service_identifiers_1 = require("../di/service-identifiers");
|
|
33
35
|
const client_session_initializer_1 = require("../session/client-session-initializer");
|
|
34
36
|
const action_handler_registry_1 = require("./action-handler-registry");
|
|
35
|
-
const client_action_handler_1 = require("./client-action-handler");
|
|
36
37
|
exports.GlobalActionProvider = Symbol('GlobalActionProvider');
|
|
37
|
-
let DefaultGlobalActionProvider =
|
|
38
|
+
let DefaultGlobalActionProvider = class DefaultGlobalActionProvider {
|
|
38
39
|
constructor(serverContainer, diagramModules) {
|
|
39
|
-
this.
|
|
40
|
-
this.clientActionKinds = new Map();
|
|
40
|
+
this.actionKinds = new Map();
|
|
41
41
|
diagramModules.forEach((modules, diagramType) => {
|
|
42
42
|
const container = this.createDiagramContainer(serverContainer, modules);
|
|
43
43
|
const initializers = container.getAll(client_session_initializer_1.ClientSessionInitializer);
|
|
44
44
|
initializers.forEach(service => service.initialize());
|
|
45
|
-
this.
|
|
46
|
-
this.loadClientActionKinds(diagramType, container);
|
|
45
|
+
this.loadActionKinds(diagramType, container);
|
|
47
46
|
container.unbindAll();
|
|
48
47
|
});
|
|
49
48
|
}
|
|
50
49
|
createDiagramContainer(serverContainer, modules) {
|
|
51
50
|
const container = serverContainer.createChild();
|
|
52
|
-
|
|
51
|
+
const clientSessionModule = (0, client_session_module_1.createClientSessionModule)({
|
|
52
|
+
clientId: 'tempId',
|
|
53
|
+
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
54
|
+
glspClient: { process: () => { } },
|
|
55
|
+
clientActionKinds: []
|
|
56
|
+
});
|
|
57
|
+
container.load(...modules, clientSessionModule);
|
|
53
58
|
return container;
|
|
54
59
|
}
|
|
55
|
-
|
|
60
|
+
loadActionKinds(diagramType, diagramContainer) {
|
|
56
61
|
var _a;
|
|
57
62
|
const handlerRegistry = diagramContainer.get(action_handler_registry_1.ActionHandlerRegistry);
|
|
58
|
-
const diagramServerActions = (_a = this.
|
|
59
|
-
handlerRegistry
|
|
60
|
-
|
|
61
|
-
.filter(handler => !(handler instanceof client_action_handler_1.ClientActionHandler))
|
|
62
|
-
.forEach(handler => diagramServerActions.push(...handler.actionKinds));
|
|
63
|
-
this.serverActionKinds.set(diagramType, [...new Set(diagramServerActions)]);
|
|
64
|
-
}
|
|
65
|
-
loadClientActionKinds(diagramType, diagramContainer) {
|
|
66
|
-
var _a;
|
|
67
|
-
const clientActionKinds = diagramContainer.getAll(service_identifiers_1.ClientActionKinds);
|
|
68
|
-
const diagramClientActions = (_a = this.clientActionKinds.get(diagramType)) !== null && _a !== void 0 ? _a : [];
|
|
69
|
-
diagramClientActions.push(...clientActionKinds);
|
|
70
|
-
this.clientActionKinds.set(diagramType, diagramClientActions);
|
|
63
|
+
const diagramServerActions = (_a = this.actionKinds.get(diagramType)) !== null && _a !== void 0 ? _a : [];
|
|
64
|
+
handlerRegistry.getAll().forEach(handler => (0, protocol_1.distinctAdd)(diagramServerActions, ...handler.actionKinds));
|
|
65
|
+
this.actionKinds.set(diagramType, diagramServerActions);
|
|
71
66
|
}
|
|
72
67
|
};
|
|
68
|
+
exports.DefaultGlobalActionProvider = DefaultGlobalActionProvider;
|
|
73
69
|
exports.DefaultGlobalActionProvider = DefaultGlobalActionProvider = __decorate([
|
|
74
70
|
(0, inversify_1.injectable)(),
|
|
75
71
|
__param(0, (0, inversify_1.inject)(service_identifiers_1.InjectionContainer)),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"global-action-provider.js","sourceRoot":"","sources":["../../../src/common/actions/global-action-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,yCAA2E;AAC3E,
|
|
1
|
+
{"version":3,"file":"global-action-provider.js","s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AAC,WAAmB,EAAE,gBAA2B;;QAC5D,MAAM,eAAe,GAAG,gBAAgB,CAAC,GAAG,CAAwB,+CAAqB,CAAC,CAAC;QAC3F,MAAM,oBAAoB,GAAG,MAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,CAAC,mCAAI,EAAE,CAAC;QACrE,eAAe,CAAC,MAAM,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,IAAA,sBAAW,EAAC,oBAAoB,EAAE,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC;QACvG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,WAAW,EAAE,oBAAoB,CAAC,CAAC;IAC5D,CAAC;CACJ,CAAA;AAnCY,kEAA2B;sCAA3B,2BAA2B;IADvC,IAAA,sBAAU,GAAE;IAKJ,WAAA,IAAA,kBAAM,EAAC,wCAAkB,CAAC,CAAA;IAC1B,WAAA,IAAA,kBAAM,EAAC,oCAAc,CAAC,CAAA;qCADsB,qBAAS;QACd,GAAG;GALtC,2BAA2B,CAmCvC"}
|
|
@@ -14,7 +14,7 @@ const inversify_1 = require("inversify");
|
|
|
14
14
|
const logger_1 = require("../utils/logger");
|
|
15
15
|
const command_1 = require("./command");
|
|
16
16
|
exports.CommandStack = Symbol('CommandStack');
|
|
17
|
-
let DefaultCommandStack =
|
|
17
|
+
let DefaultCommandStack = class DefaultCommandStack {
|
|
18
18
|
constructor() {
|
|
19
19
|
this.commands = [];
|
|
20
20
|
/**
|
|
@@ -91,6 +91,7 @@ let DefaultCommandStack = exports.DefaultCommandStack = class DefaultCommandStac
|
|
|
91
91
|
throw error;
|
|
92
92
|
}
|
|
93
93
|
};
|
|
94
|
+
exports.DefaultCommandStack = DefaultCommandStack;
|
|
94
95
|
__decorate([
|
|
95
96
|
(0, inversify_1.inject)(logger_1.Logger),
|
|
96
97
|
__metadata("design:type", logger_1.Logger)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-stack.js","sourceRoot":"","sources":["../../../src/common/command/command-stack.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,4CAAyC;AACzC,uCAAoC;AAEvB,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAqD5C,IAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"command-stack.js","sourceRoot":"","sources":["../../../src/common/command/command-stack.ts"],"names":[],"mappings":";;;;;;;;;;;;AAgBA,yCAA+C;AAC/C,4CAAyC;AACzC,uCAAoC;AAEvB,QAAA,YAAY,GAAG,MAAM,CAAC,cAAc,CAAC,CAAC;AAqD5C,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAAzB;QAIO,aAAQ,GAAc,EAAE,CAAC;QAEnC;;WAEG;QACO,QAAG,GAAG,CAAC,CAAC,CAAC;QAEnB;;WAEG;QACO,cAAS,GAAG,CAAC,CAAC,CAAC;IAwE7B,CAAC;IAtEG,KAAK,CAAC,OAAO,CAAC,OAAgB;QAC1B,IAAI;YACA,MAAM,OAAO,CAAC,OAAO,EAAE,CAAC;SAC3B;QAAC,OAAO,KAAK,EAAE;YACZ,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;SAC3B;QACD,+DAA+D;QAC/D,IAAI,CAAC,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,GAAG,CAAC,CAAC,CAAC;QACrD,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC5B,EAAE,IAAI,CAAC,GAAG,CAAC;QAEX,gFAAgF;QAChF,4EAA4E;QAC5E,IAAI,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,GAAG,EAAE;YAC5B,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC,CAAC;SACvB;IACL,CAAC;IAED,KAAK,CAAC,IAAI;QACN,IAAI,IAAI,CAAC,OAAO,EAAE,EAAE;YAChB,MAAM,OAA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CAAC,KAAK,EAAE,CAAC;QACb,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,2EAA2E,EAAE,KAAK,CAAC,CAAC;QACtG,MAAM,KAAK,CAAC;IAChB,CAAC;CACJ,CAAA;AAtFY,kDAAmB;AAElB;IADT,IAAA,kBAAM,EAAC,eAAM,CAAC;8BACG,eAAM;mDAAC;8BAFhB,mBAAmB;IAD/B,IAAA,sBAAU,GAAE;GACA,mBAAmB,CAsF/B"}
|
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { GModelRootSchema } from '@eclipse-glsp/
|
|
17
|
-
import { AnyObject, MaybePromise } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { AnyObject, GModelElementSchema, GModelRootSchema, MaybePromise } from '@eclipse-glsp/protocol';
|
|
18
17
|
import * as jsonPatch from 'fast-json-patch';
|
|
19
18
|
import { GModelSerializer } from '../features/model/gmodel-serializer';
|
|
20
19
|
import { ModelState } from '../features/model/model-state';
|
|
@@ -37,7 +36,7 @@ export declare abstract class AbstractRecordingCommand<JsonObject extends AnyObj
|
|
|
37
36
|
* The actual execution i.e. series of changes applied to the JSOn object that should be captured.
|
|
38
37
|
*/
|
|
39
38
|
protected abstract doExecute(): MaybePromise<void>;
|
|
40
|
-
protected applyPatch(object: JsonObject, patch: jsonPatch.Operation[]):
|
|
39
|
+
protected applyPatch(object: JsonObject, patch: jsonPatch.Operation[]): jsonPatch.PatchResult<JsonObject>;
|
|
41
40
|
/**
|
|
42
41
|
* Captures the original state of the JSON object before executing the command routine.
|
|
43
42
|
* This implementation cannot clone circular structures as it relies on `JSON.stringify`.
|
|
@@ -48,16 +47,12 @@ export declare abstract class AbstractRecordingCommand<JsonObject extends AnyObj
|
|
|
48
47
|
undo(): Promise<void>;
|
|
49
48
|
redo(): Promise<void>;
|
|
50
49
|
canUndo(): boolean;
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
protected jsonObject: JsonObject;
|
|
58
|
-
protected doExecute: () => MaybePromise<void>;
|
|
59
|
-
constructor(jsonObject: JsonObject, doExecute: () => MaybePromise<void>);
|
|
60
|
-
protected getJsonObject(): MaybePromise<JsonObject>;
|
|
50
|
+
/**
|
|
51
|
+
* Optional hook that (if implemented) will be
|
|
52
|
+
* executed after every command-driven action that changed
|
|
53
|
+
* the underlying model i.e. command execute, undo and redo.
|
|
54
|
+
*/
|
|
55
|
+
protected postChange?(newModel: JsonObject): MaybePromise<void>;
|
|
61
56
|
}
|
|
62
57
|
/**
|
|
63
58
|
* Simple base implementation of {@link AbstractRecordingCommand} that allows recording of changes made
|
|
@@ -68,8 +63,7 @@ export declare class GModelRecordingCommand extends AbstractRecordingCommand<GMo
|
|
|
68
63
|
protected serializer: GModelSerializer;
|
|
69
64
|
protected doExecute: () => MaybePromise<void>;
|
|
70
65
|
constructor(modelState: ModelState, serializer: GModelSerializer, doExecute: () => MaybePromise<void>);
|
|
71
|
-
execute(): Promise<void>;
|
|
72
66
|
protected getJsonObject(): MaybePromise<GModelRootSchema>;
|
|
73
|
-
protected
|
|
67
|
+
protected postChange(newModel: GModelElementSchema): MaybePromise<void>;
|
|
74
68
|
}
|
|
75
69
|
//# sourceMappingURL=recording-command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"recording-command.d.ts","sourceRoot":"","sources":["../../../src/common/command/recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"recording-command.d.ts","sourceRoot":"","sources":["../../../src/common/command/recording-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;kFAckF;AAElF,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAA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EAAE,MAAM,YAAY,CAAC,IAAI,CAAC;gBAA7G,UAAU,EAAE,UAAU,EAAY,UAAU,EAAE,gBAAgB,EAAY,SAAS,EAAE,MAAM,YAAY,CAAC,IAAI,CAAC;IAInI,SAAS,CAAC,aAAa,IAAI,YAAY,CAAC,gBAAgB,CAAC;cAItC,UAAU,CAAC,QAAQ,EAAE,mBAAmB,GAAG,YAAY,CAAC,IAAI,CAAC;CAInF"}
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
16
|
********************************************************************************/
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.GModelRecordingCommand = exports.
|
|
18
|
+
exports.GModelRecordingCommand = exports.AbstractRecordingCommand = void 0;
|
|
19
19
|
const jsonPatch = require("fast-json-patch");
|
|
20
20
|
/**
|
|
21
21
|
* An abstract implementation for {@link Command} that should records changes made to a JSON object during execution.
|
|
@@ -23,14 +23,16 @@ const jsonPatch = require("fast-json-patch");
|
|
|
23
23
|
*/
|
|
24
24
|
class AbstractRecordingCommand {
|
|
25
25
|
async execute() {
|
|
26
|
+
var _a;
|
|
26
27
|
const beforeState = this.deepClone(await this.getJsonObject());
|
|
27
28
|
await this.doExecute();
|
|
28
29
|
const afterState = await this.getJsonObject();
|
|
29
30
|
this.undoPatch = jsonPatch.compare(afterState, beforeState);
|
|
30
31
|
this.redoPatch = jsonPatch.compare(beforeState, afterState);
|
|
32
|
+
(_a = this.postChange) === null || _a === void 0 ? void 0 : _a.call(this, afterState);
|
|
31
33
|
}
|
|
32
34
|
applyPatch(object, patch) {
|
|
33
|
-
jsonPatch.applyPatch(object, patch, false, true);
|
|
35
|
+
return jsonPatch.applyPatch(object, patch, false, true);
|
|
34
36
|
}
|
|
35
37
|
/**
|
|
36
38
|
* Captures the original state of the JSON object before executing the command routine.
|
|
@@ -42,13 +44,17 @@ class AbstractRecordingCommand {
|
|
|
42
44
|
return jsonPatch.deepClone(object);
|
|
43
45
|
}
|
|
44
46
|
async undo() {
|
|
47
|
+
var _a;
|
|
45
48
|
if (this.undoPatch) {
|
|
46
|
-
|
|
49
|
+
const result = this.applyPatch(await this.getJsonObject(), this.undoPatch);
|
|
50
|
+
(_a = this.postChange) === null || _a === void 0 ? void 0 : _a.call(this, result.newDocument);
|
|
47
51
|
}
|
|
48
52
|
}
|
|
49
53
|
async redo() {
|
|
54
|
+
var _a;
|
|
50
55
|
if (this.redoPatch) {
|
|
51
|
-
|
|
56
|
+
const result = this.applyPatch(await this.getJsonObject(), this.redoPatch);
|
|
57
|
+
(_a = this.postChange) === null || _a === void 0 ? void 0 : _a.call(this, result.newDocument);
|
|
52
58
|
}
|
|
53
59
|
}
|
|
54
60
|
canUndo() {
|
|
@@ -56,21 +62,6 @@ class AbstractRecordingCommand {
|
|
|
56
62
|
}
|
|
57
63
|
}
|
|
58
64
|
exports.AbstractRecordingCommand = AbstractRecordingCommand;
|
|
59
|
-
/**
|
|
60
|
-
* Simple base implementation of {@link AbstractRecordingCommand} that records the changes made to the given JSON object during
|
|
61
|
-
* the the given `doExecute` function.
|
|
62
|
-
*/
|
|
63
|
-
class RecordingCommand extends AbstractRecordingCommand {
|
|
64
|
-
constructor(jsonObject, doExecute) {
|
|
65
|
-
super();
|
|
66
|
-
this.jsonObject = jsonObject;
|
|
67
|
-
this.doExecute = doExecute;
|
|
68
|
-
}
|
|
69
|
-
getJsonObject() {
|
|
70
|
-
return this.jsonObject;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
exports.RecordingCommand = RecordingCommand;
|
|
74
65
|
/**
|
|
75
66
|
* Simple base implementation of {@link AbstractRecordingCommand} that allows recording of changes made
|
|
76
67
|
* to the `GModelRoot` ({@link ModelState.root}) during the given `doExecute` function
|
|
@@ -82,16 +73,11 @@ class GModelRecordingCommand extends AbstractRecordingCommand {
|
|
|
82
73
|
this.serializer = serializer;
|
|
83
74
|
this.doExecute = doExecute;
|
|
84
75
|
}
|
|
85
|
-
async execute() {
|
|
86
|
-
await super.execute();
|
|
87
|
-
this.modelState.index.indexRoot(this.modelState.root);
|
|
88
|
-
}
|
|
89
76
|
getJsonObject() {
|
|
90
77
|
return this.serializer.createSchema(this.modelState.root);
|
|
91
78
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
const newRoot = this.serializer.createRoot(rootSchema);
|
|
79
|
+
postChange(newModel) {
|
|
80
|
+
const newRoot = this.serializer.createRoot(newModel);
|
|
95
81
|
this.modelState.updateRoot(newRoot);
|
|
96
82
|
}
|
|
97
83
|
}
|