private TableItem bindPublishEventAttribute(PublishEventMediatorAttribute attribute) {
    TableItem item = new TableItem(publishEventAttributeTable, SWT.NONE);
    if (attribute
        .getAttributeValueType()
        .getLiteral()
        .equals(AttributeValueType.STRING.getLiteral())) {
      item.setText(
          new String[] {
            attribute.getAttributeName(),
            attribute.getAttributeValue(),
            attribute.getAttributeValueType().getLiteral()
          });
    }
    if (attribute
        .getAttributeValueType()
        .getLiteral()
        .equals(AttributeValueType.EXPRESSION.getLiteral())) {
      item.setText(
          new String[] {
            attribute.getAttributeName(),
            attribute.getAttributeExpression().getPropertyValue(),
            attribute.getAttributeValueType().getLiteral()
          });
      item.setData(
          EXPRESSION_DATA,
          EsbFactory.eINSTANCE.copyNamespacedProperty(attribute.getAttributeExpression()));
    }

    item.setData(attribute);
    return item;
  }
  private void editItem(final TableItem item) {
    NamespacedProperty expression =
        ((PublishEventMediatorAttributeImpl) item.getData()).getAttributeExpression();

    // value type table editor
    valueTypeEditor = initTableEditor(valueTypeEditor, item.getParent());
    cmbValueType = new Combo(item.getParent(), SWT.READ_ONLY);
    cmbValueType.setItems(
        new String[] {
          AttributeValueType.STRING.getLiteral(), AttributeValueType.EXPRESSION.getLiteral()
        });
    cmbValueType.setText(item.getText(2));
    valueTypeEditor.setEditor(cmbValueType, item, 2);

    item.getParent().redraw();
    item.getParent().layout();
    cmbValueType.addListener(
        SWT.Selection,
        new Listener() {
          public void handleEvent(Event evt) {
            item.setText(2, cmbValueType.getText());
          }
        });

    attributeValueEditor = initTableEditor(attributeValueEditor, item.getParent());
    attributeValue = new PropertyText(item.getParent(), SWT.NONE, cmbValueType);
    attributeValue.addProperties(item.getText(1), expression);
    attributeValueEditor.setEditor(attributeValue, item, 1);
    item.getParent().redraw();
    item.getParent().layout();
    attributeValue.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            item.setText(1, attributeValue.getText());
            Object property = attributeValue.getProperty();
            if (property instanceof NamespacedProperty) {
              item.setData(EXPRESSION_DATA, (NamespacedProperty) property);
            }
          }
        });
  }
  protected void okPressed() {

    for (TableItem item : publishEventAttributeTable.getItems()) {
      PublishEventMediatorAttribute attribute = (PublishEventMediatorAttribute) item.getData();
      NamespacedProperty expression =
          ((PublishEventMediatorAttributeImpl) item.getData()).getAttributeExpression();

      // If the attribute is a new one, add it to the model.
      if (null == attribute.eContainer()) {
        // Update the publishEvent attribute with the latest data from
        // table row.
        attribute.setAttributeName(item.getText(0));

        if (item.getText(2).equals(AttributeValueType.STRING.getLiteral())) {
          attribute.setAttributeValueType(AttributeValueType.STRING);
          attribute.setAttributeValue(item.getText(1));
        }

        if (item.getText(2).equals(AttributeValueType.EXPRESSION.getLiteral())) {
          attribute.setAttributeValueType(AttributeValueType.EXPRESSION);
          NamespacedProperty namespaceProperty =
              EsbFactoryImpl.eINSTANCE.createNamespacedProperty();
          namespaceProperty.setPropertyValue(item.getText(1));
          namespaceProperty.setNamespaces(expression.getNamespaces());
          attribute.setAttributeExpression(namespaceProperty);
        }

        // Record the add operation.
        AddCommand addCmd = null;
        if (attributeCategory.equals(PUBLISH_EVENT_META_CATEGORY)) {
          addCmd =
              new AddCommand(
                  editingDomain,
                  publishEventMediator,
                  EsbPackage.Literals.PUBLISH_EVENT_MEDIATOR__META_ATTRIBUTES,
                  attribute);
        }
        if (attributeCategory.equals(PUBLISH_EVENT_CORRELATION_CATEGORY)) {
          addCmd =
              new AddCommand(
                  editingDomain,
                  publishEventMediator,
                  EsbPackage.Literals.PUBLISH_EVENT_MEDIATOR__CORRELATION_ATTRIBUTES,
                  attribute);
        }
        if (attributeCategory.equals(PUBLISH_EVENT_PAYLOAD_CATEGORY)) {
          addCmd =
              new AddCommand(
                  editingDomain,
                  publishEventMediator,
                  EsbPackage.Literals.PUBLISH_EVENT_MEDIATOR__PAYLOAD_ATTRIBUTES,
                  attribute);
        }
        if (attributeCategory.equals(PUBLISH_EVENT_ARBITRARY_CATEGORY)) {
          addCmd =
              new AddCommand(
                  editingDomain,
                  publishEventMediator,
                  EsbPackage.Literals.PUBLISH_EVENT_MEDIATOR__ARBITRARY_ATTRIBUTES,
                  attribute);
        }
        getResultCommand().append(addCmd);
      }
    }

    // Apply changes.
    if (getResultCommand().canExecute()) {
      editingDomain.getCommandStack().execute(getResultCommand());
    }

    super.okPressed();
  }