r1896 - isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs
Author: chatellier Date: 2009-03-02 09:38:49 +0000 (Mon, 02 Mar 2009) New Revision: 1896 Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java Log: Ask for passphrase in a passwordField Modified: isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java =================================================================== --- isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2009-02-27 18:04:56 UTC (rev 1895) +++ isis-fish/trunk/src/main/java/fr/ifremer/isisfish/vcs/VCSSVN.java 2009-03-02 09:38:49 UTC (rev 1896) @@ -30,7 +30,9 @@ import java.util.Map; import java.util.Set; +import javax.swing.JLabel; import javax.swing.JOptionPane; +import javax.swing.JPasswordField; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; @@ -155,7 +157,7 @@ auth = new SSHSVNAuthenticationManager(login, sshKeyFile, null, 22); } else { - + // log for private key if (log.isWarnEnabled()) { log.warn("Cannot read ssh private key : " + sshKeyFile); @@ -382,22 +384,22 @@ */ @Override public void cleanup(File path) throws VCSException { - + File localFile = path; if (localFile == null) { localFile = getLocalRepository(); } - + SVNWCClient wcClient = getSVNManager().getWCClient(); try { wcClient.doCleanup(localFile); } catch (SVNException e) { throw new VCSException(_("isisfish.vcs.vcssvn.cleanup.error"), e); } - + } - + /** * {@inheritDoc} */ @@ -653,8 +655,8 @@ .getRemoteContentsStatus())) { File statusFile = status.getFile(); if (!statusFile.isDirectory() - || status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED || status - .getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { + || status.getRemoteContentsStatus() == SVNStatusType.STATUS_ADDED + || status.getRemoteContentsStatus() == SVNStatusType.STATUS_DELETED) { // on ne met pas les repertoires pere dans le status // car en fait ca veut dire qu'un fichier/rep dans ce // repertoire a ete ajout/modifier/delete, et on l'aura @@ -1232,6 +1234,7 @@ protected String userName; protected File keyFile; protected int portNumber; + protected JPasswordField passwordField; /** * Creates an auth manager given a user credential - a username and an ssh private key. @@ -1247,6 +1250,7 @@ this.userName = userName; this.keyFile = keyFile; this.portNumber = portNumber; + passwordField = new JPasswordField(); } /* @@ -1259,16 +1263,19 @@ SVNAuthentication auth = null; if (kind.equals(ISVNAuthenticationManager.SSH) && keyFile != null) { - - String passphrase = JOptionPane.showInputDialog(null, _( + + JLabel labelField = new JLabel(_( "isisfish.vcs.vcssvn.connection.message", keyFile - .getAbsolutePath()), _( + .getAbsolutePath())); + Object[] ob = { labelField, passwordField }; + int option = JOptionPane.showConfirmDialog(null, ob, _( "isisfish.vcs.vcssvn.connection.title", realm) - + url, JOptionPane.QUESTION_MESSAGE); + + url, JOptionPane.OK_CANCEL_OPTION, + JOptionPane.QUESTION_MESSAGE); - if (passphrase != null) { - auth = new SVNSSHAuthentication(userName, keyFile, passphrase, - portNumber, true); + if (option != JOptionPane.CANCEL_OPTION) { + auth = new SVNSSHAuthentication(userName, keyFile, new String( + passwordField.getPassword()), portNumber, true); } } else { auth = super.getNextAuthentication(kind, realm, url);
participants (1)
-
chatellierï¼ users.labs.libre-entreprise.org