private String[] getAvailableProperties(String value) {
    if (value == null || value.length() == 0) {
      return new String[0];
    }
    JSFPromptingProvider provider = new JSFPromptingProvider();

    XModel xModel = getXModel();
    if (xModel == null) {
      // lets create fake model, which can build properties for the value.
      IFile file = (IFile) properties.get("file"); // $NON-NLS-1$
      if (file != null) {
        XModelObject f = EclipseResourceUtil.createObjectForResource(file);
        if (f != null) {
          xModel = f.getModel();
        }
      }
    }
    if (xModel == null) {
      return new String[0];
    }

    return (String[]) provider.buildBeanProperties(xModel, value, null).toArray(new String[0]);
  }
    protected void add() {
      String[] ap = getAvailableProperties(data.getValue("value bean class")); // $NON-NLS-1$
      String[] sp = getSelectedProperties();
      Properties p = new Properties();
      Set<String> set1 = new HashSet<String>(), set2 = new TreeSet<String>();
      for (int i = 0; i < sp.length; i++) set1.add(sp[i]);
      for (int i = 0; i < ap.length; i++) if (!set1.contains(ap[i])) set2.add(ap[i]);
      String[][] vs = new String[set1.size() + set2.size()][2];
      int k = 0;
      for (String s : set1) {
        vs[k][0] = s;
        vs[k][1] = "no"; // "no" = selected //$NON-NLS-1$
        ++k;
      }
      for (String s : set2) {
        vs[k][0] = s;
        vs[k][1] = "yes"; // $NON-NLS-1$
        ++k;
      }

      p.put("data", vs); // $NON-NLS-1$
      SelectPropertiesWizard w = new SelectPropertiesWizard();
      p.setProperty("title", JsfUIMessages.DataTableWizardPage_BeanProperties); // $NON-NLS-1$
      w.setObject(p);
      int r = w.execute();
      if (r != 0) return;
      vs = (String[][]) p.get("data"); // $NON-NLS-1$
      List<String> list = new ArrayList<String>();
      for (int i = 0; i < vs.length; i++) {
        if (vs[i][1].equals("no")) { // $NON-NLS-1$
          list.add(vs[i][0]);
        }
      }
      sp = list.toArray(new String[0]);
      setSelectedProperties(sp);
    }
 private XModel getXModel() {
   IFile file = (IFile) properties.get("file"); // $NON-NLS-1$
   return file == null ? null : getXModel(file);
 }