@eclipse-glsp-examples/workflow-server-bundled 2.1.0-next.75 → 2.1.0-next.78

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclipse-glsp-examples/workflow-server-bundled",
3
- "version": "2.1.0-next.75+9f86a52",
3
+ "version": "2.1.0-next.78+6db8ac8",
4
4
  "description": "GLSP node server for the workflow example (bundled)",
5
5
  "keywords": [
6
6
  "eclipse",
@@ -49,5 +49,5 @@
49
49
  "publishConfig": {
50
50
  "access": "public"
51
51
  },
52
- "gitHead": "9f86a52adb3d5ae444f8aeeed842fc01b443bd4e"
52
+ "gitHead": "6db8ac875b2714c17b314db076ca8edfc92706e5"
53
53
  }
@@ -189,11 +189,14 @@ let CreateActivityNodeHandler = class CreateActivityNodeHandler extends create_w
189
189
  createNode(operation, relativeLocation) {
190
190
  return this.builder(relativeLocation).build();
191
191
  }
192
- builder(point) {
192
+ builder(point = server_1.Point.ORIGIN, elementTypeId = this.elementTypeIds[0]) {
193
193
  return graph_extension_1.ActivityNode.builder()
194
- .position(point !== null && point !== void 0 ? point : server_1.Point.ORIGIN)
195
- .type(this.elementTypeIds[0])
196
- .nodeType(model_types_1.ModelTypes.toNodeType(this.elementTypeIds[0]));
194
+ .position(point)
195
+ .type(elementTypeId)
196
+ .nodeType(model_types_1.ModelTypes.toNodeType(elementTypeId));
197
+ }
198
+ createTriggerGhostElement(elementTypeId) {
199
+ return { template: this.serializer.createSchema(this.builder(undefined, elementTypeId).build()) };
197
200
  }
198
201
  };
199
202
  exports.CreateActivityNodeHandler = CreateActivityNodeHandler;
@@ -279,14 +282,17 @@ class CreateCategoryHandler extends create_workflow_node_operation_handler_1.Cre
279
282
  createNode(operation, relativeLocation) {
280
283
  return this.builder(relativeLocation).build();
281
284
  }
282
- builder(point) {
285
+ builder(point = server_1.Point.ORIGIN, elementTypeId = this.elementTypeIds[0]) {
283
286
  return graph_extension_1.Category.builder()
284
- .type(this.elementTypeIds[0])
285
- .position(point !== null && point !== void 0 ? point : server_1.Point.ORIGIN)
287
+ .type(elementTypeId)
288
+ .position(point)
286
289
  .name(this.label.replace(' ', '') + this.modelState.index.getAllByClass(graph_extension_1.Category).length)
287
290
  .addArgs(server_1.ArgsUtil.cornerRadius(5))
288
291
  .children();
289
292
  }
293
+ createTriggerGhostElement(elementTypeId) {
294
+ return { template: this.serializer.createSchema(this.builder(undefined, elementTypeId).build()), dynamic: true };
295
+ }
290
296
  }
291
297
  exports.CreateCategoryHandler = CreateCategoryHandler;
292
298
 
@@ -614,14 +620,17 @@ let CreateTaskHandler = class CreateTaskHandler extends create_workflow_node_ope
614
620
  createNode(operation, relativeLocation) {
615
621
  return this.builder(relativeLocation).build();
616
622
  }
617
- builder(point) {
623
+ builder(point = protocol_1.Point.ORIGIN, elementTypeId = this.elementTypeIds[0]) {
618
624
  return graph_extension_1.TaskNode.builder()
619
625
  .position(point !== null && point !== void 0 ? point : protocol_1.Point.ORIGIN)
620
626
  .name(this.label.replace(' ', '') + this.modelState.index.getAllByClass(graph_extension_1.TaskNode).length)
621
- .type(this.elementTypeIds[0])
622
- .taskType(model_types_1.ModelTypes.toNodeType(this.elementTypeIds[0]))
627
+ .type(elementTypeId)
628
+ .taskType(model_types_1.ModelTypes.toNodeType(elementTypeId))
623
629
  .children();
624
630
  }
631
+ createTriggerGhostElement(elementTypeId) {
632
+ return { template: this.serializer.createSchema(this.builder(undefined, elementTypeId).build()), dynamic: true };
633
+ }
625
634
  };
626
635
  exports.CreateTaskHandler = CreateTaskHandler;
627
636
  exports.CreateTaskHandler = CreateTaskHandler = __decorate([
@@ -5100,7 +5109,7 @@ var TriggerNodeCreationAction;
5100
5109
  return base_protocol_1.Action.hasKind(object, TriggerNodeCreationAction.KIND) && (0, type_util_1.hasStringProp)(object, 'elementTypeId');
5101
5110
  }
5102
5111
  TriggerNodeCreationAction.is = is;
5103
- function create(elementTypeId, options = {}) {
5112
+ function create(elementTypeId, options) {
5104
5113
  return Object.assign({ kind: TriggerNodeCreationAction.KIND, elementTypeId }, options);
5105
5114
  }
5106
5115
  TriggerNodeCreationAction.create = create;
@@ -6776,14 +6785,10 @@ class DisposableCollection {
6776
6785
  get disposed() {
6777
6786
  return this.disposables.length === 0;
6778
6787
  }
6779
- /**
6780
- * Pushes the given disposables to the collection.
6781
- * @param disposables The disposables that should be added
6782
- * @returns A disposable that removes the previously pushed values from the collection when invoked
6783
- */
6784
6788
  push(...disposables) {
6785
- this.disposables.push(...disposables);
6786
- return Disposable.create(() => (0, array_util_1.remove)(this.disposables, ...disposables));
6789
+ const toAdd = (0, array_util_1.isArrayOfType)(disposables, Disposable.is) ? disposables : disposables.map(Disposable.create);
6790
+ this.disposables.push(...toAdd);
6791
+ return Disposable.create(() => (0, array_util_1.remove)(this.disposables, ...toAdd));
6787
6792
  }
6788
6793
  get isDisposed() {
6789
6794
  return this.disposed;
@@ -47708,9 +47713,9 @@ let GModelIndex = class GModelIndex {
47708
47713
  return this.getElements(type).length;
47709
47714
  }
47710
47715
  /**
47711
- * Returns all incoming edges for a node.
47716
+ * Returns all incoming edges for a node (or port).
47712
47717
  *
47713
- * @param node The node where the edges are connected.
47718
+ * @param node The node (or port) where the edges are connected.
47714
47719
  *
47715
47720
  * @returns All incoming edges.
47716
47721
  */
@@ -47718,9 +47723,9 @@ let GModelIndex = class GModelIndex {
47718
47723
  return this.getAllEdges().filter(edge => edge.targetId === node.id);
47719
47724
  }
47720
47725
  /**
47721
- * Returns all outgoing edges for a node.
47726
+ * Returns all outgoing edges for a node (or port).
47722
47727
  *
47723
- * @param node The node where the edges are connected.
47728
+ * @param node The node (or port) where the edges are connected.
47724
47729
  *
47725
47730
  * @returns All outgoing edges.
47726
47731
  */
@@ -49592,49 +49597,40 @@ let GModelDeleteOperationHandler = class GModelDeleteOperationHandler extends gm
49592
49597
  this.logger.warn('Element not found: ' + elementId);
49593
49598
  return false;
49594
49599
  }
49595
- const nodeToDelete = this.findTopLevelElement(element);
49596
- if (!nodeToDelete.parent) {
49597
- this.logger.warn("The requested node doesn't have a parent; it can't be deleted");
49600
+ if (!element.parent) {
49601
+ this.logger.warn("The requested element doesn't have a parent; it can't be deleted");
49598
49602
  return false;
49599
49603
  }
49600
49604
  const dependents = new Set();
49601
- this.collectDependents(dependents, nodeToDelete, false);
49605
+ this.collectDependents(dependents, element, false);
49602
49606
  dependents.forEach(dependant => {
49603
- const index = this.modelState.root.children.findIndex(element => element === dependant);
49607
+ const index = dependant.parent.children.findIndex(element => element === dependant);
49604
49608
  if (index > -1) {
49605
- this.modelState.root.children.splice(index, 1);
49609
+ dependant.parent.children.splice(index, 1);
49606
49610
  }
49607
49611
  this.allDependentsIds.add(dependant.id);
49608
49612
  });
49609
49613
  return true;
49610
49614
  }
49611
- collectDependents(dependents, nodeToDelete, isChild) {
49612
- if (dependents.has(nodeToDelete)) {
49615
+ collectDependents(dependents, elementToDelete, isChild) {
49616
+ if (dependents.has(elementToDelete)) {
49613
49617
  return;
49614
49618
  }
49615
- if (nodeToDelete.children.length > 0) {
49616
- nodeToDelete.children.forEach(child => this.collectDependents(dependents, child, true));
49619
+ if (elementToDelete.children.length > 0) {
49620
+ elementToDelete.children.forEach(child => this.collectDependents(dependents, child, true));
49617
49621
  }
49618
- if (nodeToDelete instanceof graph_1.GNode) {
49622
+ if (elementToDelete instanceof graph_1.GNode || elementToDelete instanceof graph_1.GPort) {
49619
49623
  const index = this.modelState.index;
49620
- index.getIncomingEdges(nodeToDelete).forEach(incoming => {
49624
+ index.getIncomingEdges(elementToDelete).forEach(incoming => {
49621
49625
  dependents.add(incoming);
49622
49626
  });
49623
- index.getOutgoingEdges(nodeToDelete).forEach(outgoing => {
49627
+ index.getOutgoingEdges(elementToDelete).forEach(outgoing => {
49624
49628
  dependents.add(outgoing);
49625
49629
  });
49626
49630
  }
49627
- dependents.add(nodeToDelete);
49628
- }
49629
- findTopLevelElement(element) {
49630
- if (element instanceof graph_1.GNode || element instanceof graph_1.GEdge) {
49631
- return element;
49631
+ if (!isChild) {
49632
+ dependents.add(elementToDelete);
49632
49633
  }
49633
- const parent = element.parent;
49634
- if (!parent) {
49635
- return element;
49636
- }
49637
- return this.findTopLevelElement(parent);
49638
49634
  }
49639
49635
  };
49640
49636
  exports.GModelDeleteOperationHandler = GModelDeleteOperationHandler;
@@ -49787,7 +49783,16 @@ let GModelCreateNodeOperationHandler = class GModelCreateNodeOperationHandler ex
49787
49783
  }
49788
49784
  }
49789
49785
  getTriggerActions() {
49790
- return this.elementTypeIds.map(typeId => protocol_1.TriggerNodeCreationAction.create(typeId));
49786
+ return this.elementTypeIds.map(elementTypeId => this.createTriggerNodeCreationAction(elementTypeId));
49787
+ }
49788
+ createTriggerNodeCreationAction(elementTypeId) {
49789
+ return protocol_1.TriggerNodeCreationAction.create(elementTypeId, { ghostElement: this.createTriggerGhostElement(elementTypeId), args: this.createTriggerArgs(elementTypeId) });
49790
+ }
49791
+ createTriggerGhostElement(elementTypeId) {
49792
+ return undefined;
49793
+ }
49794
+ createTriggerArgs(elementTypeId) {
49795
+ return undefined;
49791
49796
  }
49792
49797
  /**
49793
49798
  * Return the GModelElement that will contain the newly created node. It is usually
@@ -50764,7 +50769,16 @@ let JsonCreateNodeOperationHandler = class JsonCreateNodeOperationHandler extend
50764
50769
  this.operationType = protocol_1.CreateNodeOperation.KIND;
50765
50770
  }
50766
50771
  getTriggerActions() {
50767
- return this.elementTypeIds.map(typeId => protocol_1.TriggerNodeCreationAction.create(typeId));
50772
+ return this.elementTypeIds.map(elementTypeId => this.createTriggerNodeCreationAction(elementTypeId));
50773
+ }
50774
+ createTriggerNodeCreationAction(elementTypeId) {
50775
+ return protocol_1.TriggerNodeCreationAction.create(elementTypeId, { ghostElement: this.createTriggerGhostElement(elementTypeId), args: this.createTriggerArgs(elementTypeId) });
50776
+ }
50777
+ createTriggerGhostElement(elementTypeId) {
50778
+ return undefined;
50779
+ }
50780
+ createTriggerArgs(elementTypeId) {
50781
+ return undefined;
50768
50782
  }
50769
50783
  /**
50770
50784
  * Return the GModelElement that will contain the newly created node. It is usually