public Object execute(ExecutionEvent event) throws ExecutionException {
NewUserWizard newUserWizard = new NewUserWizard();
+ newUserWizard.setWindowTitle("User creation");
WizardDialog dialog = new WizardDialog(
HandlerUtil.getActiveShell(event), newUserWizard);
dialog.open();
private Combo baseDnCmb;
public NewUserWizard() {
+
}
@Override
public void addPages() {
mainUserInfo = new MainUserInfoWizardPage();
addPage(mainUserInfo);
- String message = "Dummy wizard to ease user creation tests:\n Mail and last name are automatically "
+ String message = "Default wizard that also eases user creation tests:\n "
+ + "Mail and last name are automatically "
+ "generated form the uid. Password are defauted to 'demo'.";
mainUserInfo.setMessage(message, WizardPage.WARNING);
}
"Distinguished name", this);
dNameTxt.setEnabled(false);
- baseDnCmb = createGridLC(composite, "Base DN", this);
+ baseDnCmb = createGridLC(composite, "Base DN");
initialiseDnCmb(baseDnCmb);
+ baseDnCmb.addModifyListener(this);
baseDnCmb.addModifyListener(new ModifyListener() {
private static final long serialVersionUID = -1435351236582736843L;
public void setVisible(boolean visible) {
super.setVisible(visible);
if (visible)
- usernameTxt.setFocus();
+ if (baseDnCmb.getSelectionIndex() == -1)
+ baseDnCmb.setFocus();
+ else
+ usernameTxt.setFocus();
}
public String getUsername() {
throw new ArgeoException(
"No writable base dn found. Cannot create user");
combo.setItems(dns.toArray(new String[0]));
- // combo.select(0);
+ if (dns.size() == 1)
+ combo.select(0);
}
private String getMail(String username) {
+ username + " with base dn " + baseDn, e);
}
}
-
}
- private Combo createGridLC(Composite parent, String label,
- ModifyListener modifyListener) {
+ private Combo createGridLC(Composite parent, String label) {
Label lbl = new Label(parent, SWT.LEAD);
lbl.setText(label);
lbl.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
Combo combo = new Combo(parent, SWT.LEAD | SWT.BORDER | SWT.READ_ONLY);
combo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
- if (modifyListener != null)
- combo.addModifyListener(modifyListener);
return combo;
}