protected void okPressed() {
    boolean hasErrors = popupValidationErrorDialogIfNecessary();

    if (!hasErrors) {
      try {
        conceptUtil.setId(wId.getText());
      } catch (ObjectAlreadyExistsException e) {
        if (logger.isErrorEnabled()) {
          logger.error("an exception occurred", e);
        }
        MessageDialog.openError(
            getShell(),
            Messages.getString("General.USER_TITLE_ERROR"),
            Messages.getString(
                "PhysicalTableDialog.USER_ERROR_PHYSICAL_TABLE_ID_EXISTS", wId.getText()));
        return;
      }

      // attempt to set the connection
      IStructuredSelection selection = (IStructuredSelection) comboViewer.getSelection();
      DatabaseMeta con = (DatabaseMeta) selection.getFirstElement();
      BusinessModel busModel = (BusinessModel) conceptUtil;
      if (!DUMMY_CON_NAME.equals(con.getName())) {
        busModel.setConnection((DatabaseMeta) con);
      } else {
        busModel.clearConnection();
      }

      super.okPressed();
    }
  }
  @SuppressWarnings("deprecation")
  public void addColumn(final LogicalColumn column, final Element tableNode, final String locale) {
    Element columnNode = tableNode.addElement("column"); // $NON-NLS-1$

    if (column.getId() != null) {
      columnNode.addElement("column_id").setText(column.getId()); // $NON-NLS-1$
    }
    if (column.getName(locale) != null) {
      columnNode.addElement("column_name").setText(column.getName(locale)); // $NON-NLS-1$
    }
    if (column.getDescription(locale) != null) {
      columnNode
          .addElement("column_description")
          .setText(column.getDescription(locale)); // $NON-NLS-1$
    }
    if (column.getFieldType() != null) {
      // TODO this should take a locale
      String desc = column.getFieldType().getDescription();
      desc = org.pentaho.pms.messages.Messages.getString(desc);
      columnNode.addElement("column_field_type").setText(desc); // $NON-NLS-1$
    }
    DataType dataType = column.getDataType();
    if (dataType != null) {
      columnNode.addElement("column_type").setText(dataType.getName()); // $NON-NLS-1$
    }
    if (column.getProperty("lookup") != null) { // $NON-NLS-1$
      columnNode.addElement("column_lookup").setText("true"); // $NON-NLS-1$ //$NON-NLS-2$
    }
  }
  protected Control createTop(final Composite parent) {
    Composite c0 = new Composite(parent, SWT.NONE);
    c0.setLayout(new FormLayout());

    Label wlId = new Label(c0, SWT.RIGHT);
    wlId.setText(Messages.getString("PhysicalTableDialog.USER_NAME_ID")); // $NON-NLS-1$
    wId = new Text(c0, SWT.SINGLE | SWT.LEFT | SWT.BORDER);

    FormData fdlId = new FormData();
    fdlId.left = new FormAttachment(0, 0);

    fdlId.top = new FormAttachment(wId, 0, SWT.CENTER);
    wlId.setLayoutData(fdlId);

    Label conLabel = new Label(c0, SWT.RIGHT);
    conLabel.setText("Connection:");

    conField = new Combo(c0, SWT.BORDER | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);

    comboViewer = new ComboViewer(conField);

    comboViewer.setContentProvider(
        new IStructuredContentProvider() {
          public Object[] getElements(final Object inputElement) {
            List ul = (List) inputElement;
            return ul.toArray();
          }

          public void dispose() {
            if (logger.isDebugEnabled()) {
              logger.debug("Disposing ...");
            }
          }

          public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
            if (logger.isDebugEnabled()) {
              logger.debug("Input changed: old=" + oldInput + ", new=" + newInput);
            }
          }
        });

    List<Object> list2 = new ArrayList<Object>();
    list2.add(dummyConInstance);
    list2.addAll(schemaMeta.getDatabases().getList());

    comboViewer.setInput(list2);

    comboViewer.setLabelProvider(
        new LabelProvider() {
          public Image getImage(Object element) {
            return null;
          }

          public String getText(Object element) {
            DatabaseMeta meta = (DatabaseMeta) element;
            if (DUMMY_CON_NAME.equals(meta.getName())) {
              return "";
            } else {
              return ((DatabaseMeta) element).getName();
            }
          }
        });

    BusinessModel busModel = (BusinessModel) conceptUtil;
    if (null != busModel.getConnection()) {
      comboViewer.setSelection(new StructuredSelection(busModel.getConnection()));
    } else {
      comboViewer.setSelection(new StructuredSelection(dummyConInstance));
    }

    FormData fdId = new FormData();
    fdId.left = new FormAttachment(wlId, 10);
    fdId.top = new FormAttachment(0, 0);
    fdId.right = new FormAttachment(conLabel, -10);
    wId.setLayoutData(fdId);

    FormData fdConLabel = new FormData();
    fdConLabel.left = new FormAttachment(50, 0);
    fdConLabel.top = new FormAttachment(conField, 0, SWT.CENTER);
    conLabel.setLayoutData(fdConLabel);

    FormData fdConField = new FormData();
    fdConField.left = new FormAttachment(conLabel, 10);
    fdConField.top = new FormAttachment(0, 0);
    fdConField.right = new FormAttachment(100, 0);
    conField.setLayoutData(fdConField);

    if (conceptUtil.getId() != null) {
      wId.setText(conceptUtil.getId());
      wId.selectAll();
    }
    return c0;
  }