static {
   Bpmn2Package i = Bpmn2Package.eINSTANCE;
   final List<EClass> items = new ArrayList<EClass>();
   for (EClassifier eclassifier : i.getEClassifiers()) {
     if (eclassifier instanceof EClass) {
       items.add((EClass) eclassifier);
     }
   }
   elementSet.addAll(items);
   //		elementSet.addAll(getSubClasses(i.getFlowElement()));
   //		elementSet.addAll(getSubClasses(i.getItemAwareElement()));
   //		elementSet.addAll(getSubClasses(i.getDataAssociation()));
   //		elementSet.addAll(getSubClasses(i.getRootElement()));
   //		elementSet.addAll(getSubClasses(i.getEventDefinition()));
   //		elementSet.addAll(getSubClasses(i.getLoopCharacteristics()));
   //		elementSet.addAll(getSubClasses(i.getExpression()));
   //		elementSet.add(i.getDefinitions());
   //		elementSet.add(i.getOperation());
   //		elementSet.add(i.getLane());
   //		elementSet.add(i.getEscalation());
   //		elementSet.add(i.getPotentialOwner());
   //		elementSet.add(i.getResourceAssignmentExpression());
   //		elementSet.add(i.getInputSet());
   //		elementSet.add(i.getOutputSet());
   //		elementSet.add(i.getAssignment());
   //		elementSet.add(i.getAssociation());
   //		elementSet.add(i.getTextAnnotation());
   //		elementSet.add(i.getMessageFlow());
   //		elementSet.add(i.getConversationLink());
   //		elementSet.add(i.getGroup());
   //		elementSet.add(i.getConversation());
 }
  /**
   * Complete the initialization of the package and its meta-model. This method is guarded to have
   * no affect on any invocation but its first.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated
   */
  public void initializePackageContents() {
    if (isInitialized) return;
    isInitialized = true;

    // Initialize package
    setName(eNAME);
    setNsPrefix(eNS_PREFIX);
    setNsURI(eNS_URI);

    // Obtain other dependent packages
    Bpmn2Package theBpmn2Package =
        (Bpmn2Package) EPackage.Registry.INSTANCE.getEPackage(Bpmn2Package.eNS_URI);

    // Create type parameters

    // Set bounds for type parameters

    // Add supertypes to classes
    documentRootEClass.getESuperTypes().add(theBpmn2Package.getDocumentRoot());

    // Initialize classes and features; add operations and parameters
    initEClass(
        documentRootEClass,
        DocumentRoot.class,
        "DocumentRoot",
        !IS_ABSTRACT,
        !IS_INTERFACE,
        IS_GENERATED_INSTANCE_CLASS);
    initEAttribute(
        getDocumentRoot_SampleCustomTaskId(),
        ecorePackage.getEString(),
        "sampleCustomTaskId",
        null,
        0,
        1,
        null,
        !IS_TRANSIENT,
        !IS_VOLATILE,
        IS_CHANGEABLE,
        !IS_UNSETTABLE,
        !IS_ID,
        IS_UNIQUE,
        !IS_DERIVED,
        IS_ORDERED);

    // Create resource
    createResource(eNS_URI);

    // Create annotations
    // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
    createExtendedMetaDataAnnotations();
  }
/** @author Nico Rehwaldt */
public class ChangeSupportTest extends AbstractNonTransactionalFeatureTest {

  static final FoxFactory foxFactory = FoxFactory.eINSTANCE;
  static final FoxPackage foxPackage = FoxPackage.eINSTANCE;

  static final Bpmn2Factory bpmn2factory = Bpmn2Factory.eINSTANCE;
  static final Bpmn2Package bpmn2package = Bpmn2Package.eINSTANCE;

  static final ModelFactory modelFactory = ModelFactory.eINSTANCE;
  static final ModelPackage modelPackage = ModelPackage.eINSTANCE;

  static final EStructuralFeature FLOW_ELEMENTS_FEATURE =
      bpmn2package.getFlowElementsContainer_FlowElements();
  static final EStructuralFeature CONDITION_EXPRESSION_FEATURE =
      bpmn2package.getSequenceFlow_ConditionExpression();

  static final EStructuralFeature ASYNC_FEATURE = modelPackage.getDocumentRoot_Async();
  static final EStructuralFeature RETRY_CYCLE_FEATURE =
      modelPackage.getDocumentRoot_FailedJobRetryTimeCycle();

  static final EStructuralFeature IN_FEATURE = modelPackage.getDocumentRoot_In();

  static final EStructuralFeature FORM_DATA_FEATURE =
      ModelPackage.eINSTANCE.getDocumentRoot_FormData();
  static final EStructuralFeature FORM_FIELD_VALIDATION_FEATURE =
      ModelPackage.eINSTANCE.getFormFieldType_Validation();
  static final EStructuralFeature FORM_FIELD_PROPERTIES_FEATURE =
      ModelPackage.eINSTANCE.getFormFieldType_Properties();
  static final EStructuralFeature FORM_FIELD_VALUE_FEATURE =
      ModelPackage.eINSTANCE.getFormFieldType_Value();

  static final EStructuralFeature FIELD_TYPE_FEATURE = modelPackage.getDocumentRoot_Field();

  // default change support tests ///////////////////////////////////////////

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testListElementAdd() {
    final Process process1 = findBusinessObjectById(diagram, "Process_1", Process.class);

    final Task task2 = bpmn2factory.createTask();

    FeatureChangeFilter filter = new FeatureChangeFilter(process1, FLOW_ELEMENTS_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(process1, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            process1.getFlowElements().add(task2);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testListElementModify() {
    final Process process1 = findBusinessObjectById(diagram, "Process_1", Process.class);
    final SequenceFlow sequenceFlow1 =
        findBusinessObjectById(diagram, "SequenceFlow_1", SequenceFlow.class);

    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    FeatureChangeFilter filter = new FeatureChangeFilter(process1, FLOW_ELEMENTS_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(process1, filter);
    listener.register();

    // check what happenes when other changes connected
    // to flow elements occur
    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            sequenceFlow1.setTargetRef(task1);
          }
        });

    // we have another filter to figure out exactly that
    assertThat(listener.getCapturedEvents()).isEmpty();
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testListElementRemove() {
    final Process process1 = findBusinessObjectById(diagram, "Process_1", Process.class);
    final ServiceTask serviceTask1 =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    FeatureChangeFilter filter = new FeatureChangeFilter(process1, FLOW_ELEMENTS_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(process1, filter);
    listener.register();

    // assert that task is member of collection
    assertThat(process1.getFlowElements()).contains(serviceTask1);

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            process1.getFlowElements().remove(serviceTask1);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testAttributeAdd() {
    final SequenceFlow sequenceFlow1 =
        findBusinessObjectById(diagram, "SequenceFlow_1", SequenceFlow.class);

    FeatureChangeFilter filter =
        new FeatureChangeFilter(sequenceFlow1, CONDITION_EXPRESSION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(sequenceFlow1, filter);
    listener.register();

    final FormalExpression expression = bpmn2factory.createFormalExpression();
    expression.setBody("FOOO");

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            sequenceFlow1.setConditionExpression(expression);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testAttributeRemove() {
    final SequenceFlow sequenceFlow2 =
        findBusinessObjectById(diagram, "SequenceFlow_2", SequenceFlow.class);

    FeatureChangeFilter filter =
        new FeatureChangeFilter(sequenceFlow2, CONDITION_EXPRESSION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(sequenceFlow2, filter);
    listener.register();

    // assert that feature is set
    assertThat(sequenceFlow2.eIsSet(CONDITION_EXPRESSION_FEATURE)).isTrue();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            sequenceFlow2.eUnset(CONDITION_EXPRESSION_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testAttributeUpdate() {
    final SequenceFlow sequenceFlow2 =
        findBusinessObjectById(diagram, "SequenceFlow_2", SequenceFlow.class);

    FeatureChangeFilter filter =
        new FeatureChangeFilter(sequenceFlow2, CONDITION_EXPRESSION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(sequenceFlow2, filter);
    listener.register();

    final FormalExpression expression = bpmn2factory.createFormalExpression();
    expression.setBody("FOOO");

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            sequenceFlow2.setConditionExpression(expression);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  // extension attribute change support ///////////////////////////////

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionAttributeAdd() {
    final ServiceTask serviceTask1 =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    FeatureChangeFilter filter = new FeatureChangeFilter(serviceTask1, ASYNC_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask1, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            serviceTask1.eSet(ASYNC_FEATURE, true);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionAttributeRemove() {
    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    FeatureChangeFilter filter = new FeatureChangeFilter(task1, ASYNC_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(task1, filter);
    listener.register();

    // assert that feature is set
    assertThat(task1.eIsSet(ASYNC_FEATURE)).isTrue();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            task1.eUnset(ASYNC_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionAttributeUpdate() {
    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    FeatureChangeFilter filter = new FeatureChangeFilter(task1, ASYNC_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(task1, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            task1.eSet(ASYNC_FEATURE, false);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  // extension element change support ///////////////////////////////

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementAdd() {
    final ServiceTask serviceTask1 =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask1, RETRY_CYCLE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask1, filter);
    listener.register();

    final FailedJobRetryTimeCycleType retryCycle = foxFactory.createFailedJobRetryTimeCycleType();
    retryCycle.setText("R3/PT10S");

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask1, RETRY_CYCLE_FEATURE, retryCycle);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementRemove() {
    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    ExtensionChangeFilter filter = new ExtensionChangeFilter(task1, RETRY_CYCLE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(task1, filter);
    listener.register();

    // assert that feature is set
    assertThat(ExtensionUtil.getExtension(task1, RETRY_CYCLE_FEATURE, "text")).isNotNull();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.removeExtensionByFeature(task1, RETRY_CYCLE_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementRemoveAndCleanExtensionAttributeValues() {
    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    // assert that feature is set
    assertThat(ExtensionUtil.getExtension(task1, RETRY_CYCLE_FEATURE, "text")).isNotNull();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.removeExtensionByFeature(task1, RETRY_CYCLE_FEATURE);
          }
        });

    ExtensionChangeFilter filter = new ExtensionChangeFilter(task1, RETRY_CYCLE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(task1, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            AttributeUtil.clearEmptyExtensionElements(task1);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementUpdate() {
    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    ExtensionChangeFilter filter = new ExtensionChangeFilter(task1, RETRY_CYCLE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(task1, filter);

    listener.register();

    final FailedJobRetryTimeCycleType retryCycle = foxFactory.createFailedJobRetryTimeCycleType();
    retryCycle.setText("R3/PT10S");

    // assert that feature is set
    assertThat(ExtensionUtil.getExtension(task1, RETRY_CYCLE_FEATURE, "text")).isNotNull();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.updateExtension(task1, RETRY_CYCLE_FEATURE, retryCycle);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  public InType addCallActivityInType(final CallActivity callActivity) {
    final InType inType = modelFactory.createInType();
    inType.setSource("ASD");

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(callActivity, IN_FEATURE, inType);
          }
        });

    return inType;
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementNestedAttributeUpdate() {
    final CallActivity callActivity1 =
        findBusinessObjectById(diagram, "CallActivity_1", CallActivity.class);

    // add stuff
    final InType type = addCallActivityInType(callActivity1);

    ExtensionChangeFilter filter = new ExtensionChangeFilter(callActivity1, IN_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(callActivity1, filter);
    listener.register();

    List<InType> inTypes = ExtensionUtil.getExtensions(callActivity1, InType.class);
    assertThat(inTypes).hasSize(1);

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            type.setSource("SDF");
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testExtensionElementNestedAttributeUnset() {
    final CallActivity callActivity1 =
        findBusinessObjectById(diagram, "CallActivity_1", CallActivity.class);

    // add stuff
    final InType type = addCallActivityInType(callActivity1);

    ExtensionChangeFilter filter = new ExtensionChangeFilter(callActivity1, IN_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(callActivity1, filter);
    listener.register();

    List<InType> inTypes = ExtensionUtil.getExtensions(callActivity1, InType.class);
    assertThat(inTypes).hasSize(1);

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            type.eUnset(modelPackage.getInType_Source());
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormDataElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).isNotNull();

    ExtensionChangeFilter filter = new ExtensionChangeFilter(userTask, FORM_DATA_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(userTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.removeExtensionByFeature(userTask, FORM_DATA_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  // feature change filter

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormFieldValueElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    FeatureChangeFilter filter = new FeatureChangeFilter(formFieldType, FORM_FIELD_VALUE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ValueType formFieldValueType = ModelFactory.eINSTANCE.createValueType();
            formFieldValueType.setId("test");
            formFieldValueType.setName("test");
            formFieldType.getValue().add(formFieldValueType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldValueElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    FeatureChangeFilter filter = new FeatureChangeFilter(formFieldType, FORM_FIELD_VALUE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    assertThat(formFieldType.getValue()).hasSize(3);

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getValue().remove(0);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormFieldPropertiesElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getProperties()).isNull();

    FeatureChangeFilter filter =
        new FeatureChangeFilter(formFieldType, FORM_FIELD_PROPERTIES_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            PropertiesType propertiesType = ModelFactory.eINSTANCE.createPropertiesType();
            PropertyType propertyType = ModelFactory.eINSTANCE.createPropertyType();
            propertyType.setId("test");
            propertyType.setValue("test");

            propertiesType.getProperty().add(propertyType);
            formFieldType.setProperties(propertiesType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldPropertiesElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getProperties()).isNotNull();

    FeatureChangeFilter filter =
        new FeatureChangeFilter(formFieldType, FORM_FIELD_PROPERTIES_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.eUnset(FORM_FIELD_PROPERTIES_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormFieldValidationElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getValidation()).isNull();

    FeatureChangeFilter filter =
        new FeatureChangeFilter(formFieldType, FORM_FIELD_VALIDATION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ValidationType validationType = ModelFactory.eINSTANCE.createValidationType();
            ConstraintType constraintType = ModelFactory.eINSTANCE.createConstraintType();
            constraintType.setName("test");
            constraintType.setConfig("test");

            validationType.getConstraint().add(constraintType);
            formFieldType.setValidation(validationType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldValidationElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getValidation()).isNotNull();

    FeatureChangeFilter filter =
        new FeatureChangeFilter(formFieldType, FORM_FIELD_VALIDATION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.eUnset(FORM_FIELD_VALIDATION_FEATURE);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  // nested list change support ///////////////////////////////////////

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/ChangeSupportTest.testBase.bpmn")
  public void testListElementModifyNestedDetect() {
    final Process process1 = findBusinessObjectById(diagram, "Process_1", Process.class);
    final SequenceFlow sequenceFlow1 =
        findBusinessObjectById(diagram, "SequenceFlow_1", SequenceFlow.class);

    final Task task1 = findBusinessObjectById(diagram, "Task_1", Task.class);

    IsManyAttributeAnyChildChangeFilter filter =
        new IsManyAttributeAnyChildChangeFilter(process1, FLOW_ELEMENTS_FEATURE);

    CustomResourceSetListener listener = new CustomResourceSetListener(process1, filter);
    listener.register();

    // check what happens when other changes connected
    // to flow elements occur
    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            sequenceFlow1.setTargetRef(task1);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldValueElementUpdate() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    IsManyAttributeAnyChildChangeFilter filter =
        new IsManyAttributeAnyChildChangeFilter(formFieldType, FORM_FIELD_VALUE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    assertThat(formFieldType.getValue()).hasSize(3);
    assertThat(formFieldType.getValue().get(0).getId()).isNotNull();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getValue().get(0).setId("newValue");
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  // any nested change support ///////////////////////////////////////

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormDataAddChangeSupportTest.bpmn")
  public void testFormDataAndFormFieldElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).isEmpty();

    AnyNestedChangeFilter filter = new AnyNestedChangeFilter(userTask, FORM_DATA_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(userTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            // add form data with form field
            FormDataType formData = ModelFactory.eINSTANCE.createFormDataType();
            ExtensionUtil.addExtension(userTask, FORM_DATA_FEATURE, formData);

            FormFieldType formField = ModelFactory.eINSTANCE.createFormFieldType();
            formField.setId("test");
            formField.setType("string");
            formData.getFormField().add(formField);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormFieldElementUpdate() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    final EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    AnyNestedChangeFilter filter = new AnyNestedChangeFilter(userTask, FORM_DATA_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(userTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldList.get(0).setId("newValue");
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FormFieldChangeSupportTest.bpmn")
  public void testFormFieldElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    final EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    AnyNestedChangeFilter filter = new AnyNestedChangeFilter(userTask, FORM_DATA_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(userTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldList.remove(0);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldPropertyElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getProperties()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_PROPERTIES_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            PropertyType propertyType = ModelFactory.eINSTANCE.createPropertyType();
            propertyType.setId("test");
            propertyType.setValue("test");
            formFieldType.getProperties().getProperty().add(propertyType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldPropertyElementUpdate() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getProperties().getProperty().get(0).getId()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_PROPERTIES_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getProperties().getProperty().get(0).setId("newValue");
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldPropertyElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getProperties().getProperty()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_PROPERTIES_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getProperties().getProperty().remove(0);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldConstraintElementAdd() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getValidation()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_VALIDATION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ConstraintType constraintType = ModelFactory.eINSTANCE.createConstraintType();
            constraintType.setName("test");
            constraintType.setConfig("test");
            formFieldType.getValidation().getConstraint().add(constraintType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldConstraintElementUpdate() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getValidation().getConstraint().get(0).getName()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_VALIDATION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getValidation().getConstraint().get(0).setName("newValue");
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FormFieldEditAndRemoveChangeSupportTest.bpmn")
  public void testFormFieldConstraintElementRemove() {
    final UserTask userTask = findBusinessObjectById(diagram, "UserTask_1", UserTask.class);

    List<FormDataType> formDataTypeList = ExtensionUtil.getExtensions(userTask, FormDataType.class);
    assertThat(formDataTypeList).hasSize(1);

    EList<FormFieldType> formFieldList = formDataTypeList.get(0).getFormField();
    assertThat(formFieldList).hasSize(1);

    final FormFieldType formFieldType = formFieldList.get(0);
    assertThat(formFieldType).isNotNull();

    assertThat(formFieldType.getValidation().getConstraint()).isNotNull();

    AnyNestedChangeFilter filter =
        new AnyNestedChangeFilter(formFieldType, FORM_FIELD_VALIDATION_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(formFieldType, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            formFieldType.getValidation().getConstraint().remove(0);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FieldInjectionAddElement.bpmn")
  public void testFieldExtensionStringElementAdd() {
    final ServiceTask serviceTask =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    List<FieldType> fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).isEmpty();

    final FieldType fieldType = modelFactory.createFieldType();
    fieldType.setName("myFieldElement");
    fieldType.setString("myFieldStringValue");

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask, FIELD_TYPE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask, FIELD_TYPE_FEATURE, fieldType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);

    fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(1);
  }

  @Test
  @DiagramResource("org/camunda/bpm/modeler/test/ui/change/FieldInjectionAddElement.bpmn")
  public void testFieldExtensionExpressionElementAdd() {
    final ServiceTask serviceTask =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    List<FieldType> fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).isEmpty();

    final FieldType fieldType = modelFactory.createFieldType();
    fieldType.setName("myFieldElement");
    fieldType.setExpression("myFieldExpressionValue");

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask, FIELD_TYPE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask, FIELD_TYPE_FEATURE, fieldType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);

    fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(1);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FieldInjectionAddElementToExtension.bpmn")
  public void testAddFieldStringElementToExistingFieldsWithAttributes() {
    final ServiceTask serviceTask =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    List<FieldType> fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(2);

    final FieldType fieldType = modelFactory.createFieldType();
    fieldType.setName("myFieldElement");
    fieldType.setString("myFieldStringValue");

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask, FIELD_TYPE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask, FIELD_TYPE_FEATURE, fieldType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);

    fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(3);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FieldInjectionAddElementToExtension.bpmn")
  public void testAddFieldStringExpressionElementToExistingFieldsWithAttributes() {
    final ServiceTask serviceTask =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    List<FieldType> fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(2);

    final FieldType fieldType = modelFactory.createFieldType();
    fieldType.setName("myFieldElement");
    // expression and string value is set
    // but the engine parser parse first the string value
    fieldType.setString("myFieldStringValue");
    fieldType.setExpression("myFieldExpressionValue");

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask, FIELD_TYPE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask, FIELD_TYPE_FEATURE, fieldType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);

    fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(3);
  }

  @Test
  @DiagramResource(
      "org/camunda/bpm/modeler/test/ui/change/FieldInjectionAddElementToExtension.bpmn")
  public void testAddFieldElementOnlyWithNameToExistingFieldsWithAttributes() {
    final ServiceTask serviceTask =
        findBusinessObjectById(diagram, "ServiceTask_1", ServiceTask.class);

    List<FieldType> fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(2);

    final FieldType fieldType = modelFactory.createFieldType();
    fieldType.setName("myFieldElement");

    ExtensionChangeFilter filter = new ExtensionChangeFilter(serviceTask, FIELD_TYPE_FEATURE);
    CustomResourceSetListener listener = new CustomResourceSetListener(serviceTask, filter);
    listener.register();

    transactionalExecute(
        new RecordingCommand(editingDomain) {

          @Override
          protected void doExecute() {
            ExtensionUtil.addExtension(serviceTask, FIELD_TYPE_FEATURE, fieldType);
          }
        });

    assertThat(listener.getCapturedEvents()).hasSize(1);

    fieldTypeList = ExtensionUtil.getExtensions(serviceTask, FieldType.class);
    assertThat(fieldTypeList).hasSize(3);
  }

  // utility classes ////////////////////////////////////////////////////

  private class CustomResourceSetListener extends AbstractEObjectChangeSupport {

    private List<ResourceSetChangeEvent> capturedEvents = new ArrayList<ResourceSetChangeEvent>();

    public CustomResourceSetListener(EObject object, NotificationFilter filter) {
      super(object);

      this.filter = filter;
    }

    @Override
    public void resourceSetChanged(ResourceSetChangeEvent event) {
      capturedEvents.add(event);
    }

    /**
     * Return a list of previously captured events
     *
     * @return
     */
    public List<ResourceSetChangeEvent> getCapturedEvents() {
      return capturedEvents;
    }

    /** Clear captured events */
    public void clearCapturedEvents() {
      capturedEvents.clear();
    }
  }

  /** We want to use the model extensions */
  protected Bpmn2ResourceImpl createBpmn2Resource(URI uri) {
    return (Bpmn2ResourceImpl) new ModelResourceFactoryImpl().createResource(uri);
  }
}