@eclipse-glsp/server 1.1.0-next.d47240f.50 → 1.1.0-next.de91dcd.60
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 -3
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/action-dispatcher.js +2 -3
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/action-handler-registry.js +4 -6
- package/lib/common/actions/action-handler-registry.js.map +1 -1
- package/lib/common/actions/client-action-handler.js +2 -3
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/actions/global-action-provider.js +2 -3
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/command/command-stack.js +2 -3
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/command.js +1 -1
- package/lib/common/command/command.js.map +1 -1
- package/lib/common/command/undo-redo-action-handler.js +2 -3
- package/lib/common/command/undo-redo-action-handler.js.map +1 -1
- package/lib/common/di/binding-target.d.ts.map +1 -1
- package/lib/common/di/binding-target.js +3 -2
- package/lib/common/di/binding-target.js.map +1 -1
- package/lib/common/di/diagram-module.d.ts +3 -0
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +14 -5
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.js +2 -3
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/diagram/diagram-configuration.js +1 -1
- package/lib/common/diagram/diagram-configuration.js.map +1 -1
- package/lib/common/diagram/request-type-hints-action-handler.js +2 -3
- package/lib/common/diagram/request-type-hints-action-handler.js.map +1 -1
- package/lib/common/features/clipboard/request-clipboard-data-action-handler.js +2 -3
- 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 -3
- package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -3
- package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js +2 -3
- package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js +2 -3
- package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -6
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js +2 -3
- package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
- package/lib/common/features/directediting/label-edit-validator.js +2 -3
- package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js +2 -3
- package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +2 -3
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +2 -3
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/gmodel-factory.js +2 -3
- package/lib/common/features/model/gmodel-factory.js.map +1 -1
- package/lib/common/features/model/gmodel-index.js +2 -3
- package/lib/common/features/model/gmodel-index.js.map +1 -1
- package/lib/common/features/model/gmodel-serializer.js +2 -3
- package/lib/common/features/model/gmodel-serializer.js.map +1 -1
- package/lib/common/features/model/model-state.js +2 -3
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +2 -0
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +12 -3
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts +4 -6
- package/lib/common/features/model/request-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/request-model-action-handler.js +16 -14
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +2 -3
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -3
- package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-resolver.js +2 -3
- package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -3
- 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 -3
- 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 -3
- package/lib/common/features/popup/request-popup-model-action-handler.js.map +1 -1
- package/lib/common/features/progress/progress-service.d.ts +44 -0
- package/lib/common/features/progress/progress-service.d.ts.map +1 -0
- package/lib/common/features/progress/progress-service.js +50 -0
- package/lib/common/features/progress/progress-service.js.map +1 -0
- package/lib/common/features/validation/model-validator.d.ts +47 -2
- package/lib/common/features/validation/model-validator.d.ts.map +1 -1
- package/lib/common/features/validation/model-validator.js +79 -1
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.d.ts +15 -0
- package/lib/common/features/validation/request-markers-handler.d.ts.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +5 -12
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -3
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +2 -3
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -3
- package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
- package/lib/common/gmodel/cut-operation-handler.js +2 -3
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +2 -3
- package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +2 -3
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js +2 -3
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +2 -3
- package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
- package/lib/common/gmodel/gmodel-operation-handler.js +1 -1
- package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +2 -3
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -3
- package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +2 -3
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +2 -3
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -1
- package/lib/common/operations/compound-operation-handler.js +6 -12
- package/lib/common/operations/compound-operation-handler.js.map +1 -1
- package/lib/common/operations/create-operation-handler.js +1 -1
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/operations/operation-action-handler.js +2 -3
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/operations/operation-handler-registry.js +4 -6
- package/lib/common/operations/operation-handler-registry.js.map +1 -1
- package/lib/common/operations/operation-handler.js +2 -3
- package/lib/common/operations/operation-handler.js.map +1 -1
- package/lib/common/protocol/glsp-server.js +2 -3
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.js +2 -3
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.js +2 -3
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/common/utils/args-util.js +2 -2
- package/lib/common/utils/args-util.js.map +1 -1
- package/lib/common/utils/console-logger.js +2 -3
- package/lib/common/utils/console-logger.js.map +1 -1
- package/lib/common/utils/logger.d.ts.map +1 -1
- package/lib/common/utils/logger.js +5 -5
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/common/utils/registry.js +4 -6
- package/lib/common/utils/registry.js.map +1 -1
- package/lib/node/abstract-json-model-storage.js +2 -3
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/gmodel/gmodel-storage.js +2 -3
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +2 -3
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +2 -3
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +6 -4
- package/src/common/di/binding-target.ts +1 -0
- package/src/common/di/diagram-module.ts +20 -7
- package/src/common/features/model/model-submission-handler.ts +12 -0
- package/src/common/features/model/request-model-action-handler.ts +16 -15
- package/src/common/features/progress/progress-service.ts +74 -0
- package/src/common/features/validation/model-validator.ts +75 -3
- package/src/common/features/validation/request-markers-handler.ts +4 -10
- package/src/common/utils/args-util.ts +1 -1
- package/src/common/utils/logger.ts +2 -1
- package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
- package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
- package/lib/common/actions/action-dispatcher.spec.js +0 -264
- package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
- package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/actions/action-handler-registry.spec.js +0 -50
- package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
- package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
- package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
- package/lib/common/actions/global-action-provider.spec.js +0 -70
- package/lib/common/actions/global-action-provider.spec.js.map +0 -1
- package/lib/common/command/command-stack.spec.d.ts +0 -2
- package/lib/common/command/command-stack.spec.d.ts.map +0 -1
- package/lib/common/command/command-stack.spec.js +0 -207
- package/lib/common/command/command-stack.spec.js.map +0 -1
- package/lib/common/command/command.spec.d.ts +0 -2
- package/lib/common/command/command.spec.d.ts.map +0 -1
- package/lib/common/command/command.spec.js +0 -86
- package/lib/common/command/command.spec.js.map +0 -1
- package/lib/common/command/recording-command.spec.d.ts +0 -17
- package/lib/common/command/recording-command.spec.d.ts.map +0 -1
- package/lib/common/command/recording-command.spec.js +0 -62
- package/lib/common/command/recording-command.spec.js.map +0 -1
- package/lib/common/di/binding-target.spec.d.ts +0 -2
- package/lib/common/di/binding-target.spec.d.ts.map +0 -1
- package/lib/common/di/binding-target.spec.js +0 -121
- package/lib/common/di/binding-target.spec.js.map +0 -1
- package/lib/common/di/multi-bindings.spec.d.ts +0 -2
- package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
- package/lib/common/di/multi-bindings.spec.js +0 -137
- package/lib/common/di/multi-bindings.spec.js.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
- package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
- package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
- package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
- package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
- package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
- package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
- package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
- package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
- package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
- package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
- package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
- package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
- package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
- package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
- package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
- package/lib/common/operations/operation-handler-registry.spec.js +0 -50
- package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
- package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
- package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server.spec.js +0 -132
- package/lib/common/protocol/glsp-server.spec.js.map +0 -1
- package/lib/common/session/client-session-factory.spec.d.ts +0 -2
- package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-factory.spec.js +0 -56
- package/lib/common/session/client-session-factory.spec.js.map +0 -1
- package/lib/common/session/client-session-manager.spec.d.ts +0 -2
- package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
- package/lib/common/session/client-session-manager.spec.js +0 -74
- package/lib/common/session/client-session-manager.spec.js.map +0 -1
- package/lib/common/test/mock-util.d.ts +0 -120
- package/lib/common/test/mock-util.d.ts.map +0 -1
- package/lib/common/test/mock-util.js +0 -216
- package/lib/common/test/mock-util.js.map +0 -1
- package/lib/common/utils/promise-queue.spec.d.ts +0 -2
- package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
- package/lib/common/utils/promise-queue.spec.js +0 -117
- package/lib/common/utils/promise-queue.spec.js.map +0 -1
- package/lib/common/utils/registry.spec.d.ts +0 -2
- package/lib/common/utils/registry.spec.d.ts.map +0 -1
- package/lib/common/utils/registry.spec.js +0 -199
- package/lib/common/utils/registry.spec.js.map +0 -1
- package/lib/node/launch/cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/cli-parser.spec.js +0 -56
- package/lib/node/launch/cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
- package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-cli-parser.spec.js +0 -66
- package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.d.ts +0 -17
- package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.js +0 -75
- package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
|
@@ -13,11 +13,12 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action, RequestModelAction,
|
|
16
|
+
import { Action, RequestModelAction, ServerStatusAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
18
|
import { ActionDispatcher } from '../../actions/action-dispatcher';
|
|
19
19
|
import { ActionHandler } from '../../actions/action-handler';
|
|
20
20
|
import { Logger } from '../../utils/logger';
|
|
21
|
+
import { ProgressMonitor, ProgressService } from '../progress/progress-service';
|
|
21
22
|
import { ModelState } from './model-state';
|
|
22
23
|
import { ModelSubmissionHandler } from './model-submission-handler';
|
|
23
24
|
import { SourceModelStorage } from './source-model-storage';
|
|
@@ -41,27 +42,27 @@ export class RequestModelActionHandler implements ActionHandler {
|
|
|
41
42
|
@inject(ModelSubmissionHandler)
|
|
42
43
|
protected submissionHandler: ModelSubmissionHandler;
|
|
43
44
|
|
|
45
|
+
@inject(ProgressService)
|
|
46
|
+
protected progressService: ProgressService;
|
|
47
|
+
|
|
44
48
|
async execute(action: RequestModelAction): Promise<Action[]> {
|
|
45
49
|
this.logger.debug('Execute RequestModelAction:', action);
|
|
46
50
|
this.modelState.setAll(action.options ?? {});
|
|
47
51
|
|
|
48
|
-
this.
|
|
52
|
+
const progress = this.reportModelLoading('Model loading in progress');
|
|
49
53
|
await this.sourceModelStorage.loadSourceModel(action);
|
|
50
|
-
|
|
51
|
-
|
|
54
|
+
this.reportModelLoadingFinished(progress);
|
|
55
|
+
|
|
52
56
|
return this.submissionHandler.submitModel();
|
|
53
57
|
}
|
|
54
58
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
protected
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
ServerMessageAction.create(message, { severity }),
|
|
64
|
-
ServerStatusAction.create(message, { severity })
|
|
65
|
-
);
|
|
59
|
+
protected reportModelLoading(message: string): ProgressMonitor {
|
|
60
|
+
this.actionDispatcher.dispatch(ServerStatusAction.create(message, { severity: 'INFO' }));
|
|
61
|
+
return this.progressService.start(message);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
protected reportModelLoadingFinished(monitor: ProgressMonitor): void {
|
|
65
|
+
this.actionDispatcher.dispatch(ServerStatusAction.create('', { severity: 'NONE' }));
|
|
66
|
+
monitor.end();
|
|
66
67
|
}
|
|
67
68
|
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/********************************************************************************
|
|
2
|
+
* Copyright (c) 2023 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 { EndProgressAction, StartProgressAction, UpdateProgressAction } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { inject, injectable } from 'inversify';
|
|
18
|
+
import * as uuid from 'uuid';
|
|
19
|
+
import { ActionDispatcher } from '../../actions/action-dispatcher';
|
|
20
|
+
|
|
21
|
+
export const ProgressService = Symbol('ProgressService');
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Service for starting and monitoring progress reporting to the client.
|
|
25
|
+
*/
|
|
26
|
+
export interface ProgressService {
|
|
27
|
+
/**
|
|
28
|
+
* Start a progress reporting.
|
|
29
|
+
* @param title The title shown in the UI for the progress reporting.
|
|
30
|
+
* @param options Additional optional options for the progress reporting.
|
|
31
|
+
* @returns a monitor to update and end the progress reporting later.
|
|
32
|
+
*/
|
|
33
|
+
start(title: string, options?: ProgressOptions): ProgressMonitor;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Optional progress reporting options.
|
|
38
|
+
*/
|
|
39
|
+
export interface ProgressOptions {
|
|
40
|
+
/** A message shown in the UI. */
|
|
41
|
+
message?: string;
|
|
42
|
+
/* The percentage (value range: 0 to 100) to show in the progress reporting. */
|
|
43
|
+
percentage?: number;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* The monitor of a progress reporting, which can be used to update and end the reporting.
|
|
48
|
+
*/
|
|
49
|
+
export interface ProgressMonitor {
|
|
50
|
+
/**
|
|
51
|
+
* Updates an ongoing progress reporting.
|
|
52
|
+
* @param options Updated message and/or percentage (value range: 0 to 100).
|
|
53
|
+
*/
|
|
54
|
+
update(options: { message?: string; percentage?: number }): void;
|
|
55
|
+
/**
|
|
56
|
+
* Ends an ongoing progress reporting.
|
|
57
|
+
*/
|
|
58
|
+
end(): void;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
@injectable()
|
|
62
|
+
export class DefaultProgressService implements ProgressService {
|
|
63
|
+
@inject(ActionDispatcher)
|
|
64
|
+
protected actionDispatcher: ActionDispatcher;
|
|
65
|
+
|
|
66
|
+
start(title: string, options?: ProgressOptions): ProgressMonitor {
|
|
67
|
+
const progressId = uuid.v4();
|
|
68
|
+
this.actionDispatcher.dispatch(StartProgressAction.create({ progressId, title, ...options }));
|
|
69
|
+
return {
|
|
70
|
+
update: updateOptions => this.actionDispatcher.dispatch(UpdateProgressAction.create(progressId, updateOptions)),
|
|
71
|
+
end: () => this.actionDispatcher.dispatch(EndProgressAction.create(progressId))
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { GModelElement } from '@eclipse-glsp/graph';
|
|
17
|
-
import { Marker, MaybePromise } from '@eclipse-glsp/protocol';
|
|
17
|
+
import { Marker, MarkersReason, MaybePromise } from '@eclipse-glsp/protocol';
|
|
18
|
+
import { injectable } from 'inversify';
|
|
18
19
|
|
|
19
20
|
export const ModelValidator = Symbol('ModelValidator');
|
|
20
21
|
|
|
@@ -28,7 +29,78 @@ export interface ModelValidator {
|
|
|
28
29
|
* Validates the given list of {@link GModelElement}s and returns a list of {@link Marker}s.
|
|
29
30
|
*
|
|
30
31
|
* @param elements The list of {@link GModelElement} to validate.
|
|
31
|
-
* @
|
|
32
|
+
* @param reason The reason for a validation request, such as "batch" or "live" validation.
|
|
33
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}s.
|
|
32
34
|
*/
|
|
33
|
-
validate(elements: GModelElement[]): MaybePromise<Marker[]>;
|
|
35
|
+
validate(elements: GModelElement[], reason?: string): MaybePromise<Marker[]>;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@injectable()
|
|
39
|
+
export abstract class AbstractModelValidator implements ModelValidator {
|
|
40
|
+
validate(elements: GModelElement[], reason: string): Marker[] {
|
|
41
|
+
const markers: Marker[] = [];
|
|
42
|
+
for (const element of elements) {
|
|
43
|
+
if (MarkersReason.LIVE === reason) {
|
|
44
|
+
markers.push(...this.doLiveValidation(element));
|
|
45
|
+
} else if (MarkersReason.BATCH === reason) {
|
|
46
|
+
markers.push(...this.doBatchValidation(element));
|
|
47
|
+
} else {
|
|
48
|
+
markers.push(...this.doValidationForCustomReason(element));
|
|
49
|
+
}
|
|
50
|
+
if (element.children) {
|
|
51
|
+
markers.push(...this.validate(element.children, reason));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return markers;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Perform the live validation rules for the given <code>element</code>.
|
|
59
|
+
*
|
|
60
|
+
* This will be invoked on start and after each operation for all elements.
|
|
61
|
+
* Thus, the validation should be rather inexpensive.
|
|
62
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
63
|
+
* this method for all children anyway.
|
|
64
|
+
*
|
|
65
|
+
* @param element The element to validate.
|
|
66
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
67
|
+
*/
|
|
68
|
+
doLiveValidation(element: GModelElement): Marker[] {
|
|
69
|
+
return [];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Perform the batch validation rules for the given <code>element</code>.
|
|
74
|
+
*
|
|
75
|
+
* <p>
|
|
76
|
+
* This will be invoked on demand by the client.
|
|
77
|
+
* Thus, the validation can include more expensive validation rules.
|
|
78
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
79
|
+
* this method for all children anyway.
|
|
80
|
+
* </p>
|
|
81
|
+
*
|
|
82
|
+
* @param element The element to validate.
|
|
83
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
84
|
+
*/
|
|
85
|
+
doBatchValidation(element: GModelElement): Marker[] {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Perform a validation for a custom <code>reason</code> with the given <code>element</code>.
|
|
91
|
+
*
|
|
92
|
+
* <p>
|
|
93
|
+
* GLSP editors may add custom reasons for triggering a validation, other than <code>live</code> and
|
|
94
|
+
* <code>batch</code>.
|
|
95
|
+
* Validation requests that are not live or batch validations will be handled by this method.
|
|
96
|
+
* There is no need to traverse through the children in this method as {@link #validate(List, String)} will invoke
|
|
97
|
+
* this method for all children anyway.
|
|
98
|
+
* </p>
|
|
99
|
+
*
|
|
100
|
+
* @param element The element to validate.
|
|
101
|
+
* @return A list of {@link Marker}s for the validated {@link GModelElement}.
|
|
102
|
+
*/
|
|
103
|
+
doValidationForCustomReason(element: GModelElement): Marker[] {
|
|
104
|
+
return [];
|
|
105
|
+
}
|
|
34
106
|
}
|
|
@@ -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 {
|
|
17
|
-
import { Action, Marker, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { Action, MarkersReason, RequestMarkersAction, SetMarkersAction } from '@eclipse-glsp/protocol';
|
|
18
17
|
import { inject, injectable, optional } from 'inversify';
|
|
19
18
|
import { ActionHandler } from '../../actions/action-handler';
|
|
20
19
|
import { GLSPServerError } from '../../utils/glsp-server-error';
|
|
@@ -38,14 +37,9 @@ export class RequestMarkersHandler implements ActionHandler {
|
|
|
38
37
|
elementIDs = [this.modelState.root.id];
|
|
39
38
|
}
|
|
40
39
|
|
|
41
|
-
|
|
42
|
-
const
|
|
43
|
-
|
|
44
|
-
const modelElement = currentModelIndex.findByClass(elementID, GGraph);
|
|
45
|
-
if (modelElement) {
|
|
46
|
-
markers = markers.concat(await this.validator.validate([modelElement]));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
40
|
+
const modelElements = this.modelState.index.getAll(elementIDs);
|
|
41
|
+
const markers = await this.validator.validate(modelElements, action.reason ?? MarkersReason.BATCH);
|
|
42
|
+
|
|
49
43
|
return [SetMarkersAction.create(markers)];
|
|
50
44
|
}
|
|
51
45
|
}
|
|
@@ -80,7 +80,8 @@ export function getRequestParentName(context: interfaces.Context): string | unde
|
|
|
80
80
|
if (context.currentRequest.parentRequest) {
|
|
81
81
|
const bindings = context.currentRequest.parentRequest.bindings;
|
|
82
82
|
if (bindings.length > 0) {
|
|
83
|
-
|
|
83
|
+
const binding = bindings[0] as interfaces.Binding<{ name?: string }>;
|
|
84
|
+
return binding.implementationType?.name;
|
|
84
85
|
}
|
|
85
86
|
}
|
|
86
87
|
return undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-dispatcher.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,264 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
5
|
-
*
|
|
6
|
-
* This program and the accompanying materials are made available under the
|
|
7
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
-
*
|
|
10
|
-
* This Source Code may also be made available under the following Secondary
|
|
11
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
-
* with the GNU Classpath Exception which is available at
|
|
14
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
17
|
-
********************************************************************************/
|
|
18
|
-
const protocol_1 = require("@eclipse-glsp/protocol");
|
|
19
|
-
const chai_1 = require("chai");
|
|
20
|
-
const inversify_1 = require("inversify");
|
|
21
|
-
const sinon = require("sinon");
|
|
22
|
-
const service_identifiers_1 = require("../di/service-identifiers");
|
|
23
|
-
const client_session_manager_1 = require("../session/client-session-manager");
|
|
24
|
-
const mock = require("../test/mock-util");
|
|
25
|
-
const logger_1 = require("../utils/logger");
|
|
26
|
-
const action_dispatcher_1 = require("./action-dispatcher");
|
|
27
|
-
const action_handler_registry_1 = require("./action-handler-registry");
|
|
28
|
-
const assert = require("assert");
|
|
29
|
-
function waitSync(timeInMillis) {
|
|
30
|
-
const start = Date.now();
|
|
31
|
-
let now = start;
|
|
32
|
-
while (now - start < timeInMillis) {
|
|
33
|
-
now = Date.now();
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
describe('test DefaultActionDispatcher', () => {
|
|
37
|
-
const container = new inversify_1.Container();
|
|
38
|
-
const clientId = 'myClientId';
|
|
39
|
-
const actionHandlerRegistry = new action_handler_registry_1.ActionHandlerRegistry();
|
|
40
|
-
let registry_get_stub;
|
|
41
|
-
const sandbox = sinon.createSandbox();
|
|
42
|
-
container.load(new inversify_1.ContainerModule(bind => {
|
|
43
|
-
bind(logger_1.Logger).toConstantValue(new mock.StubLogger());
|
|
44
|
-
bind(client_session_manager_1.ClientSessionManager).toConstantValue(new mock.StubClientSessionManager());
|
|
45
|
-
bind(service_identifiers_1.ClientId).toConstantValue(clientId);
|
|
46
|
-
bind(action_handler_registry_1.ActionHandlerRegistry).toConstantValue(actionHandlerRegistry);
|
|
47
|
-
bind(service_identifiers_1.ClientActionKinds).toConstantValue(['response', 'response1', 'response2']);
|
|
48
|
-
}));
|
|
49
|
-
const actionDispatcher = container.resolve(action_dispatcher_1.DefaultActionDispatcher);
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
registry_get_stub = sandbox.stub(actionHandlerRegistry, 'get');
|
|
52
|
-
});
|
|
53
|
-
afterEach(() => {
|
|
54
|
-
sandbox.restore();
|
|
55
|
-
});
|
|
56
|
-
describe('test with one-way actions (no response actions)', () => {
|
|
57
|
-
it('dispatch- unhandled action', async () => {
|
|
58
|
-
assert.rejects(actionDispatcher.dispatch({ kind: 'unhandled' }));
|
|
59
|
-
});
|
|
60
|
-
it('dispatch - one action', async () => {
|
|
61
|
-
// Mock setup
|
|
62
|
-
const action = 'action';
|
|
63
|
-
const handler = new mock.StubActionHandler([action]);
|
|
64
|
-
const getHandler = (kind) => (kind === action ? [handler] : []);
|
|
65
|
-
registry_get_stub.callsFake(getHandler);
|
|
66
|
-
const spy_handler_execute = sinon.spy(handler, 'execute');
|
|
67
|
-
// Test execution
|
|
68
|
-
await actionDispatcher.dispatch({ kind: action });
|
|
69
|
-
(0, chai_1.expect)(spy_handler_execute.calledOnce).true;
|
|
70
|
-
});
|
|
71
|
-
describe('test multi dispatch with single-handled actions', () => {
|
|
72
|
-
// Mock Setup
|
|
73
|
-
const action1 = 'a1';
|
|
74
|
-
const action2 = 'a2';
|
|
75
|
-
const action3 = 'a3';
|
|
76
|
-
const handler1 = new mock.StubActionHandler([action1]);
|
|
77
|
-
const handler2 = new mock.StubActionHandler([action2]);
|
|
78
|
-
const handler3 = new mock.StubActionHandler([action3]);
|
|
79
|
-
const spy_handler1_execute = sinon.stub(handler1, 'execute').returns([]);
|
|
80
|
-
const spy_handler2_execute = sinon.stub(handler2, 'execute').returns([]);
|
|
81
|
-
const spy_handler3_execute = sinon.stub(handler3, 'execute').returns([]);
|
|
82
|
-
const handlerMockImpl = (kind) => {
|
|
83
|
-
switch (kind) {
|
|
84
|
-
case action1:
|
|
85
|
-
return [handler1];
|
|
86
|
-
case action2:
|
|
87
|
-
return [handler2];
|
|
88
|
-
case action3:
|
|
89
|
-
return [handler3];
|
|
90
|
-
default:
|
|
91
|
-
return [];
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
it('dispatch - multiple actions', async () => {
|
|
95
|
-
// Mock setup
|
|
96
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
97
|
-
// Test execution
|
|
98
|
-
actionDispatcher.dispatch({ kind: action1 });
|
|
99
|
-
actionDispatcher.dispatch({ kind: action2 });
|
|
100
|
-
await actionDispatcher.dispatch({ kind: action3 });
|
|
101
|
-
// Check if all handlers have been called
|
|
102
|
-
(0, chai_1.expect)(spy_handler1_execute.called).true;
|
|
103
|
-
(0, chai_1.expect)(spy_handler2_execute.called).true;
|
|
104
|
-
(0, chai_1.expect)(spy_handler3_execute.called).true;
|
|
105
|
-
// Check if all handlers have been called in the right order
|
|
106
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
107
|
-
});
|
|
108
|
-
it('dispatchAll- multiple actions', async () => {
|
|
109
|
-
// Mock setup
|
|
110
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
111
|
-
// Test execution
|
|
112
|
-
await actionDispatcher.dispatchAll([{ kind: action1 }, { kind: action2 }, { kind: action3 }]);
|
|
113
|
-
// Check if all handlers have been called
|
|
114
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
115
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
116
|
-
(0, chai_1.expect)(spy_handler3_execute.calledOnce);
|
|
117
|
-
// Check if all handlers have been called in the right order
|
|
118
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
119
|
-
});
|
|
120
|
-
it('dispatch - multiple actions (racing execution times)', async () => {
|
|
121
|
-
// Mock setup
|
|
122
|
-
registry_get_stub.callsFake(handlerMockImpl);
|
|
123
|
-
spy_handler1_execute.callsFake((_action) => {
|
|
124
|
-
waitSync(500);
|
|
125
|
-
return [];
|
|
126
|
-
});
|
|
127
|
-
spy_handler2_execute.callsFake((_action) => {
|
|
128
|
-
waitSync(200);
|
|
129
|
-
return [];
|
|
130
|
-
});
|
|
131
|
-
spy_handler3_execute.callsFake((_action) => {
|
|
132
|
-
waitSync(100);
|
|
133
|
-
return [];
|
|
134
|
-
});
|
|
135
|
-
// Test execution
|
|
136
|
-
actionDispatcher.dispatch({ kind: action1 });
|
|
137
|
-
actionDispatcher.dispatch({ kind: action2 });
|
|
138
|
-
await actionDispatcher.dispatch({ kind: action3 });
|
|
139
|
-
// Check if all handlers have been called
|
|
140
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
141
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
142
|
-
(0, chai_1.expect)(spy_handler3_execute.calledOnce);
|
|
143
|
-
// Check if all handlers have been called in the right order
|
|
144
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute, spy_handler3_execute);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
147
|
-
it('dispatch- one action & multiple handlers', async () => {
|
|
148
|
-
// Mock setup
|
|
149
|
-
const action1 = 'a1';
|
|
150
|
-
const handler1 = new mock.StubActionHandler([action1]);
|
|
151
|
-
const handler2 = new mock.StubActionHandler([action1]);
|
|
152
|
-
registry_get_stub.callsFake((kind) => (kind === action1 ? [handler1, handler2] : []));
|
|
153
|
-
const spy_handler1_execute = sinon.spy(handler1, 'execute');
|
|
154
|
-
const spy_handler2_execute = sinon.spy(handler2, 'execute');
|
|
155
|
-
// Test execution
|
|
156
|
-
await actionDispatcher.dispatch({ kind: action1 });
|
|
157
|
-
(0, chai_1.expect)(spy_handler1_execute.calledOnce);
|
|
158
|
-
(0, chai_1.expect)(spy_handler2_execute.calledOnce);
|
|
159
|
-
sinon.assert.callOrder(spy_handler1_execute, spy_handler2_execute);
|
|
160
|
-
});
|
|
161
|
-
});
|
|
162
|
-
describe('test with handler response actions ', () => {
|
|
163
|
-
it('dispatch - one action & one handler response action', async () => {
|
|
164
|
-
// Mock setup
|
|
165
|
-
const request = 'request';
|
|
166
|
-
const response = 'response';
|
|
167
|
-
const requestHandler = new mock.StubActionHandler([request]);
|
|
168
|
-
const responseHandler = new mock.StubActionHandler([response]);
|
|
169
|
-
const spy_requestHandler_execute = sinon.stub(requestHandler, 'execute').returns([{ kind: response }]);
|
|
170
|
-
const spy_responseHandler_execute = sinon.spy(responseHandler, 'execute');
|
|
171
|
-
registry_get_stub.callsFake((kind) => {
|
|
172
|
-
switch (kind) {
|
|
173
|
-
case request:
|
|
174
|
-
return [requestHandler];
|
|
175
|
-
case response:
|
|
176
|
-
return [responseHandler];
|
|
177
|
-
default:
|
|
178
|
-
return [];
|
|
179
|
-
}
|
|
180
|
-
});
|
|
181
|
-
// Test execution
|
|
182
|
-
await actionDispatcher.dispatch({ kind: request });
|
|
183
|
-
// Add a delay so that the action dispatcher has time to dispatch the handler response
|
|
184
|
-
await mock.delay(200);
|
|
185
|
-
// Check if all handlers have been called
|
|
186
|
-
(0, chai_1.expect)(spy_requestHandler_execute.calledOnce);
|
|
187
|
-
(0, chai_1.expect)(spy_responseHandler_execute.calledOnce);
|
|
188
|
-
});
|
|
189
|
-
it('dispatch - multiple actions & multiple response', async () => {
|
|
190
|
-
// Mock setup
|
|
191
|
-
const request1 = 'request1';
|
|
192
|
-
const request2 = 'request2';
|
|
193
|
-
const response1 = 'response1';
|
|
194
|
-
const response2 = 'response2';
|
|
195
|
-
const responseHandler1 = new mock.StubActionHandler([response1]);
|
|
196
|
-
const responseHandler2 = new mock.StubActionHandler([response2]);
|
|
197
|
-
const requestHandler1 = new mock.StubActionHandler([request1]);
|
|
198
|
-
const requestHandler2 = new mock.StubActionHandler([request2]);
|
|
199
|
-
const spy_requestHandler1_execute = sinon.stub(requestHandler1, 'execute').returns([{ kind: response1 }, { kind: response2 }]);
|
|
200
|
-
const spy_requestHandler2_execute = sinon.stub(requestHandler2, 'execute').returns([{ kind: response2 }]);
|
|
201
|
-
const spy_responseHandler1_execute = sinon.spy(responseHandler1, 'execute');
|
|
202
|
-
const spy_responseHandler2_execute = sinon.spy(responseHandler2, 'execute');
|
|
203
|
-
registry_get_stub.callsFake((kind) => {
|
|
204
|
-
switch (kind) {
|
|
205
|
-
case request1:
|
|
206
|
-
return [requestHandler1];
|
|
207
|
-
case request2:
|
|
208
|
-
return [requestHandler2];
|
|
209
|
-
case response1:
|
|
210
|
-
return [responseHandler1, responseHandler2];
|
|
211
|
-
case response2:
|
|
212
|
-
return [responseHandler2];
|
|
213
|
-
default:
|
|
214
|
-
return [];
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
// Test execution
|
|
218
|
-
actionDispatcher.dispatch({ kind: request1 });
|
|
219
|
-
await actionDispatcher.dispatch({ kind: request2 });
|
|
220
|
-
// Add a delay so that the action dispatcher has time to dispatch the handler response
|
|
221
|
-
await mock.delay(100);
|
|
222
|
-
// Check if all handlers have been called correctly
|
|
223
|
-
(0, chai_1.expect)(spy_requestHandler1_execute.calledOnce);
|
|
224
|
-
(0, chai_1.expect)(spy_requestHandler2_execute.calledOnce);
|
|
225
|
-
(0, chai_1.expect)(spy_responseHandler1_execute.calledOnce);
|
|
226
|
-
(0, chai_1.expect)(spy_responseHandler2_execute.calledThrice);
|
|
227
|
-
// Check if all handlers have been called in the right order
|
|
228
|
-
sinon.assert.callOrder(spy_requestHandler1_execute, spy_requestHandler2_execute);
|
|
229
|
-
sinon.assert.callOrder(spy_responseHandler1_execute, spy_responseHandler2_execute);
|
|
230
|
-
});
|
|
231
|
-
});
|
|
232
|
-
describe('test dispatch after next update', () => {
|
|
233
|
-
it('dispatchAfterNextUpdate', async () => {
|
|
234
|
-
// Mock setup
|
|
235
|
-
const updateModelAction = protocol_1.UpdateModelAction.create({ id: 'newRoot', type: 'myType' });
|
|
236
|
-
const intermediateAction = 'intermediate';
|
|
237
|
-
const postUpdateAction = 'postUpdate';
|
|
238
|
-
const handler = new mock.StubActionHandler([updateModelAction.kind, intermediateAction]);
|
|
239
|
-
const postUpdateHandler = new mock.StubActionHandler([postUpdateAction]);
|
|
240
|
-
const getHandler = (kind) => {
|
|
241
|
-
if (kind === updateModelAction.kind || kind === intermediateAction) {
|
|
242
|
-
return [handler];
|
|
243
|
-
}
|
|
244
|
-
else if (kind === postUpdateAction) {
|
|
245
|
-
return [postUpdateHandler];
|
|
246
|
-
}
|
|
247
|
-
return [];
|
|
248
|
-
};
|
|
249
|
-
registry_get_stub.callsFake(getHandler);
|
|
250
|
-
const spy_postUpdateHandler_execute = sinon.spy(postUpdateHandler, 'execute');
|
|
251
|
-
// Test execution
|
|
252
|
-
actionDispatcher.dispatchAfterNextUpdate({ kind: postUpdateAction });
|
|
253
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.called).to.be.false;
|
|
254
|
-
await actionDispatcher.dispatch({ kind: intermediateAction });
|
|
255
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.called).to.be.false;
|
|
256
|
-
await actionDispatcher.dispatch(updateModelAction);
|
|
257
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.calledOnce);
|
|
258
|
-
// Check that action does not get dispatched again
|
|
259
|
-
await actionDispatcher.dispatch(updateModelAction);
|
|
260
|
-
(0, chai_1.expect)(spy_postUpdateHandler_execute.calledOnce);
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
});
|
|
264
|
-
//# sourceMappingURL=action-dispatcher.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-dispatcher.spec.js","sourceRoot":"","sources":["../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,CAAC;YACd,CAAC,CAAC;YACF,iBAAiB,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;YACxC,MAAM,6BAA6B,GAAG,KAAK,CAAC,GAAG,CAAC,iBAAiB,EAAE,SAAS,CAAC,CAAC;YAE9E,iBAAiB;YACjB,gBAAgB,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,gBAAgB,EAAE,CAAC,CAAC;YACrE,IAAA,aAAM,EAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YACzD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAAC,CAAC;YAC9D,IAAA,aAAM,EAAC,6BAA6B,CAAC,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,KAAK,CAAC;YACzD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YACnD,IAAA,aAAM,EAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;YACjD,kDAAkD;YAClD,MAAM,gBAAgB,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;YACnD,IAAA,aAAM,EAAC,6BAA6B,CAAC,UAAU,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler-registry.spec.d.ts","sourceRoot":"","sources":["../../../src/common/actions/action-handler-registry.spec.ts"],"names":[],"mappings":""}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
/********************************************************************************
|
|
4
|
-
* Copyright (c) 2022-2023 STMicroelectronics and others.
|
|
5
|
-
*
|
|
6
|
-
* This program and the accompanying materials are made available under the
|
|
7
|
-
* terms of the Eclipse Public License v. 2.0 which is available at
|
|
8
|
-
* http://www.eclipse.org/legal/epl-2.0.
|
|
9
|
-
*
|
|
10
|
-
* This Source Code may also be made available under the following Secondary
|
|
11
|
-
* Licenses when the conditions for such availability set forth in the Eclipse
|
|
12
|
-
* Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
13
|
-
* with the GNU Classpath Exception which is available at
|
|
14
|
-
* https://www.gnu.org/software/classpath/license.html.
|
|
15
|
-
*
|
|
16
|
-
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
17
|
-
********************************************************************************/
|
|
18
|
-
const mock = require("../test/mock-util");
|
|
19
|
-
const action_handler_registry_1 = require("./action-handler-registry");
|
|
20
|
-
const chai_1 = require("chai");
|
|
21
|
-
describe('Test ActionHandlerRegistry (only functionality that is not covered by "registry.spec.ts"', () => {
|
|
22
|
-
const singleAction = 'singleHandledAction';
|
|
23
|
-
const multiAction = 'multiHandledAction';
|
|
24
|
-
const h1 = new mock.StubActionHandler([singleAction]);
|
|
25
|
-
const h2 = new mock.StubActionHandler([multiAction]);
|
|
26
|
-
const h3 = new mock.StubActionHandler([multiAction]);
|
|
27
|
-
const h4 = new mock.StubActionHandler([multiAction]);
|
|
28
|
-
const registry = new action_handler_registry_1.ActionHandlerRegistry();
|
|
29
|
-
it('registerHandler - should register given handlers', () => {
|
|
30
|
-
// setup
|
|
31
|
-
registry.registerHandler(h1);
|
|
32
|
-
registry.registerHandler(h2);
|
|
33
|
-
registry.registerHandler(h3);
|
|
34
|
-
registry.registerHandler(h4);
|
|
35
|
-
const result = registry.getAll();
|
|
36
|
-
(0, chai_1.expect)(result).to.have.length(4);
|
|
37
|
-
(0, chai_1.expect)(result.includes(h1)).true;
|
|
38
|
-
(0, chai_1.expect)(result.includes(h2)).true;
|
|
39
|
-
(0, chai_1.expect)(result.includes(h3)).true;
|
|
40
|
-
(0, chai_1.expect)(result.includes(h4)).true;
|
|
41
|
-
});
|
|
42
|
-
it('get - should return three handlers sorted by priority', () => {
|
|
43
|
-
const result = registry.get(multiAction);
|
|
44
|
-
(0, chai_1.expect)(result.length).to.be.equal(3);
|
|
45
|
-
(0, chai_1.expect)(result[0]).to.be.deep.equal(h4);
|
|
46
|
-
(0, chai_1.expect)(result[1]).to.be.deep.equal(h2);
|
|
47
|
-
(0, chai_1.expect)(result[2]).to.be.deep.equal(h3);
|
|
48
|
-
});
|
|
49
|
-
});
|
|
50
|
-
//# sourceMappingURL=action-handler-registry.spec.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-handler-registry.spec.js","sourceRoot":"","sources":["../../../src/common/actions/action-handler-registry.spec.ts"],"names":[],"mappings":";;AAAA;;;;;;;;;;;;;;kFAckF;AAClF,0CAA0C;AAC1C,uEAAkE;AAClE,+BAA8B;AAE9B,QAAQ,CAAC,0FAA0F,EAAE,GAAG,EAAE;IACtG,MAAM,YAAY,GAAG,qBAAqB,CAAC;IAC3C,MAAM,WAAW,GAAG,oBAAoB,CAAC;IAEzC,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC;IACtD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,EAAE,GAAG,IAAI,IAAI,CAAC,iBAAiB,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC;IACrD,MAAM,QAAQ,GAA0B,IAAI,+CAAqB,EAAE,CAAC;IAEpE,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QACxD,QAAQ;QACR,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,QAAQ,CAAC,eAAe,CAAC,EAAE,CAAC,CAAC;QAC7B,QAAQ,CAAC,eAAe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