Changeset 4245 in josm for trunk/src/org/openstreetmap/josm/gui/preferences/server
- Timestamp:
- 2011-07-14T19:52:24+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/preferences/server
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java
r3530 r4245 20 20 import org.openstreetmap.josm.gui.help.HelpUtil; 21 21 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 22 import org.openstreetmap.josm.io.auth.CredentialsManager Factory;22 import org.openstreetmap.josm.io.auth.CredentialsManager; 23 23 24 24 /** … … 124 124 pnlBasicAuthPreferences.saveToPreferences(); 125 125 OAuthAccessTokenHolder.getInstance().clear(); 126 OAuthAccessTokenHolder.getInstance().save(Main.pref, CredentialsManager Factory.getCredentialManager());126 OAuthAccessTokenHolder.getInstance().save(Main.pref, CredentialsManager.getInstance()); 127 127 } else if (authMethod.equals("oauth")) { 128 128 // clear the password in the preferences -
trunk/src/org/openstreetmap/josm/gui/preferences/server/BasicAuthenticationPreferencesPanel.java
r3530 r4245 20 20 import org.openstreetmap.josm.gui.widgets.HtmlPanel; 21 21 import org.openstreetmap.josm.gui.widgets.SelectAllOnFocusGainedDecorator; 22 import org.openstreetmap.josm.io.auth.CredentialsAgent; 23 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 22 24 import org.openstreetmap.josm.io.auth.CredentialsManager; 23 import org.openstreetmap.josm.io.auth.CredentialsManagerException; 24 import org.openstreetmap.josm.io.auth.CredentialsManagerFactory; 25 import org.openstreetmap.josm.io.auth.JosmPreferencesCredentialManager; 25 import org.openstreetmap.josm.io.auth.JosmPreferencesCredentialAgent; 26 26 27 27 /** … … 103 103 104 104 public void initFromPreferences() { 105 Credentials Manager cm = CredentialsManagerFactory.getCredentialManager();105 CredentialsAgent cm = CredentialsManager.getInstance(); 106 106 try { 107 107 PasswordAuthentication pa = cm.lookup(RequestorType.SERVER); … … 113 113 tfOsmPassword.setText(pa.getPassword() == null ? "" : String.valueOf(pa.getPassword())); 114 114 } 115 } catch(Credentials ManagerException e) {115 } catch(CredentialsAgentException e) { 116 116 e.printStackTrace(); 117 117 System.err.println(tr("Warning: failed to retrieve OSM credentials from credential manager.")); … … 123 123 124 124 public void saveToPreferences() { 125 Credentials Manager cm = CredentialsManagerFactory.getCredentialManager();125 CredentialsAgent cm = CredentialsManager.getInstance(); 126 126 try { 127 127 PasswordAuthentication pa = new PasswordAuthentication( … … 132 132 // always save the username to the preferences if it isn't already saved there 133 133 // by the credential manager 134 if (! (cm instanceof JosmPreferencesCredential Manager)) {134 if (! (cm instanceof JosmPreferencesCredentialAgent)) { 135 135 Main.pref.put("osm-server.username", tfOsmUserName.getText().trim()); 136 136 } 137 } catch(Credentials ManagerException e) {137 } catch(CredentialsAgentException e) { 138 138 e.printStackTrace(); 139 139 System.err.println(tr("Warning: failed to save OSM credentials to credential manager.")); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAccessTokenHolder.java
r4191 r4245 6 6 import org.openstreetmap.josm.data.Preferences; 7 7 import org.openstreetmap.josm.data.oauth.OAuthToken; 8 import org.openstreetmap.josm.io.auth.Credentials Manager;9 import org.openstreetmap.josm.io.auth.Credentials ManagerException;8 import org.openstreetmap.josm.io.auth.CredentialsAgent; 9 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 10 10 import org.openstreetmap.josm.tools.CheckParameterUtil; 11 11 … … 136 136 * @throws IllegalArgumentException thrown if cm is null 137 137 */ 138 public void init(Preferences pref, Credentials Managercm) throws IllegalArgumentException {138 public void init(Preferences pref, CredentialsAgent cm) throws IllegalArgumentException { 139 139 CheckParameterUtil.ensureParameterNotNull(pref, "pref"); 140 140 CheckParameterUtil.ensureParameterNotNull(cm, "cm"); … … 142 142 try { 143 143 token = cm.lookupOAuthAccessToken(); 144 } catch(Credentials ManagerException e) {144 } catch(CredentialsAgentException e) { 145 145 e.printStackTrace(); 146 146 System.err.println(tr("Warning: Failed to retrieve OAuth Access Token from credential manager")); … … 163 163 * @throws IllegalArgumentException thrown if cm is null 164 164 */ 165 public void save(Preferences preferences, Credentials Managercm) throws IllegalArgumentException {165 public void save(Preferences preferences, CredentialsAgent cm) throws IllegalArgumentException { 166 166 CheckParameterUtil.ensureParameterNotNull(preferences, "preferences"); 167 167 CheckParameterUtil.ensureParameterNotNull(cm, "cm"); … … 173 173 cm.storeOAuthAccessToken(new OAuthToken(accessTokenKey, accessTokenSecret)); 174 174 } 175 } catch(Credentials ManagerException e){175 } catch(CredentialsAgentException e){ 176 176 e.printStackTrace(); 177 177 System.err.println(tr("Warning: Failed to store OAuth Access Token to credentials manager")); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r4191 r4245 32 32 import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard; 33 33 import org.openstreetmap.josm.gui.oauth.TestAccessTokenTask; 34 import org.openstreetmap.josm.io.auth.CredentialsManager Factory;34 import org.openstreetmap.josm.io.auth.CredentialsManager; 35 35 import org.openstreetmap.josm.tools.ImageProvider; 36 36 … … 161 161 public void saveToPreferences() { 162 162 OAuthAccessTokenHolder.getInstance().setSaveToPreferences(cbSaveToPreferences.isSelected()); 163 OAuthAccessTokenHolder.getInstance().save(Main.pref, CredentialsManager Factory.getCredentialManager());163 OAuthAccessTokenHolder.getInstance().save(Main.pref, CredentialsManager.getInstance()); 164 164 pnlAdvancedProperties.getAdvancedParameters().saveToPreferences(Main.pref); 165 165 } -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ProxyPreferencesPanel.java
r3530 r4245 31 31 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; 32 32 import org.openstreetmap.josm.io.DefaultProxySelector; 33 import org.openstreetmap.josm.io.auth.CredentialsAgent; 34 import org.openstreetmap.josm.io.auth.CredentialsAgentException; 33 35 import org.openstreetmap.josm.io.auth.CredentialsManager; 34 import org.openstreetmap.josm.io.auth.CredentialsManagerException;35 import org.openstreetmap.josm.io.auth.CredentialsManagerFactory;36 36 import org.openstreetmap.josm.tools.GBC; 37 37 … … 321 321 // save the proxy user and the proxy password to a credentials store managed by 322 322 // the credentials manager 323 Credentials Manager cm = CredentialsManagerFactory.getCredentialManager();323 CredentialsAgent cm = CredentialsManager.getInstance(); 324 324 try { 325 325 PasswordAuthentication pa = cm.lookup(RequestorType.PROXY); … … 331 331 tfProxyHttpPassword.setText(pa.getPassword() == null ? "" : String.valueOf(pa.getPassword())); 332 332 } 333 } catch(Credentials ManagerException e) {333 } catch(CredentialsAgentException e) { 334 334 e.printStackTrace(); 335 335 tfProxyHttpUser.setText(""); … … 395 395 } 396 396 397 Credentials Manager cm = CredentialsManagerFactory.getCredentialManager();397 CredentialsAgent cm = CredentialsManager.getInstance(); 398 398 try { 399 399 PasswordAuthentication pa = new PasswordAuthentication( … … 402 402 ); 403 403 cm.store(RequestorType.PROXY, pa); 404 } catch(Credentials ManagerException e) {404 } catch(CredentialsAgentException e) { 405 405 e.printStackTrace(); 406 406 }
Note:
See TracChangeset
for help on using the changeset viewer.