@eclipse-glsp/server 1.1.0-next.f692ea4.55 → 2.1.0-next.70
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 -2
- 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 -7
- package/lib/common/actions/action-dispatcher.js.map +1 -1
- package/lib/common/actions/action-handler-registry.js +4 -4
- 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 -22
- 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 -22
- package/lib/common/actions/global-action-provider.js.map +1 -1
- package/lib/common/command/command-stack.js +2 -2
- 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/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 -2
- 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/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 +23 -1
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +23 -53
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.js +2 -2
- 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/diagram/diagram-configuration.js +1 -1
- package/lib/common/diagram/diagram-configuration.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 -2
- 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 -2
- package/lib/common/features/contextactions/command-palette-action-provider.js.map +1 -1
- package/lib/common/features/contextactions/context-actions-provider-registry.js +2 -2
- package/lib/common/features/contextactions/context-actions-provider-registry.js.map +1 -1
- package/lib/common/features/contextactions/context-menu-item-provider.js +2 -2
- package/lib/common/features/contextactions/context-menu-item-provider.js.map +1 -1
- package/lib/common/features/contextactions/request-context-actions-handler.js +2 -2
- package/lib/common/features/contextactions/request-context-actions-handler.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +4 -4
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/features/directediting/context-edit-validator-registry.js +2 -2
- package/lib/common/features/directediting/context-edit-validator-registry.js.map +1 -1
- package/lib/common/features/directediting/label-edit-validator.js +2 -2
- package/lib/common/features/directediting/label-edit-validator.js.map +1 -1
- package/lib/common/features/directediting/request-edit-validation-handler.js +2 -2
- package/lib/common/features/directediting/request-edit-validation-handler.js.map +1 -1
- package/lib/common/features/layout/computed-bounds-action-handler.js +2 -2
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +2 -2
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/gmodel-factory.js +2 -2
- package/lib/common/features/model/gmodel-factory.js.map +1 -1
- package/lib/common/features/model/gmodel-index.js +2 -2
- 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 -2
- 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 -2
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +30 -3
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +73 -9
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/request-model-action-handler.d.ts +5 -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 +37 -15
- package/lib/common/features/model/request-model-action-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +2 -2
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-provider-registry.js +2 -2
- package/lib/common/features/navigation/navigation-target-provider-registry.js.map +1 -1
- package/lib/common/features/navigation/navigation-target-resolver.js +2 -2
- package/lib/common/features/navigation/navigation-target-resolver.js.map +1 -1
- package/lib/common/features/navigation/request-navigation-targets-action-handler.js +2 -2
- 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 -2
- 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 -2
- 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 +51 -0
- package/lib/common/features/progress/progress-service.js.map +1 -0
- 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 -4
- package/lib/common/features/type-hints/request-type-hints-action-handler.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 +80 -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 -11
- package/lib/common/features/validation/request-markers-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +2 -2
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +2 -2
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +2 -2
- 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 -5
- 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 -7
- 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 -2
- 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 -2
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +2 -2
- 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.d.ts.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +2 -2
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +2 -2
- 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 -2
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.js +2 -2
- 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 +12 -12
- 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 +3 -2
- 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 -3
- 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 -14
- 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 -2
- 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 -11
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.js +5 -5
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.js +2 -2
- 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/client-options-util.d.ts +3 -0
- package/lib/common/utils/client-options-util.d.ts.map +1 -1
- package/lib/common/utils/client-options-util.js +5 -15
- package/lib/common/utils/client-options-util.js.map +1 -1
- package/lib/common/utils/console-logger.js +2 -2
- 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 -4
- 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 -6
- package/lib/common/utils/registry.js.map +1 -1
- package/lib/node/abstract-json-model-storage.d.ts.map +1 -1
- package/lib/node/abstract-json-model-storage.js +10 -4
- 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 -3
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/cli-parser.js +1 -1
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +2 -2
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +2 -2
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +7 -6
- 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/binding-target.ts +1 -0
- package/src/common/di/client-session-module.ts +17 -10
- package/src/common/di/diagram-module.ts +31 -70
- 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 +64 -7
- package/src/common/features/model/request-model-action-handler.ts +37 -17
- package/src/common/features/progress/progress-service.ts +74 -0
- 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/features/validation/model-validator.ts +75 -3
- package/src/common/features/validation/request-markers-handler.ts +4 -10
- 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/args-util.ts +1 -1
- package/src/common/utils/client-options-util.ts +8 -0
- package/src/common/utils/logger.ts +2 -1
- 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/abstract-json-model-storage.ts +8 -2
- package/src/node/gmodel/gmodel-storage.ts +3 -3
- package/src/node/launch/cli-parser.ts +1 -1
- 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
|
@@ -13,45 +13,14 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import {
|
|
17
|
-
CenterAction,
|
|
18
|
-
DeleteMarkersAction,
|
|
19
|
-
ExportSvgAction,
|
|
20
|
-
FitToScreenAction,
|
|
21
|
-
NavigateToExternalTargetAction,
|
|
22
|
-
NavigateToTargetAction,
|
|
23
|
-
RequestBoundsAction,
|
|
24
|
-
SelectAction,
|
|
25
|
-
SelectAllAction,
|
|
26
|
-
ServerMessageAction,
|
|
27
|
-
ServerStatusAction,
|
|
28
|
-
SetBoundsAction,
|
|
29
|
-
SetClipboardDataAction,
|
|
30
|
-
SetContextActions,
|
|
31
|
-
SetDirtyStateAction,
|
|
32
|
-
SetEditModeAction,
|
|
33
|
-
SetEditValidationResultAction,
|
|
34
|
-
SetMarkersAction,
|
|
35
|
-
SetModelAction,
|
|
36
|
-
SetNavigationTargetsAction,
|
|
37
|
-
SetPopupModelAction,
|
|
38
|
-
SetResolvedNavigationTargetAction,
|
|
39
|
-
SetTypeHintsAction,
|
|
40
|
-
SetViewportAction,
|
|
41
|
-
SourceModelChangedAction,
|
|
42
|
-
TriggerEdgeCreationAction,
|
|
43
|
-
TriggerNodeCreationAction,
|
|
44
|
-
UpdateModelAction
|
|
45
|
-
} from '@eclipse-glsp/protocol';
|
|
46
16
|
import { interfaces } from 'inversify';
|
|
47
17
|
import { ActionDispatcher, DefaultActionDispatcher } from '../actions/action-dispatcher';
|
|
48
18
|
import { ActionHandlerConstructor, ActionHandlerFactory } from '../actions/action-handler';
|
|
49
19
|
import { ActionHandlerRegistry, ActionHandlerRegistryInitializer } from '../actions/action-handler-registry';
|
|
50
|
-
import {
|
|
20
|
+
import { ClientActionForwarder } from '../actions/client-action-handler';
|
|
51
21
|
import { CommandStack, DefaultCommandStack } from '../command/command-stack';
|
|
52
22
|
import { UndoRedoActionHandler } from '../command/undo-redo-action-handler';
|
|
53
23
|
import { DiagramConfiguration } from '../diagram/diagram-configuration';
|
|
54
|
-
import { RequestTypeHintsActionHandler } from '../diagram/request-type-hints-action-handler';
|
|
55
24
|
import { CommandPaletteActionProvider } from '../features/contextactions/command-palette-action-provider';
|
|
56
25
|
import { ContextActionsProvider } from '../features/contextactions/context-actions-provider';
|
|
57
26
|
import { ContextActionsProviderRegistry } from '../features/contextactions/context-actions-provider-registry';
|
|
@@ -86,6 +55,10 @@ import { RequestNavigationTargetsActionHandler } from '../features/navigation/re
|
|
|
86
55
|
import { ResolveNavigationTargetsActionHandler } from '../features/navigation/resolve-navigation-targets-action-handler';
|
|
87
56
|
import { PopupModelFactory } from '../features/popup/popup-model-factory';
|
|
88
57
|
import { RequestPopupModelActionHandler } from '../features/popup/request-popup-model-action-handler';
|
|
58
|
+
import { DefaultProgressService, ProgressService } from '../features/progress/progress-service';
|
|
59
|
+
import { EdgeCreationChecker } from '../features/type-hints/edge-creation-checker';
|
|
60
|
+
import { RequestCheckEdgeActionHandler } from '../features/type-hints/request-check-edge-action-handler';
|
|
61
|
+
import { RequestTypeHintsActionHandler } from '../features/type-hints/request-type-hints-action-handler';
|
|
89
62
|
import { ModelValidator } from '../features/validation/model-validator';
|
|
90
63
|
import { RequestMarkersHandler } from '../features/validation/request-markers-handler';
|
|
91
64
|
import { CompoundOperationHandler } from '../operations/compound-operation-handler';
|
|
@@ -93,11 +66,10 @@ import { OperationActionHandler } from '../operations/operation-action-handler';
|
|
|
93
66
|
import { OperationHandlerConstructor, OperationHandlerFactory } from '../operations/operation-handler';
|
|
94
67
|
import { OperationHandlerRegistry, OperationHandlerRegistryInitializer } from '../operations/operation-handler-registry';
|
|
95
68
|
import { ClientSessionInitializer } from '../session/client-session-initializer';
|
|
96
|
-
import { applyBindingTarget, applyOptionalBindingTarget
|
|
69
|
+
import { BindingTarget, applyBindingTarget, applyOptionalBindingTarget } from './binding-target';
|
|
97
70
|
import { GLSPModule } from './glsp-module';
|
|
98
71
|
import { InstanceMultiBinding, MultiBinding } from './multi-binding';
|
|
99
72
|
import {
|
|
100
|
-
ClientActionKinds,
|
|
101
73
|
ClientId,
|
|
102
74
|
ContextActionsProviders,
|
|
103
75
|
ContextEditValidators,
|
|
@@ -133,6 +105,7 @@ import {
|
|
|
133
105
|
* - {@link ContextActionsProviders} as {@link ClassMultiBinding<ContextActionsProvider>} (empty)
|
|
134
106
|
* - {@link ContextActionsProviderRegistry}
|
|
135
107
|
* - {@link ActionDispatcher}
|
|
108
|
+
* - {@link ProgressService}
|
|
136
109
|
* - {@link ClientActionKinds} as {@link InstanceMultiBinding<string>}
|
|
137
110
|
* - {@link ActionHandler} as {@link InstanceMultiBinding<ActionHandlerConstructor>}
|
|
138
111
|
* - {@link ActionHandlerFactory}
|
|
@@ -150,6 +123,7 @@ import {
|
|
|
150
123
|
* - {@link ClientSessionInitializer} as {@link ClassMultiBinding<ClientSessionInitializer>}
|
|
151
124
|
* - {@link PopupModelFactory} as optional binding
|
|
152
125
|
* - {@link LayoutEngine} as optional binding
|
|
126
|
+
* - {@link EdgeCreationChecker} as optional binding
|
|
153
127
|
*/
|
|
154
128
|
|
|
155
129
|
export abstract class DiagramModule extends GLSPModule {
|
|
@@ -162,6 +136,7 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
162
136
|
applyBindingTarget(context, DiagramType, this.bindDiagramType());
|
|
163
137
|
applyBindingTarget(context, ClientId, this.bindClientId());
|
|
164
138
|
applyBindingTarget(context, DiagramConfiguration, this.bindDiagramConfiguration()).inSingletonScope();
|
|
139
|
+
applyBindingTarget(context, ClientActionForwarder, this.bindClientActionForwarder()).inSingletonScope();
|
|
165
140
|
|
|
166
141
|
// Model-related bindings
|
|
167
142
|
applyBindingTarget(context, GModelSerializer, this.bindGModelSerializer()).inSingletonScope();
|
|
@@ -186,7 +161,6 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
186
161
|
|
|
187
162
|
// Action & operation related bindings
|
|
188
163
|
applyBindingTarget(context, ActionDispatcher, this.bindActionDispatcher()).inSingletonScope();
|
|
189
|
-
this.configureMultiBinding(new InstanceMultiBinding<string>(ClientActionKinds), binding => this.configureClientActions(binding));
|
|
190
164
|
this.configureMultiBinding(new InstanceMultiBinding<ActionHandlerConstructor>(ActionHandlerConstructor), binding =>
|
|
191
165
|
this.configureActionHandlers(binding)
|
|
192
166
|
);
|
|
@@ -201,7 +175,7 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
201
175
|
applyBindingTarget(context, CommandStack, this.bindCommandStack()).inSingletonScope();
|
|
202
176
|
|
|
203
177
|
// Navigation
|
|
204
|
-
applyOptionalBindingTarget(context, NavigationTargetResolver, this.bindNavigationTargetResolver());
|
|
178
|
+
applyOptionalBindingTarget(context, NavigationTargetResolver, this.bindNavigationTargetResolver())?.inSingletonScope();
|
|
205
179
|
this.configureMultiBinding(new MultiBinding<NavigationTargetProvider>(NavigationTargetProviders), binding =>
|
|
206
180
|
this.configureNavigationTargetProviders(binding)
|
|
207
181
|
);
|
|
@@ -217,8 +191,10 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
217
191
|
this.configureMultiBinding(new MultiBinding<ClientSessionInitializer>(ClientSessionInitializer), binding =>
|
|
218
192
|
this.configureClientSessionInitializers(binding)
|
|
219
193
|
);
|
|
220
|
-
|
|
221
|
-
applyOptionalBindingTarget(context,
|
|
194
|
+
applyBindingTarget(context, ProgressService, this.bindProgressService()).inSingletonScope();
|
|
195
|
+
applyOptionalBindingTarget(context, PopupModelFactory, this.bindPopupModelFactory())?.inSingletonScope();
|
|
196
|
+
applyOptionalBindingTarget(context, LayoutEngine, this.bindLayoutEngine())?.inSingletonScope();
|
|
197
|
+
applyOptionalBindingTarget(context, EdgeCreationChecker, this.bindEdgeCreationChecker())?.inSingletonScope();
|
|
222
198
|
}
|
|
223
199
|
|
|
224
200
|
configureClientSessionInitializers(binding: MultiBinding<ClientSessionInitializer>): void {
|
|
@@ -227,11 +203,11 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
227
203
|
}
|
|
228
204
|
|
|
229
205
|
protected configureActionHandlers(binding: InstanceMultiBinding<ActionHandlerConstructor>): void {
|
|
230
|
-
binding.add(ClientActionHandler);
|
|
231
206
|
binding.add(RequestModelActionHandler);
|
|
232
207
|
binding.add(RequestContextActionsHandler);
|
|
233
208
|
binding.add(RequestTypeHintsActionHandler);
|
|
234
209
|
binding.add(OperationActionHandler);
|
|
210
|
+
binding.add(RequestCheckEdgeActionHandler);
|
|
235
211
|
binding.add(RequestMarkersHandler);
|
|
236
212
|
binding.add(RequestPopupModelActionHandler);
|
|
237
213
|
binding.add(RequestEditValidationHandler);
|
|
@@ -254,6 +230,10 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
254
230
|
return DefaultGModelSerializer;
|
|
255
231
|
}
|
|
256
232
|
|
|
233
|
+
protected bindClientActionForwarder(): BindingTarget<ClientActionForwarder> {
|
|
234
|
+
return ClientActionForwarder;
|
|
235
|
+
}
|
|
236
|
+
|
|
257
237
|
protected bindGModelIndex(): BindingTarget<GModelIndex> {
|
|
258
238
|
return GModelIndex;
|
|
259
239
|
}
|
|
@@ -308,6 +288,10 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
308
288
|
binding.add(LayoutOperationHandler);
|
|
309
289
|
}
|
|
310
290
|
|
|
291
|
+
protected bindProgressService(): BindingTarget<ProgressService> {
|
|
292
|
+
return DefaultProgressService;
|
|
293
|
+
}
|
|
294
|
+
|
|
311
295
|
protected configureContextActionProviders(binding: MultiBinding<ContextActionsProvider>): void {
|
|
312
296
|
// empty as default
|
|
313
297
|
}
|
|
@@ -320,37 +304,6 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
320
304
|
// empty as default
|
|
321
305
|
}
|
|
322
306
|
|
|
323
|
-
protected configureClientActions(binding: InstanceMultiBinding<string>): void {
|
|
324
|
-
binding.add(CenterAction.KIND);
|
|
325
|
-
binding.add(ExportSvgAction.KIND);
|
|
326
|
-
binding.add(DeleteMarkersAction.KIND);
|
|
327
|
-
binding.add(FitToScreenAction.KIND);
|
|
328
|
-
binding.add(SourceModelChangedAction.KIND);
|
|
329
|
-
binding.add(NavigateToTargetAction.KIND);
|
|
330
|
-
binding.add(NavigateToExternalTargetAction.KIND);
|
|
331
|
-
binding.add(RequestBoundsAction.KIND);
|
|
332
|
-
binding.add(SelectAction.KIND);
|
|
333
|
-
binding.add(SelectAllAction.KIND);
|
|
334
|
-
binding.add(ServerMessageAction.KIND);
|
|
335
|
-
binding.add(SetBoundsAction.KIND);
|
|
336
|
-
binding.add(SetClipboardDataAction.KIND);
|
|
337
|
-
binding.add(SetContextActions.KIND);
|
|
338
|
-
binding.add(SetDirtyStateAction.KIND);
|
|
339
|
-
binding.add(SetEditModeAction.KIND);
|
|
340
|
-
binding.add(SetEditValidationResultAction.KIND);
|
|
341
|
-
binding.add(SetMarkersAction.KIND);
|
|
342
|
-
binding.add(SetModelAction.KIND);
|
|
343
|
-
binding.add(SetNavigationTargetsAction.KIND);
|
|
344
|
-
binding.add(SetPopupModelAction.KIND);
|
|
345
|
-
binding.add(SetResolvedNavigationTargetAction.KIND);
|
|
346
|
-
binding.add(SetTypeHintsAction.KIND);
|
|
347
|
-
binding.add(SetViewportAction.KIND);
|
|
348
|
-
binding.add(ServerStatusAction.KIND);
|
|
349
|
-
binding.add(TriggerNodeCreationAction.KIND);
|
|
350
|
-
binding.add(TriggerEdgeCreationAction.KIND);
|
|
351
|
-
binding.add(UpdateModelAction.KIND);
|
|
352
|
-
}
|
|
353
|
-
|
|
354
307
|
protected bindContextActionsProviderRegistry(): BindingTarget<ContextActionsProviderRegistry> {
|
|
355
308
|
return ContextActionsProviderRegistry;
|
|
356
309
|
}
|
|
@@ -383,6 +336,7 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
383
336
|
protected bindModelValidator(): BindingTarget<ModelValidator> | undefined {
|
|
384
337
|
return undefined;
|
|
385
338
|
}
|
|
339
|
+
|
|
386
340
|
protected bindLabelEditValidator(): BindingTarget<LabelEditValidator> | undefined {
|
|
387
341
|
return undefined;
|
|
388
342
|
}
|
|
@@ -390,9 +344,11 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
390
344
|
protected bindToolPaletteItemProvider(): BindingTarget<ToolPaletteItemProvider> | undefined {
|
|
391
345
|
return DefaultToolPaletteItemProvider;
|
|
392
346
|
}
|
|
347
|
+
|
|
393
348
|
protected bindCommandPaletteActionProvider(): BindingTarget<CommandPaletteActionProvider> | undefined {
|
|
394
349
|
return undefined;
|
|
395
350
|
}
|
|
351
|
+
|
|
396
352
|
protected bindContextMenuItemProvider(): BindingTarget<ContextMenuItemProvider> | undefined {
|
|
397
353
|
return undefined;
|
|
398
354
|
}
|
|
@@ -404,7 +360,12 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
404
360
|
protected bindPopupModelFactory(): BindingTarget<PopupModelFactory> | undefined {
|
|
405
361
|
return undefined;
|
|
406
362
|
}
|
|
363
|
+
|
|
407
364
|
protected bindLayoutEngine(): BindingTarget<LayoutEngine> | undefined {
|
|
408
365
|
return undefined;
|
|
409
366
|
}
|
|
367
|
+
|
|
368
|
+
protected bindEdgeCreationChecker(): BindingTarget<EdgeCreationChecker> | undefined {
|
|
369
|
+
return undefined;
|
|
370
|
+
}
|
|
410
371
|
}
|
|
@@ -41,7 +41,6 @@ import { DiagramModules, InjectionContainer } from './service-identifiers';
|
|
|
41
41
|
* * {@link ClientSessionFactory}
|
|
42
42
|
* * {@link ClientSessionManager}
|
|
43
43
|
* * {@link GlobalActionProvider}
|
|
44
|
-
* * {@link GLSPClientProxy}
|
|
45
44
|
*
|
|
46
45
|
*/
|
|
47
46
|
export class ServerModule extends GLSPModule {
|
|
@@ -16,10 +16,10 @@
|
|
|
16
16
|
import {
|
|
17
17
|
Action,
|
|
18
18
|
ClipboardData,
|
|
19
|
+
GModelElementSchema,
|
|
19
20
|
MaybePromise,
|
|
20
21
|
RequestClipboardDataAction,
|
|
21
|
-
SetClipboardDataAction
|
|
22
|
-
SModelElementSchema
|
|
22
|
+
SetClipboardDataAction
|
|
23
23
|
} from '@eclipse-glsp/protocol';
|
|
24
24
|
import { inject, injectable } from 'inversify';
|
|
25
25
|
import { ActionHandler } from '../../actions/action-handler';
|
|
@@ -37,7 +37,7 @@ export class RequestClipboardDataActionHandler implements ActionHandler {
|
|
|
37
37
|
protected modelSerializer: GModelSerializer;
|
|
38
38
|
|
|
39
39
|
execute(action: RequestClipboardDataAction): MaybePromise<Action[]> {
|
|
40
|
-
const schemas:
|
|
40
|
+
const schemas: GModelElementSchema[] = [];
|
|
41
41
|
const index = this.modelState.index;
|
|
42
42
|
const selectedElements = index.getAll(action.editorContext.selectedElementIds);
|
|
43
43
|
const clipboardData: ClipboardData = { format: 'application/json' };
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
/* Derived from sprotty (https://github.com/eclipse/sprotty/blob/master/packages/sprotty/src/base/model/smodel-factory.ts) */
|
|
17
|
-
import { GModelElement, GModelElementConstructor,
|
|
18
|
-
import {
|
|
17
|
+
import { GModelElement, GModelElementConstructor, GModelRoot } from '@eclipse-glsp/graph';
|
|
18
|
+
import { GModelElementSchema, GModelRootSchema } from '@eclipse-glsp/protocol';
|
|
19
19
|
import { inject, injectable } from 'inversify';
|
|
20
20
|
import { DiagramConfiguration } from '../../diagram/diagram-configuration';
|
|
21
21
|
import { GLSPServerError } from '../../utils/glsp-server-error';
|
|
@@ -65,7 +65,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
65
65
|
@inject(DiagramConfiguration) protected diagramConfiguration: DiagramConfiguration;
|
|
66
66
|
|
|
67
67
|
reservedKeys = ['children', 'parent', 'index', 'source', 'target'];
|
|
68
|
-
createRoot(schema:
|
|
68
|
+
createRoot(schema: GModelElementSchema): GModelRoot {
|
|
69
69
|
const constructor = this.getConfiguredConstructor(schema);
|
|
70
70
|
if (constructor) {
|
|
71
71
|
const element = new constructor();
|
|
@@ -77,7 +77,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
77
77
|
throw new GLSPServerError(`No constructor is configured in DiagramConfiguration for type ${schema.type}`);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
getConfiguredConstructor(schema:
|
|
80
|
+
getConfiguredConstructor(schema: GModelElementSchema): GModelElementConstructor | undefined {
|
|
81
81
|
let key = schema.type;
|
|
82
82
|
while (!this.diagramConfiguration.typeMapping.has(key)) {
|
|
83
83
|
const i = key.lastIndexOf(':');
|
|
@@ -95,7 +95,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
95
95
|
return constructor;
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
createElement(schema:
|
|
98
|
+
createElement(schema: GModelElementSchema, parent?: GModelElement): GModelElement {
|
|
99
99
|
const constructor = this.getConfiguredConstructor(schema);
|
|
100
100
|
if (constructor) {
|
|
101
101
|
const element = new constructor();
|
|
@@ -109,7 +109,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
109
109
|
throw new GLSPServerError(`No constructor is configured in DiagramConfiguration for type ${schema.type}`);
|
|
110
110
|
}
|
|
111
111
|
|
|
112
|
-
createSchema(element: GModelElement):
|
|
112
|
+
createSchema(element: GModelElement): GModelElementSchema {
|
|
113
113
|
const schema = {};
|
|
114
114
|
for (const key in element) {
|
|
115
115
|
if (!this.isReserved(element, key)) {
|
|
@@ -121,15 +121,15 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
121
121
|
}
|
|
122
122
|
(schema as any)['children'] = (element.children ?? []).map(child => this.createSchema(child));
|
|
123
123
|
|
|
124
|
-
return schema as
|
|
124
|
+
return schema as GModelElementSchema;
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
protected initializeRoot(root: GModelRoot, schema:
|
|
127
|
+
protected initializeRoot(root: GModelRoot, schema: GModelRootSchema): GModelRoot {
|
|
128
128
|
this.initializeParent(root, schema);
|
|
129
129
|
return root;
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
protected initializeElement(element: GModelElement, schema:
|
|
132
|
+
protected initializeElement(element: GModelElement, schema: GModelRootSchema): GModelElement {
|
|
133
133
|
for (const key in schema) {
|
|
134
134
|
if (!this.isReserved(element, key)) {
|
|
135
135
|
const value = (schema as any)[key];
|
|
@@ -141,7 +141,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
141
141
|
return element;
|
|
142
142
|
}
|
|
143
143
|
|
|
144
|
-
protected initializeChild(child: GModelElement, schema:
|
|
144
|
+
protected initializeChild(child: GModelElement, schema: GModelElementSchema, parent?: GModelElement): GModelElement {
|
|
145
145
|
this.initializeParent(child, schema);
|
|
146
146
|
if (parent) {
|
|
147
147
|
child.parent = parent;
|
|
@@ -149,7 +149,7 @@ export class DefaultGModelSerializer implements GModelSerializer {
|
|
|
149
149
|
return child;
|
|
150
150
|
}
|
|
151
151
|
|
|
152
|
-
protected initializeParent(parent: GModelElement, schema:
|
|
152
|
+
protected initializeParent(parent: GModelElement, schema: GModelElementSchema): GModelElement {
|
|
153
153
|
this.initializeElement(parent, schema);
|
|
154
154
|
if (schema.children) {
|
|
155
155
|
parent.children = schema.children.map(childSchema => this.createElement(childSchema, parent));
|
|
@@ -13,24 +13,38 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { GModelRootSchema } from '@eclipse-glsp/graph';
|
|
17
16
|
import {
|
|
18
17
|
Action,
|
|
19
18
|
DirtyStateChangeReason,
|
|
19
|
+
GModelRootSchema,
|
|
20
|
+
MarkersReason,
|
|
20
21
|
MaybePromise,
|
|
21
22
|
RequestBoundsAction,
|
|
23
|
+
RequestModelAction,
|
|
22
24
|
SetDirtyStateAction,
|
|
25
|
+
SetMarkersAction,
|
|
23
26
|
SetModelAction,
|
|
24
27
|
UpdateModelAction
|
|
25
28
|
} from '@eclipse-glsp/protocol';
|
|
29
|
+
|
|
26
30
|
import { inject, injectable, optional } from 'inversify';
|
|
27
31
|
import { CommandStack } from '../../command/command-stack';
|
|
28
32
|
import { DiagramConfiguration, ServerLayoutKind } from '../../diagram/diagram-configuration';
|
|
29
33
|
import { LayoutEngine } from '../layout/layout-engine';
|
|
34
|
+
import { ModelValidator } from '../validation/model-validator';
|
|
30
35
|
import { GModelFactory } from './gmodel-factory';
|
|
31
36
|
import { GModelSerializer } from './gmodel-serializer';
|
|
32
37
|
import { ModelState } from './model-state';
|
|
33
38
|
|
|
39
|
+
/**
|
|
40
|
+
* Helper class that provides utility methods to handle model updates i.e.
|
|
41
|
+
* submit a new model to the client. In addition, to the core model update action this class
|
|
42
|
+
* also takes care of related behavior like dirty state handling, validation and client/server side layouting.
|
|
43
|
+
* Note that the submissions handler is only responsible for deriving the set of actions that comprise a model update
|
|
44
|
+
* but does not actually dispatch them. The returned actions should be either manually dispatched
|
|
45
|
+
* to the `ActionDispatcher`, or simply returned as the result of an
|
|
46
|
+
* `ActionHandler.execute` method.
|
|
47
|
+
*/
|
|
34
48
|
@injectable()
|
|
35
49
|
export class ModelSubmissionHandler {
|
|
36
50
|
@inject(DiagramConfiguration)
|
|
@@ -52,8 +66,38 @@ export class ModelSubmissionHandler {
|
|
|
52
66
|
@inject(CommandStack)
|
|
53
67
|
protected commandStack: CommandStack;
|
|
54
68
|
|
|
69
|
+
@inject(ModelValidator)
|
|
70
|
+
@optional()
|
|
71
|
+
protected validator?: ModelValidator;
|
|
72
|
+
|
|
73
|
+
protected requestModelAction?: RequestModelAction;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* Returns a list of actions to submit the initial revision of the client-side model, based on the injected
|
|
77
|
+
* {@link GModelState}. Typically this method is invoked by the {@link RequestModelActionHandler} when the diagram
|
|
78
|
+
* is (re)loaded.
|
|
79
|
+
* <p>
|
|
80
|
+
* These actions are not processed by this {@link ModelSubmissionHandler}, but should be either manually dispatched
|
|
81
|
+
* to the {@link ActionDispatcher}, or simply returned as the result of an
|
|
82
|
+
* {@link ActionHandler#execute(Action)} method.
|
|
83
|
+
* </p>
|
|
84
|
+
*
|
|
85
|
+
* @param requestAction The {@link RequestModelAction} that triggere the initial model update
|
|
86
|
+
* @return A list of actions to be processed in order to submit the intial model.
|
|
87
|
+
*
|
|
88
|
+
*/
|
|
89
|
+
submitInitialModel(requestAction: RequestModelAction): MaybePromise<Action[]> {
|
|
90
|
+
/*
|
|
91
|
+
* In the default update action flow a `RequestModelAction` does not directly trigger a `SetModelAction` response
|
|
92
|
+
* (RequestModelAction (C) -> RequestBoundsAction (S) -> ComputedBoundsAction (C) -> SetModelACtion (S)
|
|
93
|
+
* Therefore we temporarily store the action later retrival
|
|
94
|
+
*/
|
|
95
|
+
this.requestModelAction = requestAction;
|
|
96
|
+
return this.submitModel();
|
|
97
|
+
}
|
|
98
|
+
|
|
55
99
|
/**
|
|
56
|
-
* Returns a list of actions to update the client-side model, based on the
|
|
100
|
+
* Returns a list of actions to update the client-side model, based on the injected {@link ModelState}
|
|
57
101
|
*
|
|
58
102
|
* These actions are not processed by this {@link ModelSubmissionHandler}, but should be either manually dispatched
|
|
59
103
|
* to the `ActionDispatcher`, or simply returned as the result of an `ActionHandler.execute()` method.
|
|
@@ -63,13 +107,15 @@ export class ModelSubmissionHandler {
|
|
|
63
107
|
*/
|
|
64
108
|
submitModel(reason?: DirtyStateChangeReason): MaybePromise<Action[]> {
|
|
65
109
|
this.modelFactory.createModel();
|
|
66
|
-
|
|
67
|
-
const
|
|
110
|
+
|
|
111
|
+
const revision = this.requestModelAction ? 0 : this.modelState.root.revision! + 1;
|
|
112
|
+
this.modelState.root.revision = revision;
|
|
68
113
|
|
|
69
114
|
if (this.diagramConfiguration.needsClientLayout) {
|
|
115
|
+
const root = this.serializeGModel();
|
|
70
116
|
return [RequestBoundsAction.create(root), SetDirtyStateAction.create(this.commandStack.isDirty, { reason })];
|
|
71
117
|
}
|
|
72
|
-
return
|
|
118
|
+
return this.submitModelDirectly(reason);
|
|
73
119
|
}
|
|
74
120
|
|
|
75
121
|
/**
|
|
@@ -94,16 +140,27 @@ export class ModelSubmissionHandler {
|
|
|
94
140
|
}
|
|
95
141
|
const result: Action[] = [];
|
|
96
142
|
result.push(
|
|
97
|
-
|
|
98
|
-
?
|
|
143
|
+
this.requestModelAction
|
|
144
|
+
? this.createSetModeAction(root)
|
|
99
145
|
: UpdateModelAction.create(root, { animate: this.diagramConfiguration.animatedUpdate })
|
|
100
146
|
);
|
|
101
147
|
if (!this.diagramConfiguration.needsClientLayout) {
|
|
102
148
|
result.push(SetDirtyStateAction.create(this.commandStack.isDirty, { reason }));
|
|
103
149
|
}
|
|
150
|
+
if (this.validator) {
|
|
151
|
+
const markers = await this.validator.validate([this.modelState.root], MarkersReason.LIVE);
|
|
152
|
+
result.push(SetMarkersAction.create(markers, { reason: MarkersReason.LIVE }));
|
|
153
|
+
}
|
|
104
154
|
return result;
|
|
105
155
|
}
|
|
106
156
|
|
|
157
|
+
protected createSetModeAction(newRoot: GModelRootSchema): SetModelAction {
|
|
158
|
+
const responseId = this.requestModelAction?.requestId ?? '';
|
|
159
|
+
const response = SetModelAction.create(newRoot, { responseId });
|
|
160
|
+
this.requestModelAction = undefined;
|
|
161
|
+
return response;
|
|
162
|
+
}
|
|
163
|
+
|
|
107
164
|
protected serializeGModel(): GModelRootSchema {
|
|
108
165
|
return this.serializer.createSchema(this.modelState.root);
|
|
109
166
|
}
|
|
@@ -13,11 +13,13 @@
|
|
|
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, StatusAction } 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
|
+
import { ClientOptionsUtil } from '../../utils/client-options-util';
|
|
20
21
|
import { Logger } from '../../utils/logger';
|
|
22
|
+
import { ProgressMonitor, ProgressService } from '../progress/progress-service';
|
|
21
23
|
import { ModelState } from './model-state';
|
|
22
24
|
import { ModelSubmissionHandler } from './model-submission-handler';
|
|
23
25
|
import { SourceModelStorage } from './source-model-storage';
|
|
@@ -41,27 +43,45 @@ export class RequestModelActionHandler implements ActionHandler {
|
|
|
41
43
|
@inject(ModelSubmissionHandler)
|
|
42
44
|
protected submissionHandler: ModelSubmissionHandler;
|
|
43
45
|
|
|
46
|
+
@inject(ProgressService)
|
|
47
|
+
protected progressService: ProgressService;
|
|
48
|
+
|
|
44
49
|
async execute(action: RequestModelAction): Promise<Action[]> {
|
|
45
50
|
this.logger.debug('Execute RequestModelAction:', action);
|
|
46
51
|
this.modelState.setAll(action.options ?? {});
|
|
47
52
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
const isReconnecting = ClientOptionsUtil.isReconnecting(action.options);
|
|
54
|
+
|
|
55
|
+
const progress = this.reportModelLoading('Model loading in progress');
|
|
56
|
+
|
|
57
|
+
if (isReconnecting) {
|
|
58
|
+
await this.handleReconnect(action);
|
|
59
|
+
} else {
|
|
60
|
+
await this.sourceModelStorage.loadSourceModel(action);
|
|
61
|
+
}
|
|
62
|
+
this.reportModelLoadingFinished(progress);
|
|
63
|
+
|
|
64
|
+
return this.submissionHandler.submitInitialModel(action);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
protected async handleReconnect(action: RequestModelAction): Promise<void> {
|
|
68
|
+
const oldModelRoot = this.modelState.root;
|
|
69
|
+
if (oldModelRoot) {
|
|
70
|
+
// decrease revision by one, as each submit will increase it by one;
|
|
71
|
+
// the next save would produce warning that source model was changed otherwise
|
|
72
|
+
this.modelState.root.revision = (this.modelState.root.revision ?? 0) - 1;
|
|
73
|
+
} else {
|
|
74
|
+
await this.sourceModelStorage.loadSourceModel(action);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected reportModelLoading(message: string): ProgressMonitor {
|
|
79
|
+
this.actionDispatcher.dispatch(StatusAction.create(message, { severity: 'INFO' }));
|
|
80
|
+
return this.progressService.start(message);
|
|
53
81
|
}
|
|
54
82
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
* @param message The message that should be sent to the client
|
|
59
|
-
*/
|
|
60
|
-
protected notifyClient(message = ''): void {
|
|
61
|
-
const severity = message.length > 0 ? 'INFO' : 'NONE';
|
|
62
|
-
this.actionDispatcher.dispatchAll(
|
|
63
|
-
ServerMessageAction.create(message, { severity }),
|
|
64
|
-
ServerStatusAction.create(message, { severity })
|
|
65
|
-
);
|
|
83
|
+
protected reportModelLoadingFinished(monitor: ProgressMonitor): void {
|
|
84
|
+
this.actionDispatcher.dispatch(StatusAction.create('', { severity: 'NONE' }));
|
|
85
|
+
monitor.end();
|
|
66
86
|
}
|
|
67
87
|
}
|
|
@@ -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
|
+
}
|