public boolean open() {
    super.open("DataOrganizer", MyDialog.FLAGS_MODAL_DIALOG);

    if (ok) {
      File config =
          new File(
              net.lecousin.framework.application.Application.deployPath, "recentWorkspaces.xml");
      XmlWriter xml = new XmlWriter();
      xml.openTag("dataorganizer_workpsaces");
      xml.openTag("workspace")
          .addAttribute("location", selectedDir)
          .addAttribute("language", selectedLang)
          .closeTag();
      for (Pair<String, Integer> p : recent) {
        if (p.getValue1().equals(selectedDir)) continue;
        xml.openTag("workspace")
            .addAttribute("location", p.getValue1())
            .addAttribute("language", p.getValue2())
            .closeTag();
      }
      xml.closeTag();
      try {
        xml.writeToFile(config.getAbsolutePath());
      } catch (IOException e) {
        // skip
      }
    }

    return ok;
  }
  @Override
  protected Composite createControl(Composite container) {
    container.setBackground(ColorUtil.getWhite());
    Composite panel = UIUtil.newGridComposite(container, 0, 0, 1);

    int lang = recent.get(0).getValue2();
    Composite header = UIUtil.newGridComposite(panel, 2, 2, 2);
    UIUtil.gridDataHorizFill(header);
    UIUtil.newImage(header, EclipseImages.getImage(EclipsePlugin.ID, "cd-dvd.jpg"));
    text = new LCMLText(header, false, false);
    text.setText(_text[lang]);
    GridData gd = new GridData();
    gd.widthHint = 350;
    text.setLayoutData(gd);

    Composite body = UIUtil.newGridComposite(panel, 2, 2, 3);
    UIUtil.gridDataHorizFill(body);
    labelDataBase = UIUtil.newLabel(body, _database[lang]);
    comboDataBase = new Combo(body, SWT.DROP_DOWN);
    for (Pair<String, Integer> p : recent) comboDataBase.add(p.getValue1());
    comboDataBase.select(0);
    comboDataBase.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            refresh(true);
          }
        });
    comboDataBase.addModifyListener(
        new ModifyListener() {
          public void modifyText(ModifyEvent e) {
            refresh(true);
          }
        });
    comboDataBase.setLayoutData(UIUtil.gridDataHoriz(1, true));
    buttonBrowse =
        UIUtil.newButton(
            body,
            _browse[lang],
            new Listener<Object>() {
              public void fire(Object event) {
                DirectoryDialog dlg = new DirectoryDialog(getShell());
                String result = dlg.open();
                if (result != null) {
                  comboDataBase.setText(result);
                  refresh(true);
                }
              }
            },
            null);
    labelLanguage = UIUtil.newLabel(body, _language[lang]);
    comboLanguage = new Combo(body, SWT.DROP_DOWN | SWT.READ_ONLY);
    comboLanguage.add("English");
    comboLanguage.add("Français");
    comboLanguage.select(lang);
    comboLanguage.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            refresh(false);
          }
        });

    UIUtil.newSeparator(panel, true, true);

    Composite footer = UIUtil.newGridComposite(panel, 2, 2, 2, 40, 0);
    gd = new GridData();
    gd.horizontalAlignment = SWT.CENTER;
    footer.setLayoutData(gd);
    buttonOk = new Button(footer, SWT.PUSH);
    buttonOk.setText(_ok[lang]);
    buttonCancel = new Button(footer, SWT.PUSH);
    buttonCancel.setText(_cancel[lang]);
    buttonOk.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            selectedDir = comboDataBase.getText();
            if (selectedDir.length() == 0) return;
            selectedLang = comboLanguage.getSelectionIndex();
            if (selectedLang < 0) return;
            ok = true;
            close();
          }
        });
    buttonCancel.addSelectionListener(
        new SelectionListener() {
          public void widgetDefaultSelected(SelectionEvent e) {}

          public void widgetSelected(SelectionEvent e) {
            ok = false;
            close();
          }
        });

    return panel;
  }