public static String editPasswd(Display display,
				  final Map<String,String> m,
				  final String name)
  {
    final Shell shell = new Shell(display);
    shell.setText ("Edit password");
    shell.setLayout (new FormLayout());
    
    hack_string = null;

    Control tname;
    final Text tname_text;
    if (name == null) {
      tname = tname_text = new Text(shell, SWT.BORDER);
      tname_text.setText("name");
    } else {
      Label lab  = new Label(shell, 0);
      tname      = lab;
      tname_text = null;
      lab.setText(name);
    }
    FormData layname = new FormData();
    layname.left     = new FormAttachment(0,  0);
    //layname.top      = new FormAttachment(0,  0);
    layname.right    = new FormAttachment(100,0);
    tname.setLayoutData(layname);

    /* password field[s] and show button */
    final Text tpass  = new Text(shell, SWT.BORDER | SWT.PASSWORD);
    final Text tpass2 = new Text(shell, SWT.BORDER);
    if (name != null) {
      String s = m.get(name);
      if (s != null) {
	tpass.setText(s);
	tpass2.setText(s);
      }
    }
    final Button bshow = new Button(shell, SWT.CHECK);
    bshow.setText("show");
    FormData layshow   = new FormData();
    layshow.top        = new FormAttachment(tname, 0);
    layshow.right      = new FormAttachment(100,0);
    bshow.setLayoutData(layshow);

    FormData laypass  = new FormData();
    laypass.left      = new FormAttachment(0,  0);
    laypass.top       = new FormAttachment(tname, 0);
    laypass.right     = new FormAttachment(bshow,0);
    tpass.setLayoutData(laypass);
    tpass2.setLayoutData(laypass);
    tpass2.setVisible(false);

    bshow.addListener(SWT.Selection, new Listener() {
	boolean oldb = false;
	public void handleEvent (Event e) {
	  boolean b = bshow.getSelection();
	  if (oldb != b) {
	    if (b) {
	      tpass2.setText(tpass.getText());
	    } else {
	      tpass.setText(tpass2.getText());
	    }
	    tpass.setVisible(!b);
	    tpass2.setVisible(b);
	  }
	  oldb = b;
	}
      });

    /* OK and Cancel buttons */
    Button bcanc = new Button(shell, SWT.PUSH);
    bcanc.setText("Cancel");
    FormData laycanc  = new FormData();
    laycanc.left      = new FormAttachment(0,     0);
    laycanc.top       = new FormAttachment(tpass, 0);
    laycanc.right     = new FormAttachment(50,    0);
    bcanc.setLayoutData(laycanc);
    bcanc.addListener(SWT.Selection, new Listener () {
	public void handleEvent (Event e) {
	  shell.dispose();
	}});

    Button bok = new Button(shell, SWT.PUSH);
    bok.setText("OK");
    FormData layok  = new FormData();
    layok.left      = new FormAttachment(50,    0);
    layok.top       = new FormAttachment(tpass, 0);
    layok.right     = new FormAttachment(100,   0);
    bok.setLayoutData(layok);
    bok.addListener(SWT.Selection, new Listener () {
	public void handleEvent (Event e) {
	  String key = hack_string = (name != null)
	    ? name
	    : tname_text.getText();
	  String value = (bshow.getSelection() ? tpass2 : tpass).getText();
	  m.put(key,value);
	  shell.dispose();
	}});

    shell.setDefaultButton(bcanc);

    /* go */
    // shell.setSize(200, 100);
    shell.pack ();
    Point p = shell.getSize();
    p.x = 200;
    shell.setSize(p);

    shell.open();
    while (!shell.isDisposed ()) {
      if (!display.readAndDispatch ()) display.sleep ();
    }

    return hack_string;
  }