@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.
Files changed (365) hide show
  1. package/lib/browser/di/app-module.d.ts +2 -7
  2. package/lib/browser/di/app-module.d.ts.map +1 -1
  3. package/lib/browser/di/app-module.js +5 -30
  4. package/lib/browser/di/app-module.js.map +1 -1
  5. package/lib/browser/index.d.ts +0 -1
  6. package/lib/browser/index.d.ts.map +1 -1
  7. package/lib/browser/index.js +0 -1
  8. package/lib/browser/index.js.map +1 -1
  9. package/lib/browser/launch/worker-server-launcher.d.ts +11 -8
  10. package/lib/browser/launch/worker-server-launcher.d.ts.map +1 -1
  11. package/lib/browser/launch/worker-server-launcher.js +13 -21
  12. package/lib/browser/launch/worker-server-launcher.js.map +1 -1
  13. package/lib/common/actions/client-action-handler.d.ts +1 -2
  14. package/lib/common/actions/client-action-handler.d.ts.map +1 -1
  15. package/lib/common/actions/client-action-handler.js +17 -2
  16. package/lib/common/actions/client-action-handler.js.map +1 -1
  17. package/lib/common/command/command-stack.d.ts +60 -14
  18. package/lib/common/command/command-stack.d.ts.map +1 -1
  19. package/lib/common/command/command-stack.js +78 -24
  20. package/lib/common/command/command-stack.js.map +1 -1
  21. package/lib/common/command/command.d.ts +34 -7
  22. package/lib/common/command/command.d.ts.map +1 -1
  23. package/lib/common/command/command.js +73 -0
  24. package/lib/common/command/command.js.map +1 -1
  25. package/lib/common/command/recording-command.d.ts +75 -0
  26. package/lib/common/command/recording-command.d.ts.map +1 -0
  27. package/lib/common/command/recording-command.js +99 -0
  28. package/lib/common/command/recording-command.js.map +1 -0
  29. package/lib/common/command/undo-redo-action-handler.d.ts +28 -0
  30. package/lib/common/command/undo-redo-action-handler.d.ts.map +1 -0
  31. package/lib/common/command/undo-redo-action-handler.js +72 -0
  32. package/lib/common/command/undo-redo-action-handler.js.map +1 -0
  33. package/lib/common/di/client-session-module.d.ts +1 -1
  34. package/lib/common/di/client-session-module.d.ts.map +1 -1
  35. package/lib/common/di/client-session-module.js +2 -2
  36. package/lib/common/di/client-session-module.js.map +1 -1
  37. package/lib/common/di/diagram-module.d.ts +3 -0
  38. package/lib/common/di/diagram-module.d.ts.map +1 -1
  39. package/lib/common/di/diagram-module.js +12 -0
  40. package/lib/common/di/diagram-module.js.map +1 -1
  41. package/lib/common/di/glsp-module.d.ts +3 -1
  42. package/lib/common/di/glsp-module.d.ts.map +1 -1
  43. package/lib/common/di/glsp-module.js +0 -15
  44. package/lib/common/di/glsp-module.js.map +1 -1
  45. package/lib/common/di/multi-binding.d.ts +19 -4
  46. package/lib/common/di/multi-binding.d.ts.map +1 -1
  47. package/lib/common/di/multi-binding.js.map +1 -1
  48. package/lib/common/di/server-module.d.ts +1 -6
  49. package/lib/common/di/server-module.d.ts.map +1 -1
  50. package/lib/common/di/server-module.js +21 -17
  51. package/lib/common/di/server-module.js.map +1 -1
  52. package/lib/common/features/contextactions/tool-palette-item-provider.d.ts +1 -1
  53. package/lib/common/features/contextactions/tool-palette-item-provider.d.ts.map +1 -1
  54. package/lib/common/features/contextactions/tool-palette-item-provider.js +2 -4
  55. package/lib/common/features/contextactions/tool-palette-item-provider.js.map +1 -1
  56. package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.d.ts +8 -3
  57. package/lib/common/features/layout/computed-bounds-action-handler.d.ts.map +1 -0
  58. package/lib/common/{gmodel → features/layout}/computed-bounds-action-handler.js +9 -4
  59. package/lib/common/features/layout/computed-bounds-action-handler.js.map +1 -0
  60. package/lib/common/features/layout/layout-operation-handler.d.ts +12 -3
  61. package/lib/common/features/layout/layout-operation-handler.d.ts.map +1 -1
  62. package/lib/common/features/layout/layout-operation-handler.js +26 -10
  63. package/lib/common/features/layout/layout-operation-handler.js.map +1 -1
  64. package/lib/common/features/model/model-state.d.ts +0 -2
  65. package/lib/common/features/model/model-state.d.ts.map +1 -1
  66. package/lib/common/features/model/model-state.js +0 -1
  67. package/lib/common/features/model/model-state.js.map +1 -1
  68. package/lib/common/features/model/model-submission-handler.d.ts +2 -0
  69. package/lib/common/features/model/model-submission-handler.d.ts.map +1 -1
  70. package/lib/common/features/model/model-submission-handler.js +7 -2
  71. package/lib/common/features/model/model-submission-handler.js.map +1 -1
  72. package/lib/common/features/model/save-model-action-handler.d.ts +2 -2
  73. package/lib/common/features/model/save-model-action-handler.d.ts.map +1 -1
  74. package/lib/common/features/model/save-model-action-handler.js +5 -5
  75. package/lib/common/features/model/save-model-action-handler.js.map +1 -1
  76. package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts +4 -5
  77. package/lib/common/gmodel/apply-label-edit-operation-handler.d.ts.map +1 -1
  78. package/lib/common/gmodel/apply-label-edit-operation-handler.js +12 -21
  79. package/lib/common/gmodel/apply-label-edit-operation-handler.js.map +1 -1
  80. package/lib/common/gmodel/change-bounds-operation-handler.d.ts +9 -6
  81. package/lib/common/gmodel/change-bounds-operation-handler.d.ts.map +1 -1
  82. package/lib/common/gmodel/change-bounds-operation-handler.js +14 -14
  83. package/lib/common/gmodel/change-bounds-operation-handler.js.map +1 -1
  84. package/lib/common/gmodel/change-routing-points-operation-handler.d.ts +5 -5
  85. package/lib/common/gmodel/change-routing-points-operation-handler.d.ts.map +1 -1
  86. package/lib/common/gmodel/change-routing-points-operation-handler.js +11 -14
  87. package/lib/common/gmodel/change-routing-points-operation-handler.js.map +1 -1
  88. package/lib/common/{operations → gmodel}/cut-operation-handler.d.ts +5 -4
  89. package/lib/common/gmodel/cut-operation-handler.d.ts.map +1 -0
  90. package/lib/common/{operations → gmodel}/cut-operation-handler.js +13 -11
  91. package/lib/common/gmodel/cut-operation-handler.js.map +1 -0
  92. package/lib/common/gmodel/delete-operation-handler.d.ts +6 -6
  93. package/lib/common/gmodel/delete-operation-handler.d.ts.map +1 -1
  94. package/lib/common/gmodel/delete-operation-handler.js +13 -10
  95. package/lib/common/gmodel/delete-operation-handler.js.map +1 -1
  96. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts +11 -7
  97. package/lib/common/gmodel/gmodel-create-edge-operation-handler.d.ts.map +1 -1
  98. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js +12 -13
  99. package/lib/common/gmodel/gmodel-create-edge-operation-handler.js.map +1 -1
  100. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts +32 -5
  101. package/lib/common/gmodel/gmodel-create-node-operation-handler.d.ts.map +1 -1
  102. package/lib/common/gmodel/gmodel-create-node-operation-handler.js +45 -3
  103. package/lib/common/gmodel/gmodel-create-node-operation-handler.js.map +1 -1
  104. package/lib/common/gmodel/gmodel-diagram-module.d.ts +8 -8
  105. package/lib/common/gmodel/gmodel-diagram-module.d.ts.map +1 -1
  106. package/lib/common/gmodel/gmodel-diagram-module.js +15 -21
  107. package/lib/common/gmodel/gmodel-diagram-module.js.map +1 -1
  108. package/lib/{node/launch/socket-server-launcher.spec.d.ts → common/gmodel/gmodel-operation-handler.d.ts} +9 -3
  109. package/lib/common/gmodel/gmodel-operation-handler.d.ts.map +1 -0
  110. package/lib/common/{protocol/glsp-client-proxy.js → gmodel/gmodel-operation-handler.js} +25 -35
  111. package/lib/common/gmodel/gmodel-operation-handler.js.map +1 -0
  112. package/lib/common/gmodel/index.d.ts +2 -1
  113. package/lib/common/gmodel/index.d.ts.map +1 -1
  114. package/lib/common/gmodel/index.js +2 -1
  115. package/lib/common/gmodel/index.js.map +1 -1
  116. package/lib/common/gmodel/paste-operation-handler.d.ts +7 -6
  117. package/lib/common/gmodel/paste-operation-handler.d.ts.map +1 -1
  118. package/lib/common/gmodel/paste-operation-handler.js +20 -15
  119. package/lib/common/gmodel/paste-operation-handler.js.map +1 -1
  120. package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts +5 -5
  121. package/lib/common/gmodel/reconnect-edge-operation-handler.d.ts.map +1 -1
  122. package/lib/common/gmodel/reconnect-edge-operation-handler.js +11 -14
  123. package/lib/common/gmodel/reconnect-edge-operation-handler.js.map +1 -1
  124. package/lib/common/index.d.ts +5 -3
  125. package/lib/common/index.d.ts.map +1 -1
  126. package/lib/common/index.js +5 -3
  127. package/lib/common/index.js.map +1 -1
  128. package/lib/common/launch/glsp-server-launcher.d.ts +8 -7
  129. package/lib/common/launch/glsp-server-launcher.d.ts.map +1 -1
  130. package/lib/common/launch/glsp-server-launcher.js +27 -4
  131. package/lib/common/launch/glsp-server-launcher.js.map +1 -1
  132. package/lib/common/launch/jsonrpc-server-launcher.d.ts +38 -0
  133. package/lib/common/launch/jsonrpc-server-launcher.d.ts.map +1 -0
  134. package/lib/common/launch/jsonrpc-server-launcher.js +84 -0
  135. package/lib/common/launch/jsonrpc-server-launcher.js.map +1 -0
  136. package/lib/common/operations/compound-operation-handler.d.ts +5 -5
  137. package/lib/common/operations/compound-operation-handler.d.ts.map +1 -1
  138. package/lib/common/operations/compound-operation-handler.js +37 -9
  139. package/lib/common/operations/compound-operation-handler.js.map +1 -1
  140. package/lib/common/operations/create-operation-handler.d.ts +8 -40
  141. package/lib/common/operations/create-operation-handler.d.ts.map +1 -1
  142. package/lib/common/operations/create-operation-handler.js +26 -85
  143. package/lib/common/operations/create-operation-handler.js.map +1 -1
  144. package/lib/common/operations/operation-action-handler.d.ts +10 -1
  145. package/lib/common/operations/operation-action-handler.d.ts.map +1 -1
  146. package/lib/common/operations/operation-action-handler.js +37 -22
  147. package/lib/common/operations/operation-action-handler.js.map +1 -1
  148. package/lib/common/operations/operation-handler-registry.d.ts +11 -2
  149. package/lib/common/operations/operation-handler-registry.d.ts.map +1 -1
  150. package/lib/common/operations/operation-handler-registry.js +31 -2
  151. package/lib/common/operations/operation-handler-registry.js.map +1 -1
  152. package/lib/common/operations/operation-handler.d.ts +28 -11
  153. package/lib/common/operations/operation-handler.d.ts.map +1 -1
  154. package/lib/common/operations/operation-handler.js +50 -1
  155. package/lib/common/operations/operation-handler.js.map +1 -1
  156. package/lib/common/protocol/glsp-server.d.ts +4 -104
  157. package/lib/common/protocol/glsp-server.d.ts.map +1 -1
  158. package/lib/common/protocol/glsp-server.js +13 -20
  159. package/lib/common/protocol/glsp-server.js.map +1 -1
  160. package/lib/common/session/client-session-factory.d.ts +1 -2
  161. package/lib/common/session/client-session-factory.d.ts.map +1 -1
  162. package/lib/common/session/client-session-factory.js +17 -2
  163. package/lib/common/session/client-session-factory.js.map +1 -1
  164. package/lib/common/session/client-session-manager.d.ts +1 -3
  165. package/lib/common/session/client-session-manager.d.ts.map +1 -1
  166. package/lib/common/session/client-session-manager.js.map +1 -1
  167. package/lib/{browser/di → common/utils}/console-logger.d.ts +7 -1
  168. package/lib/common/utils/console-logger.d.ts.map +1 -0
  169. package/lib/{browser/di → common/utils}/console-logger.js +26 -8
  170. package/lib/common/utils/console-logger.js.map +1 -0
  171. package/lib/common/utils/layout-util.d.ts +1 -1
  172. package/lib/common/utils/layout-util.d.ts.map +1 -1
  173. package/lib/common/utils/layout-util.js +3 -3
  174. package/lib/common/utils/layout-util.js.map +1 -1
  175. package/lib/common/utils/logger.d.ts +21 -0
  176. package/lib/common/utils/logger.d.ts.map +1 -1
  177. package/lib/common/utils/logger.js +12 -1
  178. package/lib/common/utils/logger.js.map +1 -1
  179. package/lib/node/di/app-module.d.ts +2 -2
  180. package/lib/node/di/app-module.d.ts.map +1 -1
  181. package/lib/node/di/app-module.js +10 -35
  182. package/lib/node/di/app-module.js.map +1 -1
  183. package/lib/node/index.d.ts +1 -0
  184. package/lib/node/index.d.ts.map +1 -1
  185. package/lib/node/index.js +1 -0
  186. package/lib/node/index.js.map +1 -1
  187. package/lib/node/launch/cli-parser.d.ts +2 -3
  188. package/lib/node/launch/cli-parser.d.ts.map +1 -1
  189. package/lib/node/launch/cli-parser.js.map +1 -1
  190. package/lib/node/launch/socket-cli-parser.js +1 -1
  191. package/lib/node/launch/socket-cli-parser.js.map +1 -1
  192. package/lib/node/launch/socket-server-launcher.d.ts +4 -24
  193. package/lib/node/launch/socket-server-launcher.d.ts.map +1 -1
  194. package/lib/node/launch/socket-server-launcher.js +15 -34
  195. package/lib/node/launch/socket-server-launcher.js.map +1 -1
  196. package/lib/node/launch/websocket-server-launcher.d.ts +53 -0
  197. package/lib/node/launch/websocket-server-launcher.d.ts.map +1 -0
  198. package/lib/node/launch/websocket-server-launcher.js +121 -0
  199. package/lib/node/launch/websocket-server-launcher.js.map +1 -0
  200. package/package.json +8 -5
  201. package/src/browser/di/app-module.ts +4 -32
  202. package/src/browser/index.ts +0 -1
  203. package/src/browser/launch/worker-server-launcher.ts +20 -22
  204. package/src/common/actions/client-action-handler.ts +1 -2
  205. package/src/common/command/command-stack.spec.ts +239 -0
  206. package/src/common/command/command-stack.ts +106 -20
  207. package/src/common/command/command.spec.ts +92 -0
  208. package/src/common/command/command.ts +96 -7
  209. package/src/common/command/recording-command.spec.ts +74 -0
  210. package/src/common/command/recording-command.ts +119 -0
  211. package/src/common/command/undo-redo-action-handler.ts +57 -0
  212. package/src/common/di/client-session-module.ts +1 -1
  213. package/src/common/di/diagram-module.ts +13 -0
  214. package/src/common/di/glsp-module.ts +3 -1
  215. package/src/common/di/multi-binding.ts +4 -5
  216. package/src/common/di/server-module.ts +6 -21
  217. package/src/common/features/contextactions/tool-palette-item-provider.ts +2 -4
  218. package/src/common/{gmodel → features/layout}/computed-bounds-action-handler.ts +10 -5
  219. package/src/common/features/layout/layout-operation-handler.ts +26 -11
  220. package/src/common/features/model/model-state.ts +0 -3
  221. package/src/common/features/model/model-submission-handler.ts +6 -2
  222. package/src/common/features/model/save-model-action-handler.ts +5 -6
  223. package/src/common/gmodel/apply-label-edit-operation-handler.ts +13 -15
  224. package/src/common/gmodel/change-bounds-operation-handler.ts +12 -8
  225. package/src/common/gmodel/change-routing-points-operation-handler.ts +8 -7
  226. package/src/common/{operations → gmodel}/cut-operation-handler.ts +9 -8
  227. package/src/common/gmodel/delete-operation-handler.ts +16 -10
  228. package/src/common/gmodel/gmodel-create-edge-operation-handler.ts +16 -10
  229. package/src/common/gmodel/gmodel-create-node-operation-handler.ts +54 -6
  230. package/src/common/gmodel/gmodel-diagram-module.ts +22 -27
  231. package/src/common/gmodel/gmodel-operation-handler.ts +31 -0
  232. package/src/common/gmodel/index.ts +2 -1
  233. package/src/common/gmodel/paste-operation-handler.ts +19 -11
  234. package/src/common/gmodel/reconnect-edge-operation-handler.ts +8 -7
  235. package/src/common/index.ts +5 -3
  236. package/src/common/launch/glsp-server-launcher.ts +15 -9
  237. package/src/common/launch/jsonrpc-server-launcher.ts +95 -0
  238. package/src/common/operations/compound-operation-handler.ts +14 -12
  239. package/src/common/operations/create-operation-handler.ts +17 -74
  240. package/src/common/operations/operation-action-handler.ts +51 -27
  241. package/src/common/operations/operation-handler-registry.ts +18 -3
  242. package/src/common/operations/operation-handler.ts +38 -13
  243. package/src/common/protocol/glsp-server.spec.ts +7 -4
  244. package/src/common/protocol/glsp-server.ts +17 -132
  245. package/src/common/session/client-session-factory.spec.ts +1 -1
  246. package/src/common/session/client-session-factory.ts +1 -2
  247. package/src/common/session/client-session-manager.ts +1 -3
  248. package/src/common/test/mock-util.ts +47 -41
  249. package/src/{browser/di → common/utils}/console-logger.ts +19 -1
  250. package/src/common/utils/layout-util.ts +1 -1
  251. package/src/common/utils/logger.ts +16 -1
  252. package/src/node/di/app-module.ts +4 -13
  253. package/src/node/index.ts +1 -0
  254. package/src/node/launch/cli-parser.ts +2 -3
  255. package/src/node/launch/socket-cli-parser.ts +1 -1
  256. package/src/node/launch/socket-server-launcher.spec.ts +6 -0
  257. package/src/node/launch/socket-server-launcher.ts +19 -35
  258. package/src/node/launch/websocket-server-launcher.ts +138 -0
  259. package/lib/browser/di/console-logger.d.ts.map +0 -1
  260. package/lib/browser/di/console-logger.js.map +0 -1
  261. package/lib/common/actions/action-dispatcher.spec.d.ts +0 -2
  262. package/lib/common/actions/action-dispatcher.spec.d.ts.map +0 -1
  263. package/lib/common/actions/action-dispatcher.spec.js +0 -264
  264. package/lib/common/actions/action-dispatcher.spec.js.map +0 -1
  265. package/lib/common/actions/action-handler-registry.spec.d.ts +0 -2
  266. package/lib/common/actions/action-handler-registry.spec.d.ts.map +0 -1
  267. package/lib/common/actions/action-handler-registry.spec.js +0 -50
  268. package/lib/common/actions/action-handler-registry.spec.js.map +0 -1
  269. package/lib/common/actions/global-action-provider.spec.d.ts +0 -2
  270. package/lib/common/actions/global-action-provider.spec.d.ts.map +0 -1
  271. package/lib/common/actions/global-action-provider.spec.js +0 -70
  272. package/lib/common/actions/global-action-provider.spec.js.map +0 -1
  273. package/lib/common/di/binding-target.spec.d.ts +0 -2
  274. package/lib/common/di/binding-target.spec.d.ts.map +0 -1
  275. package/lib/common/di/binding-target.spec.js +0 -121
  276. package/lib/common/di/binding-target.spec.js.map +0 -1
  277. package/lib/common/di/multi-bindings.spec.d.ts +0 -2
  278. package/lib/common/di/multi-bindings.spec.d.ts.map +0 -1
  279. package/lib/common/di/multi-bindings.spec.js +0 -137
  280. package/lib/common/di/multi-bindings.spec.js.map +0 -1
  281. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts +0 -2
  282. package/lib/common/diagram/request-type-hints-action-handler.spec.d.ts.map +0 -1
  283. package/lib/common/diagram/request-type-hints-action-handler.spec.js +0 -57
  284. package/lib/common/diagram/request-type-hints-action-handler.spec.js.map +0 -1
  285. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts +0 -2
  286. package/lib/common/features/contextactions/context-actions-provider-registry.spec.d.ts.map +0 -1
  287. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js +0 -34
  288. package/lib/common/features/contextactions/context-actions-provider-registry.spec.js.map +0 -1
  289. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts +0 -2
  290. package/lib/common/features/contextactions/request-context-actions-handler.spec.d.ts.map +0 -1
  291. package/lib/common/features/contextactions/request-context-actions-handler.spec.js +0 -63
  292. package/lib/common/features/contextactions/request-context-actions-handler.spec.js.map +0 -1
  293. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts +0 -2
  294. package/lib/common/features/contextactions/tool-palette-item-provider.spec.d.ts.map +0 -1
  295. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js +0 -48
  296. package/lib/common/features/contextactions/tool-palette-item-provider.spec.js.map +0 -1
  297. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts +0 -2
  298. package/lib/common/features/directediting/context-edit-validator-registry.spec.d.ts.map +0 -1
  299. package/lib/common/features/directediting/context-edit-validator-registry.spec.js +0 -44
  300. package/lib/common/features/directediting/context-edit-validator-registry.spec.js.map +0 -1
  301. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts +0 -2
  302. package/lib/common/features/directediting/request-edit-validation-handler.spec.d.ts.map +0 -1
  303. package/lib/common/features/directediting/request-edit-validation-handler.spec.js +0 -97
  304. package/lib/common/features/directediting/request-edit-validation-handler.spec.js.map +0 -1
  305. package/lib/common/features/model/gmodel-serializer.spec.d.ts +0 -2
  306. package/lib/common/features/model/gmodel-serializer.spec.d.ts.map +0 -1
  307. package/lib/common/features/model/gmodel-serializer.spec.js +0 -124
  308. package/lib/common/features/model/gmodel-serializer.spec.js.map +0 -1
  309. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.d.ts +0 -2
  310. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.d.ts.map +0 -1
  311. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js +0 -38
  312. package/lib/common/gmodel/apply-label-edit-operation-handler.spec.js.map +0 -1
  313. package/lib/common/gmodel/computed-bounds-action-handler.d.ts.map +0 -1
  314. package/lib/common/gmodel/computed-bounds-action-handler.js.map +0 -1
  315. package/lib/common/operations/cut-operation-handler.d.ts.map +0 -1
  316. package/lib/common/operations/cut-operation-handler.js.map +0 -1
  317. package/lib/common/operations/operation-handler-registry.spec.d.ts +0 -2
  318. package/lib/common/operations/operation-handler-registry.spec.d.ts.map +0 -1
  319. package/lib/common/operations/operation-handler-registry.spec.js +0 -50
  320. package/lib/common/operations/operation-handler-registry.spec.js.map +0 -1
  321. package/lib/common/protocol/glsp-client-proxy.d.ts +0 -45
  322. package/lib/common/protocol/glsp-client-proxy.d.ts.map +0 -1
  323. package/lib/common/protocol/glsp-client-proxy.js.map +0 -1
  324. package/lib/common/protocol/glsp-server-listener.d.ts +0 -37
  325. package/lib/common/protocol/glsp-server-listener.d.ts.map +0 -1
  326. package/lib/common/protocol/glsp-server-listener.js +0 -5
  327. package/lib/common/protocol/glsp-server-listener.js.map +0 -1
  328. package/lib/common/protocol/glsp-server.spec.d.ts +0 -2
  329. package/lib/common/protocol/glsp-server.spec.d.ts.map +0 -1
  330. package/lib/common/protocol/glsp-server.spec.js +0 -119
  331. package/lib/common/protocol/glsp-server.spec.js.map +0 -1
  332. package/lib/common/session/client-session-factory.spec.d.ts +0 -2
  333. package/lib/common/session/client-session-factory.spec.d.ts.map +0 -1
  334. package/lib/common/session/client-session-factory.spec.js +0 -56
  335. package/lib/common/session/client-session-factory.spec.js.map +0 -1
  336. package/lib/common/session/client-session-manager.spec.d.ts +0 -2
  337. package/lib/common/session/client-session-manager.spec.d.ts.map +0 -1
  338. package/lib/common/session/client-session-manager.spec.js +0 -74
  339. package/lib/common/session/client-session-manager.spec.js.map +0 -1
  340. package/lib/common/test/mock-util.d.ts +0 -110
  341. package/lib/common/test/mock-util.d.ts.map +0 -1
  342. package/lib/common/test/mock-util.js +0 -211
  343. package/lib/common/test/mock-util.js.map +0 -1
  344. package/lib/common/utils/promise-queue.spec.d.ts +0 -2
  345. package/lib/common/utils/promise-queue.spec.d.ts.map +0 -1
  346. package/lib/common/utils/promise-queue.spec.js +0 -117
  347. package/lib/common/utils/promise-queue.spec.js.map +0 -1
  348. package/lib/common/utils/registry.spec.d.ts +0 -2
  349. package/lib/common/utils/registry.spec.d.ts.map +0 -1
  350. package/lib/common/utils/registry.spec.js +0 -199
  351. package/lib/common/utils/registry.spec.js.map +0 -1
  352. package/lib/node/launch/cli-parser.spec.d.ts +0 -2
  353. package/lib/node/launch/cli-parser.spec.d.ts.map +0 -1
  354. package/lib/node/launch/cli-parser.spec.js +0 -56
  355. package/lib/node/launch/cli-parser.spec.js.map +0 -1
  356. package/lib/node/launch/socket-cli-parser.spec.d.ts +0 -2
  357. package/lib/node/launch/socket-cli-parser.spec.d.ts.map +0 -1
  358. package/lib/node/launch/socket-cli-parser.spec.js +0 -66
  359. package/lib/node/launch/socket-cli-parser.spec.js.map +0 -1
  360. package/lib/node/launch/socket-server-launcher.spec.d.ts.map +0 -1
  361. package/lib/node/launch/socket-server-launcher.spec.js +0 -70
  362. package/lib/node/launch/socket-server-launcher.spec.js.map +0 -1
  363. package/src/common/gmodel/apply-label-edit-operation-handler.spec.ts +0 -40
  364. package/src/common/protocol/glsp-client-proxy.ts +0 -65
  365. package/src/common/protocol/glsp-server-listener.ts +0 -39
@@ -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
+
17
+ import { AnyObject } from '@eclipse-glsp/protocol';
18
+ import { expect } from 'chai';
19
+ import { RecordingCommand } from './recording-command';
20
+
21
+ interface TestModel {
22
+ string: string;
23
+ number: number;
24
+ flag: boolean;
25
+ maybe?: AnyObject;
26
+ }
27
+
28
+ let jsonObject: TestModel;
29
+
30
+ describe('RecordingCommand', () => {
31
+ let beforeState: TestModel;
32
+
33
+ beforeEach(() => {
34
+ jsonObject = {
35
+ string: 'foo',
36
+ number: 0,
37
+ flag: true
38
+ };
39
+ beforeState = JSON.parse(JSON.stringify(jsonObject));
40
+ });
41
+
42
+ it('should be undoable after execution', async () => {
43
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
44
+ const command = new RecordingCommand(jsonObject, () => {});
45
+ expect(command.canUndo()).to.be.false;
46
+ await command.execute();
47
+ expect(command.canUndo()).to.be.true;
48
+ });
49
+
50
+ it('should restore the pre execution state when undo is called', async () => {
51
+ const command = new RecordingCommand(jsonObject, () => {
52
+ jsonObject.string = 'bar';
53
+ jsonObject.flag = false;
54
+ jsonObject.maybe = { hello: 'world' };
55
+ });
56
+ await command.execute();
57
+ expect(jsonObject).to.not.be.deep.equals(beforeState);
58
+ await command.undo();
59
+ expect(jsonObject).to.be.deep.equals(beforeState);
60
+ });
61
+
62
+ it('should restore the post execution state when redo is called', async () => {
63
+ const command = new RecordingCommand(jsonObject, () => {
64
+ jsonObject.string = 'bar';
65
+ jsonObject.flag = false;
66
+ jsonObject.maybe = { hello: 'world' };
67
+ });
68
+ await command.execute();
69
+ const afterState = JSON.parse(JSON.stringify(jsonObject));
70
+ jsonObject = JSON.parse(JSON.stringify(afterState));
71
+ await command.redo();
72
+ expect(jsonObject).to.be.deep.equals(afterState);
73
+ });
74
+ });
@@ -0,0 +1,119 @@
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 { GModelRootSchema } from '@eclipse-glsp/graph';
18
+ import { AnyObject, MaybePromise } from '@eclipse-glsp/protocol';
19
+ import * as jsonPatch from 'fast-json-patch';
20
+ import { GModelSerializer } from '../features/model/gmodel-serializer';
21
+ import { ModelState } from '../features/model/model-state';
22
+ import { Command } from './command';
23
+ /**
24
+ * An abstract implementation for {@link Command} that should records changes made to a JSON object during execution.
25
+ * These changes are recorded in the form of json patches.
26
+ */
27
+ export abstract class AbstractRecordingCommand<JsonObject extends AnyObject> implements Command {
28
+ protected undoPatch?: jsonPatch.Operation[];
29
+ protected redoPatch?: jsonPatch.Operation[];
30
+
31
+ async execute(): Promise<void> {
32
+ const beforeState = this.deepClone(await this.getJsonObject());
33
+ await this.doExecute();
34
+ const afterState = await this.getJsonObject();
35
+ this.undoPatch = jsonPatch.compare(afterState, beforeState);
36
+ this.redoPatch = jsonPatch.compare(beforeState, afterState);
37
+ }
38
+
39
+ /**
40
+ * Retrieves the current state of the JSON object. Is called right before and
41
+ * right after {@link AbstractRecordingCommand.doExecute} to derive the undo & redo patches.
42
+ * @returns The current state of the JSON object
43
+ */
44
+ protected abstract getJsonObject(): MaybePromise<JsonObject>;
45
+
46
+ /**
47
+ * The actual execution i.e. series of changes applied to the JSOn object that should be captured.
48
+ */
49
+ protected abstract doExecute(): MaybePromise<void>;
50
+
51
+ protected applyPatch(object: JsonObject, patch: jsonPatch.Operation[]): MaybePromise<void> {
52
+ jsonPatch.applyPatch(object, patch, false, true);
53
+ }
54
+
55
+ /**
56
+ * Captures the original state of the JSON object before executing the command routine.
57
+ * This implementation cannot clone circular structures as it relies on `JSON.stringify`.
58
+ * @param object The object that should be cloned
59
+ * @returns A deep clone of the given object
60
+ */
61
+ protected deepClone(object: JsonObject): JsonObject {
62
+ return jsonPatch.deepClone(object);
63
+ }
64
+
65
+ async undo(): Promise<void> {
66
+ if (this.undoPatch) {
67
+ return this.applyPatch(await this.getJsonObject(), this.undoPatch);
68
+ }
69
+ }
70
+
71
+ async redo(): Promise<void> {
72
+ if (this.redoPatch) {
73
+ return this.applyPatch(await this.getJsonObject(), this.redoPatch);
74
+ }
75
+ }
76
+
77
+ canUndo(): boolean {
78
+ return !!this.undoPatch && !!this.redoPatch;
79
+ }
80
+ }
81
+
82
+ /**
83
+ * Simple base implementation of {@link AbstractRecordingCommand} that records the changes made to the given JSON object during
84
+ * the the given `doExecute` function.
85
+ */
86
+ export class RecordingCommand<JsonObject extends AnyObject = AnyObject> extends AbstractRecordingCommand<JsonObject> {
87
+ constructor(protected jsonObject: JsonObject, protected doExecute: () => MaybePromise<void>) {
88
+ super();
89
+ }
90
+
91
+ protected getJsonObject(): MaybePromise<JsonObject> {
92
+ return this.jsonObject;
93
+ }
94
+ }
95
+
96
+ /**
97
+ * Simple base implementation of {@link AbstractRecordingCommand} that allows recording of changes made
98
+ * to the `GModelRoot` ({@link ModelState.root}) during the given `doExecute` function
99
+ */
100
+ export class GModelRecordingCommand extends AbstractRecordingCommand<GModelRootSchema> {
101
+ constructor(protected modelState: ModelState, protected serializer: GModelSerializer, protected doExecute: () => MaybePromise<void>) {
102
+ super();
103
+ }
104
+
105
+ override async execute(): Promise<void> {
106
+ await super.execute();
107
+ this.modelState.index.indexRoot(this.modelState.root);
108
+ }
109
+
110
+ protected getJsonObject(): MaybePromise<GModelRootSchema> {
111
+ return this.serializer.createSchema(this.modelState.root);
112
+ }
113
+
114
+ protected override applyPatch(rootSchema: GModelRootSchema, patch: jsonPatch.Operation[]): MaybePromise<void> {
115
+ super.applyPatch(rootSchema, patch);
116
+ const newRoot = this.serializer.createRoot(rootSchema);
117
+ this.modelState.updateRoot(newRoot);
118
+ }
119
+ }
@@ -0,0 +1,57 @@
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 { Action, MaybePromise, RedoAction, UndoAction } from '@eclipse-glsp/protocol';
18
+ import { inject, injectable } from 'inversify';
19
+ import { ActionHandler } from '../actions/action-handler';
20
+ import { ModelSubmissionHandler } from '../features/model/model-submission-handler';
21
+ import { CommandStack } from './command-stack';
22
+
23
+ @injectable()
24
+ export class UndoRedoActionHandler implements ActionHandler {
25
+ @inject(CommandStack)
26
+ protected commandStack: CommandStack;
27
+
28
+ @inject(ModelSubmissionHandler)
29
+ protected modelSubmissionHandler: ModelSubmissionHandler;
30
+
31
+ readonly actionKinds = [UndoAction.KIND, RedoAction.KIND];
32
+
33
+ execute(action: Action): MaybePromise<Action[]> {
34
+ if (UndoAction.is(action)) {
35
+ return this.undo();
36
+ } else if (RedoAction.is(action)) {
37
+ return this.redo();
38
+ }
39
+ return [];
40
+ }
41
+
42
+ protected async undo(): Promise<Action[]> {
43
+ if (this.commandStack.canUndo()) {
44
+ await this.commandStack.undo();
45
+ return this.modelSubmissionHandler.submitModel('undo');
46
+ }
47
+ return [];
48
+ }
49
+
50
+ protected async redo(): Promise<Action[]> {
51
+ if (this.commandStack.canRedo()) {
52
+ await this.commandStack.redo();
53
+ return this.modelSubmissionHandler.submitModel('redo');
54
+ }
55
+ return [];
56
+ }
57
+ }
@@ -13,8 +13,8 @@
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
17
  import { ContainerModule } from 'inversify';
17
- import { GLSPClientProxy } from '../protocol/glsp-client-proxy';
18
18
  import { ClientId } from './service-identifiers';
19
19
 
20
20
  export function createClientSessionModule(clientId: string, glspClient: GLSPClientProxy): ContainerModule {
@@ -48,6 +48,8 @@ import { ActionDispatcher, DefaultActionDispatcher } from '../actions/action-dis
48
48
  import { ActionHandlerConstructor, ActionHandlerFactory } from '../actions/action-handler';
49
49
  import { ActionHandlerRegistry, ActionHandlerRegistryInitializer } from '../actions/action-handler-registry';
50
50
  import { ClientActionHandler } from '../actions/client-action-handler';
51
+ import { CommandStack, DefaultCommandStack } from '../command/command-stack';
52
+ import { UndoRedoActionHandler } from '../command/undo-redo-action-handler';
51
53
  import { DiagramConfiguration } from '../diagram/diagram-configuration';
52
54
  import { RequestTypeHintsActionHandler } from '../diagram/request-type-hints-action-handler';
53
55
  import { CommandPaletteActionProvider } from '../features/contextactions/command-palette-action-provider';
@@ -63,7 +65,9 @@ import {
63
65
  } from '../features/directediting/context-edit-validator-registry';
64
66
  import { LabelEditValidator } from '../features/directediting/label-edit-validator';
65
67
  import { RequestEditValidationHandler } from '../features/directediting/request-edit-validation-handler';
68
+ import { ComputedBoundsActionHandler } from '../features/layout/computed-bounds-action-handler';
66
69
  import { LayoutEngine } from '../features/layout/layout-engine';
70
+ import { LayoutOperationHandler } from '../features/layout/layout-operation-handler';
67
71
  import { GModelFactory } from '../features/model/gmodel-factory';
68
72
  import { GModelIndex } from '../features/model/gmodel-index';
69
73
  import { DefaultGModelSerializer, GModelSerializer } from '../features/model/gmodel-serializer';
@@ -137,6 +141,7 @@ import {
137
141
  * - {@link OperationHandlerFactory}
138
142
  * - {@link OperationHandlerRegistry}
139
143
  * - {@link Operations}
144
+ * - {@link CommandStack}
140
145
  * - {@link NavigationTargetResolver} as optional binding
141
146
  * {@link NavigationTargetProvider} as {@link ClassMultiBinding<NavigationTargetProvider>} (empty)
142
147
  * - {@link NavigationTargetProviderRegistry}
@@ -193,6 +198,7 @@ export abstract class DiagramModule extends GLSPModule {
193
198
  applyBindingTarget(context, OperationHandlerRegistry, this.bindOperationHandlerRegistry()).inSingletonScope();
194
199
  applyBindingTarget(context, OperationHandlerFactory, this.bindOperationHandlerFactory());
195
200
  applyBindingTarget(context, Operations, this.bindOperations()).inSingletonScope();
201
+ applyBindingTarget(context, CommandStack, this.bindCommandStack()).inSingletonScope();
196
202
 
197
203
  // Navigation
198
204
  applyOptionalBindingTarget(context, NavigationTargetResolver, this.bindNavigationTargetResolver());
@@ -232,6 +238,8 @@ export abstract class DiagramModule extends GLSPModule {
232
238
  binding.add(RequestNavigationTargetsActionHandler);
233
239
  binding.add(ResolveNavigationTargetsActionHandler);
234
240
  binding.add(SaveModelActionHandler);
241
+ binding.add(UndoRedoActionHandler);
242
+ binding.add(ComputedBoundsActionHandler);
235
243
  }
236
244
 
237
245
  protected bindDiagramType(): BindingTarget<string> {
@@ -291,8 +299,13 @@ export abstract class DiagramModule extends GLSPModule {
291
299
  };
292
300
  }
293
301
 
302
+ protected bindCommandStack(): BindingTarget<CommandStack> {
303
+ return DefaultCommandStack;
304
+ }
305
+
294
306
  protected configureOperationHandlers(binding: InstanceMultiBinding<OperationHandlerConstructor>): void {
295
307
  binding.add(CompoundOperationHandler);
308
+ binding.add(LayoutOperationHandler);
296
309
  }
297
310
 
298
311
  protected configureContextActionProviders(binding: MultiBinding<ContextActionsProvider>): void {
@@ -13,12 +13,14 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
+ import { BindingContext } from '@eclipse-glsp/protocol';
16
17
  import { ContainerModule, injectable, interfaces } from 'inversify';
17
18
  import { AbstractMultiBinding } from './multi-binding';
18
19
 
19
20
  /**
20
21
  * A wrapper interface to get access to the binding related functions
21
22
  * for a inversify container.
23
+ * @deprecated Use `BindingContext` from `@eclipse-glsp/protocol` instead
22
24
  */
23
25
  export interface ModuleContext {
24
26
  bind: interfaces.Bind;
@@ -34,7 +36,7 @@ export interface ModuleContext {
34
36
  export abstract class GLSPModule extends ContainerModule {
35
37
  public static CLIENT_ACTIONS = 'ClientActions';
36
38
 
37
- protected context: ModuleContext;
39
+ protected context: BindingContext;
38
40
 
39
41
  constructor() {
40
42
  super((bind, unbind, isBound, rebind) => {
@@ -13,9 +13,8 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
16
+ import { BindingContext, distinctAdd, flatPush, MaybeArray, remove } from '@eclipse-glsp/protocol';
17
17
  import { applyBindingTarget, BindingTarget } from './binding-target';
18
- import { ModuleContext } from './glsp-module';
19
18
 
20
19
  /**
21
20
  * A helper class used in `GLSPModules` to ease the configuration of multi-injected service identifiers.
@@ -29,7 +28,7 @@ export abstract class AbstractMultiBinding<T> {
29
28
 
30
29
  constructor(readonly identifier: string | symbol) {}
31
30
 
32
- abstract applyBindings(context: ModuleContext): void;
31
+ abstract applyBindings(context: BindingContext): void;
33
32
 
34
33
  add(newBinding: T): void {
35
34
  distinctAdd(this.bindings, newBinding);
@@ -71,7 +70,7 @@ export abstract class AbstractMultiBinding<T> {
71
70
  * @typeparam T the base type of {@link BindingTarget}.
72
71
  */
73
72
  export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
74
- applyBindings(context: ModuleContext): void {
73
+ applyBindings(context: BindingContext): void {
75
74
  this.bindings.forEach(binding => applyBindingTarget(context, this.identifier, binding));
76
75
  }
77
76
  }
@@ -83,7 +82,7 @@ export class MultiBinding<T> extends AbstractMultiBinding<BindingTarget<T>> {
83
82
  * * @typeparam T the type of the instances
84
83
  */
85
84
  export class InstanceMultiBinding<T> extends AbstractMultiBinding<T> {
86
- applyBindings(context: ModuleContext): void {
85
+ applyBindings(context: BindingContext): void {
87
86
  context.bind(this.identifier).toConstantValue(this.bindings);
88
87
  }
89
88
  }
@@ -13,14 +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 { GLSPServer, GLSPServerListener } from '@eclipse-glsp/protocol';
16
17
  import { ContainerModule, interfaces } from 'inversify';
17
18
  import { DefaultGlobalActionProvider, GlobalActionProvider } from '../actions/global-action-provider';
18
- import { DefaultGLSPClientProxy, GLSPClientProxy, JsonRpcGLSPClientProxy } from '../protocol/glsp-client-proxy';
19
- import { DefaultGLSPServer, GLSPServer, JsonRpcGLSPServer } from '../protocol/glsp-server';
20
- import { GLSPServerListener } from '../protocol/glsp-server-listener';
19
+ import { DefaultGLSPServer } from '../protocol/glsp-server';
21
20
  import { ClientSessionFactory, DefaultClientSessionFactory } from '../session/client-session-factory';
22
21
  import { ClientSessionManager, DefaultClientSessionManager } from '../session/client-session-manager';
23
- import { applyBindingTarget, BindingTarget } from './binding-target';
22
+ import { BindingTarget, applyBindingTarget } from './binding-target';
24
23
  import { DiagramModule } from './diagram-module';
25
24
  import { GLSPModule } from './glsp-module';
26
25
  import { MultiBinding } from './multi-binding';
@@ -74,7 +73,6 @@ export class ServerModule extends GLSPModule {
74
73
  applyBindingTarget(context, DiagramModules, this.bindDiagramModules());
75
74
 
76
75
  applyBindingTarget(context, GLSPServer, this.bindGLSPServer()).inSingletonScope();
77
- applyBindingTarget(context, JsonRpcGLSPServer, this.bindJsonRpcGLSPServer());
78
76
  applyBindingTarget(context, ClientSessionFactory, this.bindClientSessionFactory()).inSingletonScope();
79
77
  applyBindingTarget(context, ClientSessionManager, this.bindClientSessionManager()).inSingletonScope();
80
78
  this.configureMultiBinding(new MultiBinding<GLSPServerListener>(GLSPServerListener), binding =>
@@ -83,10 +81,9 @@ export class ServerModule extends GLSPModule {
83
81
 
84
82
  applyBindingTarget(context, GlobalActionProvider, this.bindGlobalActionProvider()).inSingletonScope();
85
83
 
86
- applyBindingTarget(context, InjectionContainer, this.bindInjectionContainer());
87
-
88
- applyBindingTarget(context, GLSPClientProxy, this.bindGLSPClientProxy()).inSingletonScope();
89
- applyBindingTarget(context, JsonRpcGLSPClientProxy, this.bindJsonRpcGLSPClientProxy());
84
+ if (!isBound(InjectionContainer)) {
85
+ applyBindingTarget(context, InjectionContainer, this.bindInjectionContainer());
86
+ }
90
87
  }
91
88
 
92
89
  protected bindDiagramModules(): BindingTarget<Map<string, ContainerModule[]>> {
@@ -97,10 +94,6 @@ export class ServerModule extends GLSPModule {
97
94
  return DefaultGLSPServer;
98
95
  }
99
96
 
100
- protected bindJsonRpcGLSPServer(): BindingTarget<JsonRpcGLSPServer> {
101
- return { service: GLSPServer };
102
- }
103
-
104
97
  protected bindClientSessionFactory(): BindingTarget<ClientSessionFactory> {
105
98
  return DefaultClientSessionFactory;
106
99
  }
@@ -117,14 +110,6 @@ export class ServerModule extends GLSPModule {
117
110
  return { dynamicValue: context => context.container };
118
111
  }
119
112
 
120
- protected bindGLSPClientProxy(): BindingTarget<GLSPClientProxy> {
121
- return DefaultGLSPClientProxy;
122
- }
123
-
124
- protected bindJsonRpcGLSPClientProxy(): BindingTarget<JsonRpcGLSPClientProxy> {
125
- return { service: GLSPClientProxy };
126
- }
127
-
128
113
  protected configureGLSPServerListeners(binding: MultiBinding<GLSPServerListener>): void {
129
114
  binding.add({ service: ClientSessionManager });
130
115
  }
@@ -63,10 +63,8 @@ export class DefaultToolPaletteItemProvider extends ToolPaletteItemProvider {
63
63
  @inject(OperationHandlerRegistry) operationHandlerRegistry: OperationHandlerRegistry;
64
64
  protected counter: number;
65
65
 
66
- getItems(args?: Args): PaletteItem[] {
67
- const handlers = this.operationHandlerRegistry
68
- .getAll()
69
- .filter(handler => handler instanceof CreateOperationHandler) as CreateOperationHandler[];
66
+ getItems(_args?: Args): PaletteItem[] {
67
+ const handlers = this.operationHandlerRegistry.getAll().filter(CreateOperationHandler.is) as CreateOperationHandler[];
70
68
  this.counter = 0;
71
69
  const nodes = this.createPaletteItem(handlers, CreateNodeOperation.KIND);
72
70
  const edges = this.createPaletteItem(handlers, CreateEdgeOperation.KIND);
@@ -16,11 +16,16 @@
16
16
  import { GModelRoot } from '@eclipse-glsp/graph';
17
17
  import { Action, ComputedBoundsAction, MaybePromise } from '@eclipse-glsp/protocol';
18
18
  import { inject, injectable } from 'inversify';
19
- import { ActionHandler } from '../actions/action-handler';
20
- import { ModelState } from '../features/model/model-state';
21
- import { ModelSubmissionHandler } from '../features/model/model-submission-handler';
22
- import { applyAlignment, applyBounds, applyRoute } from '../utils/layout-util';
19
+ import { ActionHandler } from '../../actions/action-handler';
20
+ import { applyAlignment, applyElementAndBounds, applyRoute } from '../../utils/layout-util';
21
+ import { ModelState } from '../model/model-state';
22
+ import { ModelSubmissionHandler } from '../model/model-submission-handler';
23
23
 
24
+ /**
25
+ * Syncs the bounds computed by the client (i.e. the actual bounds after applying CSS styles) back to the `GModel`.
26
+ * In this default implementation the updated bounds are stored transient. This means they are applied to the graphical model but
27
+ * are not persisted to the source model.
28
+ */
24
29
  @injectable()
25
30
  export class ComputedBoundsActionHandler implements ActionHandler {
26
31
  @inject(ModelSubmissionHandler)
@@ -42,7 +47,7 @@ export class ComputedBoundsActionHandler implements ActionHandler {
42
47
 
43
48
  protected applyBounds(root: GModelRoot, action: ComputedBoundsAction): void {
44
49
  const index = this.modelState.index;
45
- action.bounds.forEach(bounds => applyBounds(bounds, index));
50
+ action.bounds.forEach(bounds => applyElementAndBounds(bounds, index));
46
51
  (action.alignments ?? []).forEach(alignment => applyAlignment(alignment, index));
47
52
  (action.routes ?? []).forEach(route => applyRoute(route, index));
48
53
  }
@@ -13,15 +13,23 @@
13
13
  *
14
14
  * SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
15
15
  ********************************************************************************/
16
- import { LayoutOperation, Operation } from '@eclipse-glsp/protocol';
16
+ import { LayoutOperation, MaybePromise, Operation } from '@eclipse-glsp/protocol';
17
17
  import { inject, injectable, optional } from 'inversify';
18
+ import { Command } from '../../command/command';
19
+ import { GModelRecordingCommand } from '../../command/recording-command';
18
20
  import { DiagramConfiguration, ServerLayoutKind } from '../../diagram/diagram-configuration';
19
21
  import { OperationHandler } from '../../operations/operation-handler';
20
22
  import { Logger } from '../../utils/logger';
23
+ import { GModelSerializer } from '../model/gmodel-serializer';
21
24
  import { LayoutEngine } from './layout-engine';
22
25
 
26
+ /**
27
+ * The default handler for `{@link LayoutOperation}s. Does invoke the (optional) layout engine
28
+ * if the server is configured for manual layouting. Changes are stored transient in the graphical model and are not
29
+ * persisted in the source model.
30
+ */
23
31
  @injectable()
24
- export class LayoutOperationHandler implements OperationHandler {
32
+ export class LayoutOperationHandler extends OperationHandler {
25
33
  @inject(Logger)
26
34
  protected logger: Logger;
27
35
 
@@ -32,16 +40,23 @@ export class LayoutOperationHandler implements OperationHandler {
32
40
  @inject(DiagramConfiguration)
33
41
  protected diagramConfiguration: DiagramConfiguration;
34
42
 
43
+ @inject(GModelSerializer)
44
+ protected serializer: GModelSerializer;
45
+
35
46
  readonly operationType = LayoutOperation.KIND;
36
- async execute(operation: Operation): Promise<void> {
37
- if (operation.kind === LayoutOperation.KIND) {
38
- if (this.diagramConfiguration.layoutKind === ServerLayoutKind.MANUAL) {
39
- if (this.layoutEngine) {
40
- await this.layoutEngine.layout();
41
- return;
42
- }
43
- this.logger.warn('Could not execute layout operation. No `LayoutEngine` is bound!');
44
- }
47
+
48
+ createCommand(operation: LayoutOperation): MaybePromise<Command | undefined> {
49
+ if (this.diagramConfiguration.layoutKind !== ServerLayoutKind.MANUAL) {
50
+ return undefined;
51
+ }
52
+ if (!this.layoutEngine) {
53
+ this.logger.warn('Could not execute layout operation. No `LayoutEngine` is bound!');
54
+ return undefined;
45
55
  }
56
+ return new GModelRecordingCommand(this.modelState, this.serializer, () => this.executeOperation(operation));
57
+ }
58
+
59
+ protected async executeOperation(_operation: Operation): Promise<void> {
60
+ await this.layoutEngine?.layout();
46
61
  }
47
62
  }
@@ -30,7 +30,6 @@ export interface ModelState {
30
30
  readonly root: GModelRoot;
31
31
  updateRoot(newRoot: GModelRoot): void;
32
32
  editMode: string;
33
- isDirty: boolean;
34
33
  sourceUri?: string;
35
34
  clientId: string;
36
35
  readonly isReadonly: boolean;
@@ -56,8 +55,6 @@ export class DefaultModelState implements ModelState {
56
55
 
57
56
  editMode = EditMode.EDITABLE;
58
57
 
59
- isDirty = false;
60
-
61
58
  set<P>(key: string, property: P): void {
62
59
  this.properties.set(key, property);
63
60
  }
@@ -24,6 +24,7 @@ import {
24
24
  UpdateModelAction
25
25
  } from '@eclipse-glsp/protocol';
26
26
  import { inject, injectable, optional } from 'inversify';
27
+ import { CommandStack } from '../../command/command-stack';
27
28
  import { DiagramConfiguration, ServerLayoutKind } from '../../diagram/diagram-configuration';
28
29
  import { LayoutEngine } from '../layout/layout-engine';
29
30
  import { GModelFactory } from './gmodel-factory';
@@ -48,6 +49,9 @@ export class ModelSubmissionHandler {
48
49
  @optional()
49
50
  protected layoutEngine: LayoutEngine;
50
51
 
52
+ @inject(CommandStack)
53
+ protected commandStack: CommandStack;
54
+
51
55
  /**
52
56
  * Returns a list of actions to update the client-side model, based on the specified <code>modelState</code>.
53
57
  *
@@ -63,7 +67,7 @@ export class ModelSubmissionHandler {
63
67
  const root = this.serializeGModel();
64
68
 
65
69
  if (this.diagramConfiguration.needsClientLayout) {
66
- return [RequestBoundsAction.create(root), SetDirtyStateAction.create(this.modelState.isDirty, { reason })];
70
+ return [RequestBoundsAction.create(root), SetDirtyStateAction.create(this.commandStack.isDirty, { reason })];
67
71
  }
68
72
  return [SetModelAction.create(root)];
69
73
  }
@@ -95,7 +99,7 @@ export class ModelSubmissionHandler {
95
99
  : UpdateModelAction.create(root, { animate: this.diagramConfiguration.animatedUpdate })
96
100
  );
97
101
  if (!this.diagramConfiguration.needsClientLayout) {
98
- result.push(SetDirtyStateAction.create(this.modelState.isDirty, { reason }));
102
+ result.push(SetDirtyStateAction.create(this.commandStack.isDirty, { reason }));
99
103
  }
100
104
  return result;
101
105
  }
@@ -16,23 +16,22 @@
16
16
  import { Action, SaveModelAction, SetDirtyStateAction } from '@eclipse-glsp/protocol';
17
17
  import { inject, injectable } from 'inversify';
18
18
  import { ActionHandler } from '../../actions/action-handler';
19
- import { ModelState } from './model-state';
19
+ import { CommandStack } from '../../command/command-stack';
20
20
  import { SourceModelStorage } from './source-model-storage';
21
21
 
22
22
  @injectable()
23
23
  export class SaveModelActionHandler implements ActionHandler {
24
24
  actionKinds = [SaveModelAction.KIND];
25
25
 
26
- @inject(ModelState)
27
- protected modelState: ModelState;
26
+ @inject(CommandStack)
27
+ protected commandStack: CommandStack;
28
28
 
29
29
  @inject(SourceModelStorage)
30
30
  protected sourceModelStorage: SourceModelStorage;
31
31
 
32
32
  async execute(action: SaveModelAction): Promise<Action[]> {
33
33
  await this.sourceModelStorage.saveSourceModel(action);
34
- this.modelState.isDirty = false; // TODO: call save is done when available
35
-
36
- return [SetDirtyStateAction.create(this.modelState.isDirty, { reason: 'save' })];
34
+ this.commandStack.saveIsDone();
35
+ return [SetDirtyStateAction.create(this.commandStack.isDirty, { reason: 'save' })];
37
36
  }
38
37
  }