@eclipse-glsp/server 1.1.0-next.146ae06.49 → 1.1.0-next.342c713.66
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 +26 -3
- 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 -14
- package/lib/common/command/recording-command.d.ts.map +1 -1
- package/lib/common/command/recording-command.js +36 -27
- 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 +20 -1
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +10 -48
- 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/diagram/request-type-hints-action-handler.js +2 -2
- 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 -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.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 +28 -2
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +48 -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 +74 -0
- package/lib/common/features/progress/progress-service.js.map +1 -0
- package/lib/common/features/validation/model-validator.js +2 -2
- package/lib/common/features/validation/model-validator.js.map +1 -1
- package/lib/common/features/validation/request-markers-handler.js +2 -2
- 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.js +2 -2
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +2 -2
- 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.js +26 -3
- 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 +1 -0
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +1 -0
- 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/{command/recording-command.spec.d.ts → protocol/client-action.d.ts} +16 -2
- 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.d.ts +1 -1
- package/lib/common/utils/console-logger.js +3 -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 -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 +33 -4
- package/lib/node/abstract-json-model-storage.js.map +1 -1
- package/lib/node/di/app-module.js +24 -1
- package/lib/node/di/app-module.js.map +1 -1
- package/lib/node/gmodel/gmodel-storage.js +2 -2
- package/lib/node/gmodel/gmodel-storage.js.map +1 -1
- package/lib/node/launch/cli-parser.js +26 -3
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/lib/node/launch/socket-cli-parser.js +24 -1
- package/lib/node/launch/socket-cli-parser.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +27 -4
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.js +27 -4
- package/lib/node/launch/websocket-server-launcher.js.map +1 -1
- package/package.json +6 -5
- 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 -26
- 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 +14 -66
- package/src/common/di/server-module.ts +0 -1
- package/src/common/features/model/model-state.ts +3 -0
- package/src/common/features/model/model-submission-handler.ts +51 -6
- 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/gmodel/gmodel-create-edge-operation-handler.ts +3 -3
- package/src/common/gmodel/gmodel-create-node-operation-handler.ts +3 -3
- package/src/common/index.ts +1 -0
- 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/console-logger.ts +1 -1
- 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/launch/cli-parser.ts +1 -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.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,17 +13,24 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { GLSPClientProxy } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { GLSPClientProxy, bindOrRebind } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { ContainerModule } from 'inversify';
|
|
18
|
-
import { ClientId } from './service-identifiers';
|
|
18
|
+
import { ClientActionKinds, ClientId } from './service-identifiers';
|
|
19
19
|
|
|
20
|
-
export
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
20
|
+
export interface ClientSessionModuleOptions {
|
|
21
|
+
clientId: string;
|
|
22
|
+
glspClient: GLSPClientProxy;
|
|
23
|
+
clientActionKinds: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates the DI module that binds client session specific configuration
|
|
28
|
+
*/
|
|
29
|
+
export function createClientSessionModule(options: ClientSessionModuleOptions): ContainerModule {
|
|
30
|
+
return new ContainerModule((bind, unbind, isBound, rebind) => {
|
|
31
|
+
const context = { bind, unbind, isBound, rebind };
|
|
32
|
+
bindOrRebind(context, ClientId).toConstantValue(options.clientId);
|
|
33
|
+
bind(GLSPClientProxy).toConstantValue(options.glspClient);
|
|
34
|
+
bind(ClientActionKinds).toConstantValue(new Set(options.clientActionKinds));
|
|
28
35
|
});
|
|
29
36
|
}
|
|
@@ -13,41 +13,11 @@
|
|
|
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';
|
|
@@ -86,6 +56,7 @@ import { RequestNavigationTargetsActionHandler } from '../features/navigation/re
|
|
|
86
56
|
import { ResolveNavigationTargetsActionHandler } from '../features/navigation/resolve-navigation-targets-action-handler';
|
|
87
57
|
import { PopupModelFactory } from '../features/popup/popup-model-factory';
|
|
88
58
|
import { RequestPopupModelActionHandler } from '../features/popup/request-popup-model-action-handler';
|
|
59
|
+
import { DefaultProgressService, ProgressService } from '../features/progress/progress-service';
|
|
89
60
|
import { ModelValidator } from '../features/validation/model-validator';
|
|
90
61
|
import { RequestMarkersHandler } from '../features/validation/request-markers-handler';
|
|
91
62
|
import { CompoundOperationHandler } from '../operations/compound-operation-handler';
|
|
@@ -93,11 +64,10 @@ import { OperationActionHandler } from '../operations/operation-action-handler';
|
|
|
93
64
|
import { OperationHandlerConstructor, OperationHandlerFactory } from '../operations/operation-handler';
|
|
94
65
|
import { OperationHandlerRegistry, OperationHandlerRegistryInitializer } from '../operations/operation-handler-registry';
|
|
95
66
|
import { ClientSessionInitializer } from '../session/client-session-initializer';
|
|
96
|
-
import { applyBindingTarget, applyOptionalBindingTarget
|
|
67
|
+
import { BindingTarget, applyBindingTarget, applyOptionalBindingTarget } from './binding-target';
|
|
97
68
|
import { GLSPModule } from './glsp-module';
|
|
98
69
|
import { InstanceMultiBinding, MultiBinding } from './multi-binding';
|
|
99
70
|
import {
|
|
100
|
-
ClientActionKinds,
|
|
101
71
|
ClientId,
|
|
102
72
|
ContextActionsProviders,
|
|
103
73
|
ContextEditValidators,
|
|
@@ -133,6 +103,7 @@ import {
|
|
|
133
103
|
* - {@link ContextActionsProviders} as {@link ClassMultiBinding<ContextActionsProvider>} (empty)
|
|
134
104
|
* - {@link ContextActionsProviderRegistry}
|
|
135
105
|
* - {@link ActionDispatcher}
|
|
106
|
+
* - {@link ProgressService}
|
|
136
107
|
* - {@link ClientActionKinds} as {@link InstanceMultiBinding<string>}
|
|
137
108
|
* - {@link ActionHandler} as {@link InstanceMultiBinding<ActionHandlerConstructor>}
|
|
138
109
|
* - {@link ActionHandlerFactory}
|
|
@@ -162,6 +133,7 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
162
133
|
applyBindingTarget(context, DiagramType, this.bindDiagramType());
|
|
163
134
|
applyBindingTarget(context, ClientId, this.bindClientId());
|
|
164
135
|
applyBindingTarget(context, DiagramConfiguration, this.bindDiagramConfiguration()).inSingletonScope();
|
|
136
|
+
applyBindingTarget(context, ClientActionForwarder, this.bindClientActionForwarder()).inSingletonScope();
|
|
165
137
|
|
|
166
138
|
// Model-related bindings
|
|
167
139
|
applyBindingTarget(context, GModelSerializer, this.bindGModelSerializer()).inSingletonScope();
|
|
@@ -186,7 +158,6 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
186
158
|
|
|
187
159
|
// Action & operation related bindings
|
|
188
160
|
applyBindingTarget(context, ActionDispatcher, this.bindActionDispatcher()).inSingletonScope();
|
|
189
|
-
this.configureMultiBinding(new InstanceMultiBinding<string>(ClientActionKinds), binding => this.configureClientActions(binding));
|
|
190
161
|
this.configureMultiBinding(new InstanceMultiBinding<ActionHandlerConstructor>(ActionHandlerConstructor), binding =>
|
|
191
162
|
this.configureActionHandlers(binding)
|
|
192
163
|
);
|
|
@@ -217,6 +188,7 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
217
188
|
this.configureMultiBinding(new MultiBinding<ClientSessionInitializer>(ClientSessionInitializer), binding =>
|
|
218
189
|
this.configureClientSessionInitializers(binding)
|
|
219
190
|
);
|
|
191
|
+
applyBindingTarget(context, ProgressService, this.bindProgressService()).inSingletonScope();
|
|
220
192
|
applyOptionalBindingTarget(context, PopupModelFactory, this.bindPopupModelFactory());
|
|
221
193
|
applyOptionalBindingTarget(context, LayoutEngine, this.bindLayoutEngine?.());
|
|
222
194
|
}
|
|
@@ -227,7 +199,6 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
227
199
|
}
|
|
228
200
|
|
|
229
201
|
protected configureActionHandlers(binding: InstanceMultiBinding<ActionHandlerConstructor>): void {
|
|
230
|
-
binding.add(ClientActionHandler);
|
|
231
202
|
binding.add(RequestModelActionHandler);
|
|
232
203
|
binding.add(RequestContextActionsHandler);
|
|
233
204
|
binding.add(RequestTypeHintsActionHandler);
|
|
@@ -254,6 +225,10 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
254
225
|
return DefaultGModelSerializer;
|
|
255
226
|
}
|
|
256
227
|
|
|
228
|
+
protected bindClientActionForwarder(): BindingTarget<ClientActionForwarder> {
|
|
229
|
+
return ClientActionForwarder;
|
|
230
|
+
}
|
|
231
|
+
|
|
257
232
|
protected bindGModelIndex(): BindingTarget<GModelIndex> {
|
|
258
233
|
return GModelIndex;
|
|
259
234
|
}
|
|
@@ -308,6 +283,10 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
308
283
|
binding.add(LayoutOperationHandler);
|
|
309
284
|
}
|
|
310
285
|
|
|
286
|
+
protected bindProgressService(): BindingTarget<ProgressService> {
|
|
287
|
+
return DefaultProgressService;
|
|
288
|
+
}
|
|
289
|
+
|
|
311
290
|
protected configureContextActionProviders(binding: MultiBinding<ContextActionsProvider>): void {
|
|
312
291
|
// empty as default
|
|
313
292
|
}
|
|
@@ -320,37 +299,6 @@ export abstract class DiagramModule extends GLSPModule {
|
|
|
320
299
|
// empty as default
|
|
321
300
|
}
|
|
322
301
|
|
|
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
302
|
protected bindContextActionsProviderRegistry(): BindingTarget<ContextActionsProviderRegistry> {
|
|
355
303
|
return ContextActionsProviderRegistry;
|
|
356
304
|
}
|
|
@@ -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 {
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
MarkersReason,
|
|
21
21
|
MaybePromise,
|
|
22
22
|
RequestBoundsAction,
|
|
23
|
+
RequestModelAction,
|
|
23
24
|
SetDirtyStateAction,
|
|
24
25
|
SetMarkersAction,
|
|
25
26
|
SetModelAction,
|
|
@@ -35,6 +36,15 @@ import { GModelFactory } from './gmodel-factory';
|
|
|
35
36
|
import { GModelSerializer } from './gmodel-serializer';
|
|
36
37
|
import { ModelState } from './model-state';
|
|
37
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
|
+
*/
|
|
38
48
|
@injectable()
|
|
39
49
|
export class ModelSubmissionHandler {
|
|
40
50
|
@inject(DiagramConfiguration)
|
|
@@ -60,8 +70,34 @@ export class ModelSubmissionHandler {
|
|
|
60
70
|
@optional()
|
|
61
71
|
protected validator?: ModelValidator;
|
|
62
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
|
+
|
|
63
99
|
/**
|
|
64
|
-
* 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}
|
|
65
101
|
*
|
|
66
102
|
* These actions are not processed by this {@link ModelSubmissionHandler}, but should be either manually dispatched
|
|
67
103
|
* to the `ActionDispatcher`, or simply returned as the result of an `ActionHandler.execute()` method.
|
|
@@ -71,13 +107,15 @@ export class ModelSubmissionHandler {
|
|
|
71
107
|
*/
|
|
72
108
|
submitModel(reason?: DirtyStateChangeReason): MaybePromise<Action[]> {
|
|
73
109
|
this.modelFactory.createModel();
|
|
74
|
-
|
|
75
|
-
const
|
|
110
|
+
|
|
111
|
+
const revision = this.requestModelAction ? 0 : this.modelState.root.revision! + 1;
|
|
112
|
+
this.modelState.root.revision = revision;
|
|
76
113
|
|
|
77
114
|
if (this.diagramConfiguration.needsClientLayout) {
|
|
115
|
+
const root = this.serializeGModel();
|
|
78
116
|
return [RequestBoundsAction.create(root), SetDirtyStateAction.create(this.commandStack.isDirty, { reason })];
|
|
79
117
|
}
|
|
80
|
-
return
|
|
118
|
+
return this.submitModelDirectly(reason);
|
|
81
119
|
}
|
|
82
120
|
|
|
83
121
|
/**
|
|
@@ -102,8 +140,8 @@ export class ModelSubmissionHandler {
|
|
|
102
140
|
}
|
|
103
141
|
const result: Action[] = [];
|
|
104
142
|
result.push(
|
|
105
|
-
|
|
106
|
-
?
|
|
143
|
+
this.requestModelAction
|
|
144
|
+
? this.createSetModeAction(root)
|
|
107
145
|
: UpdateModelAction.create(root, { animate: this.diagramConfiguration.animatedUpdate })
|
|
108
146
|
);
|
|
109
147
|
if (!this.diagramConfiguration.needsClientLayout) {
|
|
@@ -116,6 +154,13 @@ export class ModelSubmissionHandler {
|
|
|
116
154
|
return result;
|
|
117
155
|
}
|
|
118
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
|
+
|
|
119
164
|
protected serializeGModel(): GModelRootSchema {
|
|
120
165
|
return this.serializer.createSchema(this.modelState.root);
|
|
121
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
|
+
}
|
|
@@ -19,7 +19,7 @@ import { GNode } from '@eclipse-glsp/graph/lib/gnode';
|
|
|
19
19
|
import { CreateEdgeOperation, MaybePromise, TriggerEdgeCreationAction } from '@eclipse-glsp/protocol';
|
|
20
20
|
import { injectable } from 'inversify';
|
|
21
21
|
import { Command } from '../command/command';
|
|
22
|
-
import {
|
|
22
|
+
import { CreateEdgeOperationHandler } from '../operations/create-operation-handler';
|
|
23
23
|
import { GModelOperationHandler } from './gmodel-operation-handler';
|
|
24
24
|
|
|
25
25
|
/**
|
|
@@ -28,8 +28,8 @@ import { GModelOperationHandler } from './gmodel-operation-handler';
|
|
|
28
28
|
* (i.e. all operation handlers directly modify the graphical model).
|
|
29
29
|
*/
|
|
30
30
|
@injectable()
|
|
31
|
-
export abstract class GModelCreateEdgeOperationHandler extends GModelOperationHandler implements
|
|
32
|
-
override readonly operationType
|
|
31
|
+
export abstract class GModelCreateEdgeOperationHandler extends GModelOperationHandler implements CreateEdgeOperationHandler {
|
|
32
|
+
override readonly operationType = CreateEdgeOperation.KIND;
|
|
33
33
|
abstract override label: string;
|
|
34
34
|
abstract elementTypeIds: string[];
|
|
35
35
|
|
|
@@ -19,7 +19,7 @@ import { CreateNodeOperation, MaybePromise, Point, SelectAction, TriggerNodeCrea
|
|
|
19
19
|
import { inject, injectable } from 'inversify';
|
|
20
20
|
import { ActionDispatcher } from '../actions/action-dispatcher';
|
|
21
21
|
import { Command } from '../command/command';
|
|
22
|
-
import {
|
|
22
|
+
import { CreateNodeOperationHandler } from '../operations/create-operation-handler';
|
|
23
23
|
import { getRelativeLocation } from '../utils/layout-util';
|
|
24
24
|
import { GModelOperationHandler } from './gmodel-operation-handler';
|
|
25
25
|
|
|
@@ -29,7 +29,7 @@ import { GModelOperationHandler } from './gmodel-operation-handler';
|
|
|
29
29
|
* (i.e. all operation handlers directly modify the graphical model).
|
|
30
30
|
*/
|
|
31
31
|
@injectable()
|
|
32
|
-
export abstract class GModelCreateNodeOperationHandler extends GModelOperationHandler implements
|
|
32
|
+
export abstract class GModelCreateNodeOperationHandler extends GModelOperationHandler implements CreateNodeOperationHandler {
|
|
33
33
|
@inject(ActionDispatcher)
|
|
34
34
|
protected actionDispatcher: ActionDispatcher;
|
|
35
35
|
|
|
@@ -37,7 +37,7 @@ export abstract class GModelCreateNodeOperationHandler extends GModelOperationHa
|
|
|
37
37
|
|
|
38
38
|
abstract override label: string;
|
|
39
39
|
|
|
40
|
-
override operationType
|
|
40
|
+
override readonly operationType = CreateNodeOperation.KIND;
|
|
41
41
|
|
|
42
42
|
override createCommand(operation: CreateNodeOperation): MaybePromise<Command | undefined> {
|
|
43
43
|
return this.commandOf(() => this.executeCreation(operation));
|
package/src/common/index.ts
CHANGED
|
@@ -71,6 +71,7 @@ export * from './gmodel/index';
|
|
|
71
71
|
export * from './launch/glsp-server-launcher';
|
|
72
72
|
export * from './operations/compound-operation-handler';
|
|
73
73
|
export * from './operations/create-operation-handler';
|
|
74
|
+
export * from './operations/json-operation-handler';
|
|
74
75
|
export * from './operations/operation-action-handler';
|
|
75
76
|
export * from './operations/operation-handler';
|
|
76
77
|
export * from './operations/operation-handler-registry';
|
|
@@ -19,6 +19,11 @@ import { Command, CompoundCommand } from '../command/command';
|
|
|
19
19
|
import { OperationHandler } from './operation-handler';
|
|
20
20
|
import { OperationHandlerRegistry } from './operation-handler-registry';
|
|
21
21
|
|
|
22
|
+
/**
|
|
23
|
+
* Generic {@link OperationHandler} from {@link CompoundOperations}.
|
|
24
|
+
* Retrieves the corresponding execution commands for the list of (sub) operations
|
|
25
|
+
* and constructs a {@link CompoundCommand} for them.
|
|
26
|
+
*/
|
|
22
27
|
@injectable()
|
|
23
28
|
export class CompoundOperationHandler extends OperationHandler {
|
|
24
29
|
@inject(OperationHandlerRegistry)
|
|
@@ -27,7 +32,7 @@ export class CompoundOperationHandler extends OperationHandler {
|
|
|
27
32
|
operationType = CompoundOperation.KIND;
|
|
28
33
|
|
|
29
34
|
async createCommand(operation: CompoundOperation): Promise<Command | undefined> {
|
|
30
|
-
const maybeCommands = operation.operationList.map(op => this.operationHandlerRegistry.
|
|
35
|
+
const maybeCommands = operation.operationList.map(op => this.operationHandlerRegistry.getOperationHandler(op)?.execute(op));
|
|
31
36
|
const commands: Command[] = [];
|
|
32
37
|
|
|
33
38
|
for await (const command of maybeCommands) {
|
|
@@ -19,21 +19,37 @@ import {
|
|
|
19
19
|
hasArrayProp,
|
|
20
20
|
hasFunctionProp,
|
|
21
21
|
hasStringProp,
|
|
22
|
+
MaybePromise,
|
|
22
23
|
TriggerEdgeCreationAction,
|
|
23
24
|
TriggerNodeCreationAction
|
|
24
25
|
} from '@eclipse-glsp/protocol';
|
|
26
|
+
import { Command } from '../command/command';
|
|
25
27
|
import { OperationHandler } from './operation-handler';
|
|
26
28
|
|
|
27
29
|
/**
|
|
28
|
-
* A special {@link OperationHandler} that is responsible for the handling of {@link
|
|
30
|
+
* A special {@link OperationHandler} that is responsible for the handling of (a subset of) {@link CreateEdgeOperation}s. Depending on its
|
|
29
31
|
* operation type the triggered actions are {@link TriggerNodeCreationAction} or {@link TriggerEdgeCreationAction}s.
|
|
30
32
|
*/
|
|
31
|
-
export interface
|
|
33
|
+
export interface CreateEdgeOperationHandler extends OperationHandler {
|
|
34
|
+
label: string;
|
|
35
|
+
elementTypeIds: string[];
|
|
36
|
+
operationType: typeof CreateEdgeOperation.KIND;
|
|
37
|
+
getTriggerActions(): TriggerEdgeCreationAction[];
|
|
38
|
+
createCommand(operation: CreateEdgeOperation): MaybePromise<Command | undefined>;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export interface CreateNodeOperationHandler extends OperationHandler {
|
|
32
42
|
readonly label: string;
|
|
33
43
|
elementTypeIds: string[];
|
|
34
|
-
operationType:
|
|
35
|
-
getTriggerActions():
|
|
44
|
+
operationType: typeof CreateNodeOperation.KIND;
|
|
45
|
+
getTriggerActions(): TriggerNodeCreationAction[];
|
|
46
|
+
createCommand(operation: CreateNodeOperation): MaybePromise<Command | undefined>;
|
|
36
47
|
}
|
|
48
|
+
/**
|
|
49
|
+
* A special {@link OperationHandler} that is responsible for the handling of a node or edge creation operation. Depending on its
|
|
50
|
+
* operation type the triggered actions are {@link TriggerNodeCreationAction} or {@link TriggerEdgeCreationAction}s.
|
|
51
|
+
*/
|
|
52
|
+
export type CreateOperationHandler = CreateNodeOperationHandler | CreateEdgeOperationHandler;
|
|
37
53
|
|
|
38
54
|
export type CreateOperationKind = typeof CreateNodeOperation.KIND | typeof CreateEdgeOperation.KIND;
|
|
39
55
|
|
|
@@ -41,9 +57,10 @@ export namespace CreateOperationHandler {
|
|
|
41
57
|
export function is(object: unknown): object is CreateOperationHandler {
|
|
42
58
|
return (
|
|
43
59
|
object instanceof OperationHandler &&
|
|
60
|
+
hasStringProp(object, 'operationType') &&
|
|
44
61
|
hasStringProp(object, 'label') &&
|
|
45
62
|
hasArrayProp(object, 'elementTypeIds') &&
|
|
46
|
-
hasFunctionProp(object, 'getTriggerActions')
|
|
63
|
+
hasFunctionProp(object, 'getTriggerActions', true)
|
|
47
64
|
);
|
|
48
65
|
}
|
|
49
66
|
}
|