private Text uri;
private Text username;
private Text password;
+ private Button saveInKeyring;
public RemoteRepositoryLoginDialog(Shell parentShell) {
super(parentShell);
"http://localhost:7070/org.argeo.jcr.webapp/remoting/node");
username = createLT(composite, "User", "");
password = createLP(composite, "Password");
+
+ saveInKeyring = createLC(composite, "Remember password", false);
parent.pack();
return composite;
}
try {
Session nodeSession = keyring.getSession();
Node home = JcrUtils.getUserHome(nodeSession);
+
+ // FIXME better deal with non existing home dir
+ if (home == null)
+ home = JcrUtils.createUserHomeIfNeeded(nodeSession,
+ nodeSession.getUserID());
+
Node remote = home.hasNode(ARGEO_REMOTE) ? home
.getNode(ARGEO_REMOTE) : home.addNode(ARGEO_REMOTE);
if (remote.hasNode(name.getText()))
remoteRepository.setProperty(ARGEO_URI, uri.getText());
remoteRepository.setProperty(ARGEO_USER_ID, username.getText());
Node pwd = remoteRepository.addNode(ARGEO_PASSWORD);
- keyring.set(pwd.getPath(), password.getText().toCharArray());
- nodeSession.save();
+ pwd.getSession().save();
+ if (saveInKeyring.getSelection())
+ keyring.set(pwd.getPath(), password.getText().toCharArray());
+ keyring.getSession().save();
MessageDialog.openInformation(
getParentShell(),
"Repository Added",
"Remote repository '" + username.getText() + "@"
+ uri.getText() + "' added");
+
super.okPressed();
} catch (Exception e) {
ErrorFeedback.show("Cannot add remote repository", e);
return text;
}
+ /** Creates label and check. */
+ protected Button createLC(Composite parent, String label,
+ Boolean initial) {
+ new Label(parent, SWT.NONE).setText(label);
+ Button check = new Button(parent, SWT.CHECK);
+ check.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ check.setSelection(initial);
+ return check;
+ }
+
protected Text createLP(Composite parent, String label) {
new Label(parent, SWT.NONE).setText(label);
Text text = new Text(parent, SWT.SINGLE | SWT.LEAD | SWT.BORDER