protected void testQuery() {
    try {
      // ClassArrayShell whether model is null
      if (sqlPredicate == null) {
        MessageDialog.openWarning(top.getShell(), "Warning!", "The predicate is null");
        //		return;
      }
      // ClassArrayShell whether there is a name
      if (textName.getText() == null || textName.getText().trim().length() == 0) {
        MessageDialog.openWarning(top.getShell(), "Warning!", "The predicate should have a name");
        //		return;
      }
      // ClassArrayShell whether there is a data source
      if (sqlPredicate.getDataSource() == null) {
        MessageDialog.openWarning(top.getShell(), "Warning!", "There is no datasource set");
        //		return;
      }

      // ClassArrayShell SQL
      DataSource ds = sqlPredicate.getDataSource();
      Connection con = ds.getConnection();
      java.sql.Statement stmt = con.createStatement();
      final ResultSet rs = stmt.executeQuery(sqlPredicate.getQuery());

      QueryResultsDialog dialog = new QueryResultsDialog(getSite().getShell(), sqlPredicate, rs);
      dialog.create();
      if (dialog.open() != InputDialog.OK) return;
    } catch (Exception x) {
      MessageDialog.openError(top.getShell(), "Error!", "Test has failed");
    }
  }
  /**
   * set a model to apply content to user interface.
   *
   * @param p a object
   */
  public void setModel(Object p) {

    sqlPredicate = ((SQLPredicate) ((TreeObject) p).getUserObject());
    treeObject = (TreeObject) p;
    textName.setText(sqlPredicate.getName() == null ? "" : sqlPredicate.getName());
    textQuery.setText(sqlPredicate.getQuery() == null ? "" : sqlPredicate.getQuery());

    // set the data sources
    DataSource ds = sqlPredicate.getDataSource() == null ? null : sqlPredicate.getDataSource();

    if (ds != null && !dataSources.contains(ds)) dataSources.add(ds);
    setDataSources(repositoryTreeView.kbplus.repository.getDataSources());
    //		displayDataSources();
    labelCurrentDS.setText(ds.toString());

    textClass.setEnabled(false);
    buttonBrowse.setEnabled(false);
    if (sqlPredicate.getTypeMapping() != null) {
      textClass.setData(sqlPredicate.getTypeMapping().getClass());
      textClass.setText(sqlPredicate.getTypeMapping().getClass().toString());
      if (sqlPredicate.getTypeMapping().getClass() == DefaultTypeMapping.class) {
        rbDefault.setSelection(true);
        rbMeta.setSelection(false);
        rbCustom.setSelection(false);
      } else {
        rbCustom.setSelection(true);
        rbDefault.setSelection(false);
        rbMeta.setSelection(false);
        textClass.setEnabled(true);
        buttonBrowse.setEnabled(true);
      }
    } else {
      textClass.setData(null);
      textClass.setText("");
      rbMeta.setSelection(true);
      rbDefault.setSelection(false);
      rbCustom.setSelection(false);
    }
  }