private void removeStructuredActivityNodes(IRemoveContext context) {
   EList<EObject> structuredActivityNodes =
       context.getPictogramElement().getLink().getBusinessObjects();
   for (EObject eObject : structuredActivityNodes) {
     if (eObject instanceof StructuredActivityNode) {
       StructuredActivityNode structuredActivityNode = (StructuredActivityNode) eObject;
       removeInputPins(structuredActivityNode.getStructuredNodeInput());
       removeOutputPins(structuredActivityNode.getStructuredNodeOutput());
     }
     if (eObject instanceof ExpansionRegion) {
       ExpansionRegion expansionRegion = (ExpansionRegion) eObject;
       removeExpansionNodes(expansionRegion.getOutputElement());
       removeExpansionNodes(expansionRegion.getInputElement());
     }
   }
 }
コード例 #2
0
  @Override
  public Object[] create(ICreateContext context) {
    ExpansionNode expansionNode = createExpansionNode(context);

    ExpansionRegion expansionRegion = getTargetExpansionRegion(context);

    Activity activity = expansionRegion.getActivity();
    if (activity != null) activity.getNode().add(expansionNode);
    else {
      StructuredActivityNode inStructuredNode = expansionRegion.getInStructuredNode();
      if (inStructuredNode != null) inStructuredNode.getNode().add(expansionNode);
    }

    addGraphicalRepresentation(context, expansionNode);

    return new Object[] {expansionNode};
  }