@eclipse-glsp/server 1.1.0-next.3d7585d.42 → 1.1.0-next.42963d6.55
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/di/app-module.d.ts +2 -7
- package/lib/browser/di/app-module.d.ts.map +1 -1
- package/lib/browser/di/app-module.js +5 -30
- package/lib/browser/di/app-module.js.map +1 -1
- package/lib/browser/index.d.ts +0 -1
- package/lib/browser/index.d.ts.map +1 -1
- package/lib/browser/index.js +0 -1
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/launch/worker-server-launcher.d.ts +11 -8
- package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
- package/lib/browser/launch/worker-server-launcher.js +13 -21
- package/lib/browser/launch/worker-server-launcher.js.map +1 -1
- package/lib/common/actions/client-action-handler.d.ts +1 -2
- package/lib/common/actions/client-action-handler.d.ts.map +1 -1
- package/lib/common/actions/client-action-handler.js +17 -2
- package/lib/common/actions/client-action-handler.js.map +1 -1
- package/lib/common/command/command-stack.d.ts +60 -14
- package/lib/common/command/command-stack.d.ts.map +1 -1
- package/lib/common/command/command-stack.js +78 -24
- package/lib/common/command/command-stack.js.map +1 -1
- package/lib/common/command/command.d.ts +34 -7
- package/lib/common/command/command.d.ts.map +1 -1
- package/lib/common/command/command.js +73 -0
- package/lib/common/command/command.js.map +1 -1
- package/lib/common/command/recording-command.d.ts +75 -0
- package/lib/common/command/recording-command.d.ts.map +1 -0
- package/lib/common/command/recording-command.js +99 -0
- package/lib/common/command/recording-command.js.map +1 -0
- package/lib/common/command/undo-redo-action-handler.d.ts +28 -0
- package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -0
- package/lib/common/command/undo-redo-action-handler.js +72 -0
- package/lib/common/command/undo-redo-action-handler.js.map +1 -0
- package/lib/common/di/client-session-module.d.ts +1 -1
- package/lib/common/di/client-session-module.d.ts.map +1 -1
- package/lib/common/di/client-session-module.js +2 -2
- package/lib/common/di/client-session-module.js.map +1 -1
- package/lib/common/di/diagram-module.d.ts +3 -0
- package/lib/common/di/diagram-module.d.ts.map +1 -1
- package/lib/common/di/diagram-module.js +12 -0
- package/lib/common/di/diagram-module.js.map +1 -1
- package/lib/common/di/glsp-module.d.ts +3 -1
- package/lib/common/di/glsp-module.d.ts.map +1 -1
- package/lib/common/di/glsp-module.js +0 -15
- package/lib/common/di/glsp-module.js.map +1 -1
- package/lib/common/di/multi-binding.d.ts +19 -4
- package/lib/common/di/multi-binding.d.ts.map +1 -1
- package/lib/common/di/multi-binding.js.map +1 -1
- package/lib/common/di/server-module.d.ts +1 -6
- package/lib/common/di/server-module.d.ts.map +1 -1
- package/lib/common/di/server-module.js +21 -17
- package/lib/common/di/server-module.js.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.d.ts +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.d.ts.map +1 -1
- package/lib/common/features/contextactions/tool-palette-item-provider.js +2 -4
- package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
- package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.d.ts +8 -3
- package/lib/common/features/layout/computed-bounds-action-handler.d.ts.map +1 -0
- package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.js +9 -4
- package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -0
- package/lib/common/features/layout/layout-operation-handler.d.ts +12 -3
- package/lib/common/features/layout/layout-operation-handler.d.ts.map +1 -1
- package/lib/common/features/layout/layout-operation-handler.js +26 -10
- package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
- package/lib/common/features/model/model-state.d.ts +0 -2
- package/lib/common/features/model/model-state.d.ts.map +1 -1
- package/lib/common/features/model/model-state.js +0 -1
- package/lib/common/features/model/model-state.js.map +1 -1
- package/lib/common/features/model/model-submission-handler.d.ts +2 -0
- package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
- package/lib/common/features/model/model-submission-handler.js +7 -2
- package/lib/common/features/model/model-submission-handler.js.map +1 -1
- package/lib/common/features/model/save-model-action-handler.d.ts +2 -2
- package/lib/common/features/model/save-model-action-handler.d.ts.map +1 -1
- package/lib/common/features/model/save-model-action-handler.js +5 -5
- package/lib/common/features/model/save-model-action-handler.js.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts +4 -5
- package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.js +12 -21
- package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.d.ts +9 -6
- package/lib/common/gmodel/change-bounds-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/change-bounds-operation-handler.js +14 -14
- package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.d.ts +5 -5
- package/lib/common/gmodel/change-routing-points-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/change-routing-points-operation-handler.js +11 -14
- package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
- package/lib/common/{operations → gmodel}/cut-operation-handler.d.ts +5 -4
- package/lib/common/gmodel/cut-operation-handler.d.ts.map +1 -0
- package/lib/common/{operations → gmodel}/cut-operation-handler.js +13 -11
- package/lib/common/gmodel/cut-operation-handler.js.map +1 -0
- package/lib/common/gmodel/delete-operation-handler.d.ts +6 -6
- package/lib/common/gmodel/delete-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/delete-operation-handler.js +13 -10
- package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +11 -7
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +12 -13
- package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +32 -5
- package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js +45 -3
- package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.d.ts +8 -8
- package/lib/common/gmodel/gmodel-diagram-module.d.ts.map +1 -1
- package/lib/common/gmodel/gmodel-diagram-module.js +15 -21
- package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
- package/lib/{node/launch/socket-server-launcher.spec.d.ts → common/gmodel/gmodel-operation-handler.d.ts} +9 -3
- package/lib/common/gmodel/gmodel-operation-handler.d.ts.map +1 -0
- package/lib/common/{protocol/glsp-client-proxy.js → gmodel/gmodel-operation-handler.js} +25 -35
- package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -0
- package/lib/common/gmodel/index.d.ts +2 -1
- package/lib/common/gmodel/index.d.ts.map +1 -1
- package/lib/common/gmodel/index.js +2 -1
- package/lib/common/gmodel/index.js.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.d.ts +7 -6
- package/lib/common/gmodel/paste-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/paste-operation-handler.js +20 -15
- package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts +5 -5
- package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts.map +1 -1
- package/lib/common/gmodel/reconnect-edge-operation-handler.js +11 -14
- package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
- package/lib/common/index.d.ts +5 -3
- package/lib/common/index.d.ts.map +1 -1
- package/lib/common/index.js +5 -3
- package/lib/common/index.js.map +1 -1
- package/lib/common/launch/glsp-server-launcher.d.ts +8 -7
- package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
- package/lib/common/launch/glsp-server-launcher.js +27 -4
- package/lib/common/launch/glsp-server-launcher.js.map +1 -1
- package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
- package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
- package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
- package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
- package/lib/common/operations/compound-operation-handler.d.ts +5 -5
- package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/compound-operation-handler.js +37 -9
- package/lib/common/operations/compound-operation-handler.js.map +1 -1
- package/lib/common/operations/create-operation-handler.d.ts +8 -40
- package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
- package/lib/common/operations/create-operation-handler.js +26 -85
- package/lib/common/operations/create-operation-handler.js.map +1 -1
- package/lib/common/operations/operation-action-handler.d.ts +10 -1
- package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-action-handler.js +37 -22
- package/lib/common/operations/operation-action-handler.js.map +1 -1
- package/lib/common/operations/operation-handler-registry.d.ts +11 -2
- package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
- package/lib/common/operations/operation-handler-registry.js +31 -2
- package/lib/common/operations/operation-handler-registry.js.map +1 -1
- package/lib/common/operations/operation-handler.d.ts +28 -11
- package/lib/common/operations/operation-handler.d.ts.map +1 -1
- package/lib/common/operations/operation-handler.js +50 -1
- package/lib/common/operations/operation-handler.js.map +1 -1
- package/lib/common/protocol/glsp-server.d.ts +4 -104
- package/lib/common/protocol/glsp-server.d.ts.map +1 -1
- package/lib/common/protocol/glsp-server.js +13 -20
- package/lib/common/protocol/glsp-server.js.map +1 -1
- package/lib/common/session/client-session-factory.d.ts +1 -2
- package/lib/common/session/client-session-factory.d.ts.map +1 -1
- package/lib/common/session/client-session-factory.js +17 -2
- package/lib/common/session/client-session-factory.js.map +1 -1
- package/lib/common/session/client-session-manager.d.ts +1 -3
- package/lib/common/session/client-session-manager.d.ts.map +1 -1
- package/lib/common/session/client-session-manager.js.map +1 -1
- package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
- package/lib/common/utils/console-logger.d.ts.map +1 -0
- package/lib/{browser/di → common/utils}/console-logger.js +26 -8
- package/lib/common/utils/console-logger.js.map +1 -0
- package/lib/common/utils/layout-util.d.ts +1 -1
- package/lib/common/utils/layout-util.d.ts.map +1 -1
- package/lib/common/utils/layout-util.js +3 -3
- package/lib/common/utils/layout-util.js.map +1 -1
- package/lib/common/utils/logger.d.ts +21 -0
- package/lib/common/utils/logger.d.ts.map +1 -1
- package/lib/common/utils/logger.js +12 -1
- package/lib/common/utils/logger.js.map +1 -1
- package/lib/node/di/app-module.d.ts +2 -2
- package/lib/node/di/app-module.d.ts.map +1 -1
- package/lib/node/di/app-module.js +10 -35
- package/lib/node/di/app-module.js.map +1 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/launch/cli-parser.d.ts +2 -3
- package/lib/node/launch/cli-parser.d.ts.map +1 -1
- package/lib/node/launch/cli-parser.js.map +1 -1
- package/lib/node/launch/socket-cli-parser.js +1 -1
- package/lib/node/launch/socket-cli-parser.js.map +1 -1
- package/lib/node/launch/socket-server-launcher.d.ts +4 -24
- package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
- package/lib/node/launch/socket-server-launcher.js +15 -34
- package/lib/node/launch/socket-server-launcher.js.map +1 -1
- package/lib/node/launch/websocket-server-launcher.d.ts +53 -0
- package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -0
- package/lib/node/launch/websocket-server-launcher.js +121 -0
- package/lib/node/launch/websocket-server-launcher.js.map +1 -0
- package/package.json +8 -5
- package/src/browser/di/app-module.ts +4 -32
- package/src/browser/index.ts +0 -1
- package/src/browser/launch/worker-server-launcher.ts +20 -22
- package/src/common/actions/client-action-handler.ts +1 -2
- package/src/common/command/command-stack.spec.ts +239 -0
- package/src/common/command/command-stack.ts +106 -20
- package/src/common/command/command.spec.ts +92 -0
- package/src/common/command/command.ts +96 -7
- package/src/common/command/recording-command.spec.ts +74 -0
- package/src/common/command/recording-command.ts +119 -0
- package/src/common/command/undo-redo-action-handler.ts +57 -0
- package/src/common/di/client-session-module.ts +1 -1
- package/src/common/di/diagram-module.ts +13 -0
- package/src/common/di/glsp-module.ts +3 -1
- package/src/common/di/multi-binding.ts +4 -5
- package/src/common/di/server-module.ts +6 -21
- package/src/common/features/contextactions/tool-palette-item-provider.ts +2 -4
- package/src/common/{gmodel → features/layout}/computed-bounds-action-handler.ts +10 -5
- package/src/common/features/layout/layout-operation-handler.ts +26 -11
- package/src/common/features/model/model-state.ts +0 -3
- package/src/common/features/model/model-submission-handler.ts +6 -2
- package/src/common/features/model/save-model-action-handler.ts +5 -6
- package/src/common/gmodel/apply-label-edit-operation-handler.ts +13 -15
- package/src/common/gmodel/change-bounds-operation-handler.ts +12 -8
- package/src/common/gmodel/change-routing-points-operation-handler.ts +8 -7
- package/src/common/{operations → gmodel}/cut-operation-handler.ts +9 -8
- package/src/common/gmodel/delete-operation-handler.ts +16 -10
- package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +16 -10
- package/src/common/gmodel/gmodel-create-node-operation-handler.ts +54 -6
- package/src/common/gmodel/gmodel-diagram-module.ts +22 -27
- package/src/common/gmodel/gmodel-operation-handler.ts +31 -0
- package/src/common/gmodel/index.ts +2 -1
- package/src/common/gmodel/paste-operation-handler.ts +19 -11
- package/src/common/gmodel/reconnect-edge-operation-handler.ts +8 -7
- package/src/common/index.ts +5 -3
- package/src/common/launch/glsp-server-launcher.ts +15 -9
- package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
- package/src/common/operations/compound-operation-handler.ts +14 -12
- package/src/common/operations/create-operation-handler.ts +17 -74
- package/src/common/operations/operation-action-handler.ts +51 -27
- package/src/common/operations/operation-handler-registry.ts +18 -3
- package/src/common/operations/operation-handler.ts +38 -13
- package/src/common/protocol/glsp-server.spec.ts +7 -4
- package/src/common/protocol/glsp-server.ts +17 -132
- package/src/common/session/client-session-factory.spec.ts +1 -1
- package/src/common/session/client-session-factory.ts +1 -2
- package/src/common/session/client-session-manager.ts +1 -3
- package/src/common/test/mock-util.ts +47 -41
- package/src/{browser/di → common/utils}/console-logger.ts +19 -1
- package/src/common/utils/layout-util.ts +1 -1
- package/src/common/utils/logger.ts +16 -1
- package/src/node/di/app-module.ts +4 -13
- package/src/node/index.ts +1 -0
- package/src/node/launch/cli-parser.ts +2 -3
- package/src/node/launch/socket-cli-parser.ts +1 -1
- package/src/node/launch/socket-server-launcher.spec.ts +6 -0
- package/src/node/launch/socket-server-launcher.ts +19 -35
- package/src/node/launch/websocket-server-launcher.ts +138 -0
- package/lib/browser/di/console-logger.d.ts.map +0 -1
- package/lib/browser/di/console-logger.js.map +0 -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/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/gmodel/apply-label-edit-operation-handler.spec.d.ts +0 -2
- package/lib/common/gmodel/apply-label-edit-operation-handler.spec.d.ts.map +0 -1
- package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js +0 -38
- package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js.map +0 -1
- package/lib/common/gmodel/computed-bounds-action-handler.d.ts.map +0 -1
- package/lib/common/gmodel/computed-bounds-action-handler.js.map +0 -1
- package/lib/common/operations/cut-operation-handler.d.ts.map +0 -1
- package/lib/common/operations/cut-operation-handler.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-client-proxy.d.ts +0 -45
- package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
- package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
- package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
- package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
- package/lib/common/protocol/glsp-server-listener.js +0 -5
- package/lib/common/protocol/glsp-server-listener.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 -119
- 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 -110
- package/lib/common/test/mock-util.d.ts.map +0 -1
- package/lib/common/test/mock-util.js +0 -211
- 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.map +0 -1
- package/lib/node/launch/socket-server-launcher.spec.js +0 -70
- package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
- package/src/common/gmodel/apply-label-edit-operation-handler.spec.ts +0 -40
- package/src/common/protocol/glsp-client-proxy.ts +0 -65
- package/src/common/protocol/glsp-server-listener.ts +0 -39
|
@@ -13,20 +13,19 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { MaybePromise } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { Disposable, DisposableCollection, MaybePromise } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { Container, ContainerModule, inject, injectable, optional } from 'inversify';
|
|
18
18
|
import { ServerModule } from '../di/server-module';
|
|
19
19
|
import { InjectionContainer } from '../di/service-identifiers';
|
|
20
20
|
import { Logger } from '../utils/logger';
|
|
21
21
|
|
|
22
|
-
export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed';
|
|
23
|
-
|
|
24
22
|
@injectable()
|
|
25
|
-
export abstract class GLSPServerLauncher<T
|
|
23
|
+
export abstract class GLSPServerLauncher<T> implements Disposable {
|
|
26
24
|
@inject(Logger) protected logger: Logger;
|
|
27
25
|
|
|
28
26
|
protected _modules: ContainerModule[] = [];
|
|
29
27
|
protected running: boolean;
|
|
28
|
+
protected toDispose = new DisposableCollection();
|
|
30
29
|
|
|
31
30
|
@inject(InjectionContainer) @optional() protected parentContainer?: Container;
|
|
32
31
|
|
|
@@ -34,13 +33,13 @@ export abstract class GLSPServerLauncher<T = undefined> {
|
|
|
34
33
|
this._modules.push(serverModule, ...additionalModules);
|
|
35
34
|
}
|
|
36
35
|
|
|
37
|
-
createContainer(): Container {
|
|
36
|
+
createContainer(...additionalModules: ContainerModule[]): Container {
|
|
38
37
|
const container = this.parentContainer ? this.parentContainer.createChild() : new Container();
|
|
39
|
-
container.load(...this._modules);
|
|
38
|
+
container.load(...this._modules, ...additionalModules);
|
|
40
39
|
return container;
|
|
41
40
|
}
|
|
42
41
|
|
|
43
|
-
start(startParams
|
|
42
|
+
start(startParams: T): MaybePromise<void> {
|
|
44
43
|
if (!this.running) {
|
|
45
44
|
this.running = true;
|
|
46
45
|
return this.run(startParams);
|
|
@@ -48,10 +47,11 @@ export abstract class GLSPServerLauncher<T = undefined> {
|
|
|
48
47
|
this.logger.warn('Could not start launcher. Launcher is already running!');
|
|
49
48
|
}
|
|
50
49
|
|
|
51
|
-
protected abstract run(startParams
|
|
50
|
+
protected abstract run(startParams: T): MaybePromise<void>;
|
|
52
51
|
|
|
53
52
|
shutdown(): MaybePromise<void> {
|
|
54
53
|
if (this.running) {
|
|
54
|
+
this.logger.info('Shutdown GLSPServerLauncher');
|
|
55
55
|
const result = this.stop();
|
|
56
56
|
this.running = false;
|
|
57
57
|
return result;
|
|
@@ -59,7 +59,13 @@ export abstract class GLSPServerLauncher<T = undefined> {
|
|
|
59
59
|
this.logger.warn('Could not stop launcher. Launcher is not running!');
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
protected
|
|
62
|
+
protected stop(): MaybePromise<void> {
|
|
63
|
+
this.dispose();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
dispose(): void {
|
|
67
|
+
this.toDispose.dispose();
|
|
68
|
+
}
|
|
63
69
|
|
|
64
70
|
get modules(): ContainerModule[] {
|
|
65
71
|
if (!this._modules) {
|
|
@@ -0,0 +1,95 @@
|
|
|
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
|
+
|
|
17
|
+
import {
|
|
18
|
+
Disposable,
|
|
19
|
+
GLSPClientProxy,
|
|
20
|
+
GLSPServer,
|
|
21
|
+
JsonrpcClientProxy,
|
|
22
|
+
JsonrpcGLSPClient,
|
|
23
|
+
configureClientConnection
|
|
24
|
+
} from '@eclipse-glsp/protocol';
|
|
25
|
+
import { Container, ContainerModule, inject, injectable } from 'inversify';
|
|
26
|
+
import * as jsonrpc from 'vscode-jsonrpc';
|
|
27
|
+
import { Logger } from '../utils/logger';
|
|
28
|
+
import { GLSPServerLauncher } from './glsp-server-launcher';
|
|
29
|
+
|
|
30
|
+
export const START_UP_COMPLETE_MSG = '[GLSP-Server]:Startup completed. Accepting requests on port:';
|
|
31
|
+
|
|
32
|
+
export interface JsonRpcServerInstance {
|
|
33
|
+
server: GLSPServer;
|
|
34
|
+
clientConnection: jsonrpc.MessageConnection;
|
|
35
|
+
container: Container;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
@injectable()
|
|
39
|
+
export abstract class JsonRpcGLSPServerLauncher<T> extends GLSPServerLauncher<T> {
|
|
40
|
+
@inject(Logger)
|
|
41
|
+
protected override logger: Logger;
|
|
42
|
+
|
|
43
|
+
protected serverInstances = new Map<jsonrpc.MessageConnection, JsonRpcServerInstance>();
|
|
44
|
+
protected startupCompleteMessage = START_UP_COMPLETE_MSG;
|
|
45
|
+
|
|
46
|
+
constructor() {
|
|
47
|
+
super();
|
|
48
|
+
this.toDispose.push(
|
|
49
|
+
Disposable.create(() => {
|
|
50
|
+
this.serverInstances.forEach(instance => this.disposeServerInstance(instance));
|
|
51
|
+
})
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
protected disposeServerInstance(instance: JsonRpcServerInstance): void {
|
|
56
|
+
this.serverInstances.delete(instance.clientConnection);
|
|
57
|
+
instance.server.shutdown();
|
|
58
|
+
instance.container.unbindAll();
|
|
59
|
+
instance.clientConnection.dispose();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
protected createServerInstance(clientConnection: jsonrpc.MessageConnection): void {
|
|
63
|
+
const container = this.createContainer(this.createJsonRpcModule(clientConnection));
|
|
64
|
+
const server = container.get<GLSPServer>(GLSPServer);
|
|
65
|
+
const instance = { container, clientConnection, server };
|
|
66
|
+
this.serverInstances.set(clientConnection, instance);
|
|
67
|
+
this.configureClientConnection(instance);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
protected createJsonRpcModule(clientConnection: jsonrpc.MessageConnection): ContainerModule {
|
|
71
|
+
return new ContainerModule(bind => {
|
|
72
|
+
bind(GLSPClientProxy).toDynamicValue(ctx => {
|
|
73
|
+
const proxy = ctx.container.resolve(JsonrpcClientProxy);
|
|
74
|
+
proxy.initialize(clientConnection);
|
|
75
|
+
return proxy;
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
protected configureClientConnection(serverInstance: JsonRpcServerInstance): void {
|
|
81
|
+
configureClientConnection(serverInstance.clientConnection, serverInstance.server);
|
|
82
|
+
|
|
83
|
+
serverInstance.clientConnection.onNotification(JsonrpcGLSPClient.ShutdownNotification, () =>
|
|
84
|
+
this.disposeServerInstance(serverInstance)
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
this.logger.info('Starting GLSP server connection');
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
protected createClientProxy(serverInstance: JsonRpcServerInstance): GLSPClientProxy {
|
|
91
|
+
const proxy = serverInstance.container.resolve(JsonrpcClientProxy);
|
|
92
|
+
proxy.initialize(serverInstance.clientConnection);
|
|
93
|
+
return proxy;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
@@ -13,26 +13,28 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { CompoundOperation
|
|
16
|
+
import { CompoundOperation } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
|
-
import {
|
|
18
|
+
import { Command, CompoundCommand } from '../command/command';
|
|
19
19
|
import { OperationHandler } from './operation-handler';
|
|
20
20
|
import { OperationHandlerRegistry } from './operation-handler-registry';
|
|
21
21
|
|
|
22
22
|
@injectable()
|
|
23
|
-
export class CompoundOperationHandler
|
|
24
|
-
|
|
23
|
+
export class CompoundOperationHandler extends OperationHandler {
|
|
24
|
+
@inject(OperationHandlerRegistry)
|
|
25
|
+
protected operationHandlerRegistry: OperationHandlerRegistry;
|
|
25
26
|
|
|
26
|
-
|
|
27
|
+
operationType = CompoundOperation.KIND;
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
operation.operationList.
|
|
30
|
-
|
|
29
|
+
async createCommand(operation: CompoundOperation): Promise<Command | undefined> {
|
|
30
|
+
const maybeCommands = operation.operationList.map(op => this.operationHandlerRegistry.getExecutableCommand(op));
|
|
31
|
+
const commands: Command[] = [];
|
|
31
32
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
33
|
+
for await (const command of maybeCommands) {
|
|
34
|
+
if (command) {
|
|
35
|
+
commands.push(command);
|
|
36
|
+
}
|
|
36
37
|
}
|
|
38
|
+
return new CompoundCommand(commands);
|
|
37
39
|
}
|
|
38
40
|
}
|
|
@@ -13,94 +13,37 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { GModelElement } from '@eclipse-glsp/graph';
|
|
17
16
|
import {
|
|
18
17
|
CreateEdgeOperation,
|
|
19
18
|
CreateNodeOperation,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
Point,
|
|
19
|
+
hasArrayProp,
|
|
20
|
+
hasFunctionProp,
|
|
21
|
+
hasStringProp,
|
|
24
22
|
TriggerEdgeCreationAction,
|
|
25
23
|
TriggerNodeCreationAction
|
|
26
24
|
} from '@eclipse-glsp/protocol';
|
|
27
|
-
import { inject, injectable } from 'inversify';
|
|
28
|
-
import { ModelState } from '../features/model/model-state';
|
|
29
|
-
import { getRelativeLocation } from '../utils/layout-util';
|
|
30
25
|
import { OperationHandler } from './operation-handler';
|
|
31
26
|
|
|
32
27
|
/**
|
|
33
28
|
* A special {@link OperationHandler} that is responsible for the handling of {@link CreateOperation}s. Depending on its
|
|
34
29
|
* operation type the triggered actions are {@link TriggerNodeCreationAction} or {@link TriggerEdgeCreationAction}s.
|
|
35
30
|
*/
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
abstract execute(operation: Operation): MaybePromise<void>;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Returns a list of {@link TriggerElementCreationAction}s for registered element types.
|
|
46
|
-
*
|
|
47
|
-
* @returns A list of {@link TriggerElementCreationAction}s.
|
|
48
|
-
*/
|
|
49
|
-
getTriggerActions(): (TriggerEdgeCreationAction | TriggerNodeCreationAction)[] {
|
|
50
|
-
if (this.operationType === CreateNodeOperation.KIND) {
|
|
51
|
-
return this.elementTypeIds.map(typeId => TriggerNodeCreationAction.create(typeId));
|
|
52
|
-
} else if (this.operationType === CreateEdgeOperation.KIND) {
|
|
53
|
-
return this.elementTypeIds.map(typeId => TriggerEdgeCreationAction.create(typeId));
|
|
54
|
-
}
|
|
55
|
-
return [];
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
handles(operation: CreateOperation): boolean {
|
|
59
|
-
return this.elementTypeIds.includes(operation.elementTypeId);
|
|
60
|
-
}
|
|
31
|
+
export interface CreateOperationHandler extends OperationHandler {
|
|
32
|
+
readonly label: string;
|
|
33
|
+
elementTypeIds: string[];
|
|
34
|
+
operationType: CreateOperationKind;
|
|
35
|
+
getTriggerActions(): (TriggerEdgeCreationAction | TriggerNodeCreationAction)[];
|
|
61
36
|
}
|
|
62
37
|
|
|
63
|
-
|
|
64
|
-
* Abstract base implementation for {@link CreateOperationHandler} that
|
|
65
|
-
* create an element that is represented with a {@link GNode} in the graphical model.
|
|
66
|
-
*/
|
|
67
|
-
@injectable()
|
|
68
|
-
export abstract class CreateNodeOperationHandler extends CreateOperationHandler {
|
|
69
|
-
@inject(ModelState)
|
|
70
|
-
protected modelState: ModelState;
|
|
71
|
-
|
|
72
|
-
get operationType(): string {
|
|
73
|
-
return CreateNodeOperation.KIND;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Retrieve the graphical model element that should contain the newly created {@link GNode}.
|
|
78
|
-
* If `undefined` is returned the {@link GNode} should be added directly to the diagram root.
|
|
79
|
-
* @param operation The currently handled operation.
|
|
80
|
-
* @returns The container {@link GModeElement} or `undefined`.
|
|
81
|
-
*/
|
|
82
|
-
getContainer(operation: CreateNodeOperation): GModelElement | undefined {
|
|
83
|
-
const index = this.modelState.index;
|
|
84
|
-
return operation.containerId ? index.get(operation.containerId) : undefined;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
getLocation(operation: CreateNodeOperation): Point | undefined {
|
|
88
|
-
return operation.location;
|
|
89
|
-
}
|
|
38
|
+
export type CreateOperationKind = typeof CreateNodeOperation.KIND | typeof CreateEdgeOperation.KIND;
|
|
90
39
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
* @returns The relative position or `undefined`.
|
|
100
|
-
*/
|
|
101
|
-
getRelativeLocation(operation: CreateNodeOperation): Point | undefined {
|
|
102
|
-
const container = this.getContainer(operation) ?? this.modelState.root;
|
|
103
|
-
const absoluteLocation = this.getLocation(operation) ?? Point.ORIGIN;
|
|
104
|
-
return getRelativeLocation(absoluteLocation, container);
|
|
40
|
+
export namespace CreateOperationHandler {
|
|
41
|
+
export function is(object: unknown): object is CreateOperationHandler {
|
|
42
|
+
return (
|
|
43
|
+
object instanceof OperationHandler &&
|
|
44
|
+
hasStringProp(object, 'label') &&
|
|
45
|
+
hasArrayProp(object, 'elementTypeIds') &&
|
|
46
|
+
hasFunctionProp(object, 'getTriggerActions')
|
|
47
|
+
);
|
|
105
48
|
}
|
|
106
49
|
}
|
|
@@ -13,57 +13,81 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Action,
|
|
16
|
+
import { Action, MaybePromise, Operation, ServerMessageAction } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable } from 'inversify';
|
|
18
18
|
import { ActionHandler } from '../actions/action-handler';
|
|
19
|
+
import { Command } from '../command/command';
|
|
20
|
+
import { CommandStack } from '../command/command-stack';
|
|
19
21
|
import { Operations } from '../di/service-identifiers';
|
|
20
22
|
import { ModelState } from '../features/model/model-state';
|
|
21
23
|
import { ModelSubmissionHandler } from '../features/model/model-submission-handler';
|
|
24
|
+
import { GLSPServerError } from '../utils/glsp-server-error';
|
|
22
25
|
import { OperationHandler } from './operation-handler';
|
|
23
26
|
import { OperationHandlerRegistry } from './operation-handler-registry';
|
|
24
27
|
|
|
25
28
|
@injectable()
|
|
26
29
|
export class OperationActionHandler implements ActionHandler {
|
|
27
|
-
@inject(OperationHandlerRegistry)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
+
@inject(OperationHandlerRegistry)
|
|
31
|
+
protected operationHandlerRegistry: OperationHandlerRegistry;
|
|
32
|
+
|
|
33
|
+
@inject(ModelSubmissionHandler)
|
|
34
|
+
protected modelSubmissionHandler: ModelSubmissionHandler;
|
|
35
|
+
|
|
36
|
+
@inject(ModelState)
|
|
37
|
+
protected modelState: ModelState;
|
|
38
|
+
|
|
39
|
+
@inject(CommandStack)
|
|
40
|
+
protected commandStack: CommandStack;
|
|
30
41
|
|
|
31
42
|
constructor(@inject(Operations) readonly actionKinds: string[]) {}
|
|
32
43
|
|
|
33
44
|
execute(action: Operation): MaybePromise<Action[]> {
|
|
34
|
-
if (this.handles(action)) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
45
|
+
if (!this.handles(action)) {
|
|
46
|
+
throw new GLSPServerError(`Unhandled operation kind: ${action.kind}`);
|
|
47
|
+
}
|
|
48
|
+
if (this.modelState.isReadonly) {
|
|
49
|
+
return [
|
|
50
|
+
ServerMessageAction.create(`Server is in readonly-mode! Could not execute operation: ${action.kind}`, {
|
|
51
|
+
severity: 'WARNING'
|
|
52
|
+
})
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
return this.executeOperation(action);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
protected executeOperation(operation: Operation): MaybePromise<Action[]> {
|
|
59
|
+
const operationHandler = OperationActionHandler.getOperationHandler(operation, this.operationHandlerRegistry);
|
|
60
|
+
if (operationHandler) {
|
|
61
|
+
return this.executeHandler(operation, operationHandler);
|
|
46
62
|
}
|
|
47
63
|
return [];
|
|
48
64
|
}
|
|
49
65
|
|
|
50
|
-
async executeHandler(operation: Operation, handler: OperationHandler): Promise<Action[]> {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
66
|
+
protected async executeHandler(operation: Operation, handler: OperationHandler): Promise<Action[]> {
|
|
67
|
+
const command = await handler.execute(operation);
|
|
68
|
+
if (command) {
|
|
69
|
+
await this.executeCommand(command);
|
|
70
|
+
}
|
|
71
|
+
return this.modelSubmissionHandler.submitModel('operation');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
protected async executeCommand(command: Command): Promise<void> {
|
|
75
|
+
return this.commandStack.execute(command);
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
protected submitModel(): MaybePromise<Action[]> {
|
|
56
79
|
return this.modelSubmissionHandler.submitModel('operation');
|
|
57
80
|
}
|
|
58
81
|
|
|
59
82
|
handles(action: Action): boolean {
|
|
60
|
-
|
|
61
|
-
return true;
|
|
62
|
-
}
|
|
63
|
-
return false;
|
|
83
|
+
return this.actionKinds.includes(action.kind);
|
|
64
84
|
}
|
|
65
85
|
|
|
86
|
+
/**
|
|
87
|
+
* @Deprecated Use {@link OperationHandlerRegistry#getOperationHandler(Operation) instead}.
|
|
88
|
+
*/
|
|
89
|
+
|
|
66
90
|
static getOperationHandler(operation: Operation, registry: OperationHandlerRegistry): OperationHandler | undefined {
|
|
67
|
-
return
|
|
91
|
+
return registry.getOperationHandler(operation);
|
|
68
92
|
}
|
|
69
93
|
}
|
|
@@ -13,8 +13,9 @@
|
|
|
13
13
|
*
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
|
-
import { Args } from '@eclipse-glsp/protocol';
|
|
16
|
+
import { Args, CreateOperation, MaybePromise, Operation } from '@eclipse-glsp/protocol';
|
|
17
17
|
import { inject, injectable, optional } from 'inversify';
|
|
18
|
+
import { Command } from '../command/command';
|
|
18
19
|
import { ClientSessionInitializer } from '../session/client-session-initializer';
|
|
19
20
|
import { Registry } from '../utils/registry';
|
|
20
21
|
import { CreateOperationHandler } from './create-operation-handler';
|
|
@@ -23,13 +24,27 @@ import { OperationHandler, OperationHandlerConstructor, OperationHandlerFactory
|
|
|
23
24
|
@injectable()
|
|
24
25
|
export class OperationHandlerRegistry extends Registry<string, OperationHandler> {
|
|
25
26
|
registerHandler(handler: OperationHandler): boolean {
|
|
26
|
-
if (handler
|
|
27
|
+
if (CreateOperationHandler.is(handler)) {
|
|
27
28
|
handler.elementTypeIds.forEach(typeId => this.register(`${handler.operationType}_${typeId}`, handler));
|
|
28
29
|
return true;
|
|
29
30
|
} else {
|
|
30
31
|
return this.register(handler.operationType, handler);
|
|
31
32
|
}
|
|
32
33
|
}
|
|
34
|
+
|
|
35
|
+
getOperationHandler(operation: Operation): OperationHandler | undefined {
|
|
36
|
+
return CreateOperation.is(operation) ? this.get(`${operation.kind}_${operation.elementTypeId}`) : this.get(operation.kind);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Returns the matching command for the given operation.
|
|
41
|
+
*
|
|
42
|
+
* @param operation operation
|
|
43
|
+
* @return the matching command for the given operation
|
|
44
|
+
*/
|
|
45
|
+
getExecutableCommand(operation: Operation): MaybePromise<Command | undefined> {
|
|
46
|
+
return this.getOperationHandler(operation)?.createCommand(operation);
|
|
47
|
+
}
|
|
33
48
|
}
|
|
34
49
|
|
|
35
50
|
@injectable()
|
|
@@ -44,7 +59,7 @@ export class OperationHandlerRegistryInitializer implements ClientSessionInitial
|
|
|
44
59
|
@inject(OperationHandlerRegistry)
|
|
45
60
|
protected registry: OperationHandlerRegistry;
|
|
46
61
|
|
|
47
|
-
initialize(
|
|
62
|
+
initialize(_args?: Args): void {
|
|
48
63
|
const handlers = this.handlerConstructors.map(constructor => this.factory(constructor));
|
|
49
64
|
handlers.forEach(handler => this.registry.registerHandler(handler));
|
|
50
65
|
}
|
|
@@ -14,38 +14,63 @@
|
|
|
14
14
|
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
15
|
********************************************************************************/
|
|
16
16
|
import { MaybePromise, Operation } from '@eclipse-glsp/protocol';
|
|
17
|
-
import { interfaces } from 'inversify';
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
import { inject, injectable, interfaces } from 'inversify';
|
|
18
|
+
import { Command } from '../command/command';
|
|
19
|
+
import { ModelState } from '../features/model/model-state';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* An operation handler can execute {@link Operation}s of a certain type (subclass).
|
|
23
23
|
* The operation handler processes the operation in the {@link OperationHandler.execute()} method. The result
|
|
24
|
-
* of the execution is
|
|
25
|
-
* This
|
|
26
|
-
* applied directly on the `ModelState` using EMF `Command`s and the
|
|
27
|
-
* `ModelState.execute()` method. For more complex diagram languages the
|
|
28
|
-
* GModel state might be updated indirectly and the operation handler manipulates a custom model representation.
|
|
24
|
+
* of the execution is a {@link Command} that captures the corresponding source model changes.
|
|
25
|
+
* This command can be applied on the `CommandStack` and is reversible (undo) and can be reapplied (redo).
|
|
29
26
|
*
|
|
30
27
|
* The `OperationActionHandler` is responsible for retrieving all available (valid) operation handlers for an
|
|
31
28
|
* operation that is dispatched via `ActionDispatcher`.
|
|
32
29
|
*/
|
|
33
|
-
|
|
30
|
+
@injectable()
|
|
31
|
+
export abstract class OperationHandler {
|
|
32
|
+
@inject(ModelState)
|
|
33
|
+
protected modelState: ModelState;
|
|
34
|
+
|
|
34
35
|
/**
|
|
35
36
|
* Returns the operation type that can be handled by this operation handler.
|
|
36
37
|
*
|
|
37
38
|
* @returns the operation type that can be handled.
|
|
38
39
|
*/
|
|
39
|
-
|
|
40
|
+
abstract operationType: string;
|
|
40
41
|
|
|
41
42
|
readonly label?: string;
|
|
42
43
|
|
|
43
44
|
/**
|
|
44
|
-
*
|
|
45
|
+
* Creates a command that performs the operation in the source model(s). If `undefined` is returned, no update
|
|
46
|
+
* is performed on the model(s).
|
|
47
|
+
*
|
|
48
|
+
* @param operation The operation to process.
|
|
49
|
+
* @return The created command to be executed on the command stack or `undefined` nothing should be done.
|
|
50
|
+
*/
|
|
51
|
+
abstract createCommand(operation: Operation): MaybePromise<Command | undefined>;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Executes the operation handler for the given {@link Operation} and returns the corresponding {@link Command}.
|
|
55
|
+
* If the given operation cannot be handled by this handler or the handler execution did not result in any changes
|
|
56
|
+
* `undefined` is returned.
|
|
57
|
+
*
|
|
58
|
+
* @param operation The operation that should be executed or empty if nothing should be done.
|
|
59
|
+
* @returns The command capturing the execution changes or `undefined`
|
|
60
|
+
*/
|
|
61
|
+
execute(operation: Operation): MaybePromise<Command | undefined> {
|
|
62
|
+
return this.handles(operation) ? this.createCommand(operation) : undefined;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Validates whether the given {@link Operation} can be handled by this operation handler.
|
|
45
67
|
*
|
|
46
|
-
* @param operation The operation that should be
|
|
68
|
+
* @param operation The operation that should be validated.
|
|
69
|
+
* @returns `true` if the given operation can be handled, `false` otherwise.
|
|
47
70
|
*/
|
|
48
|
-
|
|
71
|
+
handles(operation: Operation): boolean {
|
|
72
|
+
return this.modelState.root && operation.kind === this.operationType;
|
|
73
|
+
}
|
|
49
74
|
}
|
|
50
75
|
|
|
51
76
|
export const OperationHandlerConstructor = Symbol('OperationHandlerConstructor');
|
|
@@ -13,7 +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 {
|
|
16
|
+
import {
|
|
17
|
+
DisposeClientSessionParameters,
|
|
18
|
+
GLSPClientProxy,
|
|
19
|
+
GLSPServerListener,
|
|
20
|
+
InitializeClientSessionParameters,
|
|
21
|
+
InitializeParameters
|
|
22
|
+
} from '@eclipse-glsp/protocol';
|
|
17
23
|
import { expect } from 'chai';
|
|
18
24
|
import { Container, ContainerModule } from 'inversify';
|
|
19
25
|
import * as sinon from 'sinon';
|
|
@@ -21,9 +27,7 @@ import { GlobalActionProvider } from '../actions/global-action-provider';
|
|
|
21
27
|
import { ClientSessionManager } from '../session/client-session-manager';
|
|
22
28
|
import * as mock from '../test/mock-util';
|
|
23
29
|
import { Logger } from '../utils/logger';
|
|
24
|
-
import { GLSPClientProxy, JsonRpcGLSPClientProxy } from './glsp-client-proxy';
|
|
25
30
|
import { DefaultGLSPServer } from './glsp-server';
|
|
26
|
-
import { GLSPServerListener } from './glsp-server-listener';
|
|
27
31
|
import assert = require('assert');
|
|
28
32
|
|
|
29
33
|
describe('test DefaultGLSPServer', () => {
|
|
@@ -48,7 +52,6 @@ describe('test DefaultGLSPServer', () => {
|
|
|
48
52
|
new ContainerModule(bind => {
|
|
49
53
|
bind(Logger).toConstantValue(new mock.StubLogger());
|
|
50
54
|
bind(GLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
|
|
51
|
-
bind(JsonRpcGLSPClientProxy).toConstantValue(new mock.StubGLSPClientProxy());
|
|
52
55
|
bind(ClientSessionManager).toConstantValue(sessionManager);
|
|
53
56
|
bind(GlobalActionProvider).toConstantValue({ clientActionKinds: new Map<string, string[]>(), serverActionKinds });
|
|
54
57
|
bind(GLSPServerListener).toConstantValue(listener1);
|