Changeset 2861 in josm for trunk/src/org
- Timestamp:
- 2010-01-15T10:44:16+01:00 (15 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 5 edited
- 9 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/oauth/AbstractAuthorizationUI.java
r2858 r2861 13 13 * 14 14 */ 15 public abstract class AbstractAuthori sationUI extends VerticallyScrollablePanel{15 public abstract class AbstractAuthorizationUI extends VerticallyScrollablePanel{ 16 16 /** 17 17 * The property name for the Access Token property 18 18 */ 19 static public final String ACCESS_TOKEN_PROP = AbstractAuthori sationUI.class.getName() + ".accessToken";19 static public final String ACCESS_TOKEN_PROP = AbstractAuthorizationUI.class.getName() + ".accessToken"; 20 20 21 21 private String apiUrl; … … 27 27 } 28 28 29 public AbstractAuthori sationUI() {29 public AbstractAuthorizationUI() { 30 30 pnlAdvancedProperties = new AdvancedOAuthPropertiesPanel(); 31 31 } -
trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedure.java
r2858 r2861 2 2 package org.openstreetmap.josm.gui.oauth; 3 3 4 public enum Authori sationProcedure {4 public enum AuthorizationProcedure { 5 5 /** 6 6 * Run a fully automatic procedure to get an access token from the OSM website. -
trunk/src/org/openstreetmap/josm/gui/oauth/AuthorizationProcedureComboBox.java
r2858 r2861 13 13 import javax.swing.UIManager; 14 14 15 public class Authori sationProcedureComboBox extends JComboBox {15 public class AuthorizationProcedureComboBox extends JComboBox { 16 16 17 public Authori sationProcedureComboBox() {17 public AuthorizationProcedureComboBox() { 18 18 setModel(new AuthorisationProcedureComboBoxModel()); 19 19 setRenderer(new AuthorisationProcedureCellRenderer()); 20 setSelectedItem(Authori sationProcedure.FULLY_AUTOMATIC);20 setSelectedItem(AuthorizationProcedure.FULLY_AUTOMATIC); 21 21 } 22 22 … … 25 25 public Object getElementAt(int index) { 26 26 switch(index) { 27 case 0: return Authori sationProcedure.FULLY_AUTOMATIC;28 case 1: return Authori sationProcedure.SEMI_AUTOMATIC;29 case 2: return Authori sationProcedure.MANUALLY;27 case 0: return AuthorizationProcedure.FULLY_AUTOMATIC; 28 case 1: return AuthorizationProcedure.SEMI_AUTOMATIC; 29 case 2: return AuthorizationProcedure.MANUALLY; 30 30 } 31 31 return null; … … 53 53 } 54 54 55 protected void renderText(Authori sationProcedure value) {55 protected void renderText(AuthorizationProcedure value) { 56 56 switch(value) { 57 57 case FULLY_AUTOMATIC: … … 67 67 } 68 68 69 protected void renderToolTipText(Authori sationProcedure value) {69 protected void renderToolTipText(AuthorizationProcedure value) { 70 70 switch(value) { 71 71 case FULLY_AUTOMATIC: … … 94 94 95 95 public Component getListCellRendererComponent(JList list, Object value, int idx, boolean isSelected, boolean hasFocus) { 96 Authori sationProcedure procedure = (AuthorisationProcedure)value;96 AuthorizationProcedure procedure = (AuthorizationProcedure)value; 97 97 renderColors(isSelected); 98 98 renderText(procedure); -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
r2858 r2861 54 54 * 55 55 */ 56 public class FullyAutomaticAuthori sationUI extends AbstractAuthorisationUI {56 public class FullyAutomaticAuthorizationUI extends AbstractAuthorizationUI { 57 57 58 58 private JTextField tfUserName; … … 311 311 } 312 312 313 public FullyAutomaticAuthori sationUI() {313 public FullyAutomaticAuthorizationUI() { 314 314 build(); 315 315 } … … 338 338 339 339 public void actionPerformed(ActionEvent evt) { 340 Main.worker.submit(new FullyAutomaticAuthorisationTask(FullyAutomaticAuthori sationUI.this));340 Main.worker.submit(new FullyAutomaticAuthorisationTask(FullyAutomaticAuthorizationUI.this)); 341 341 } 342 342 … … 385 385 public void actionPerformed(ActionEvent arg0) { 386 386 Main.worker.submit(new TestAccessTokenTask( 387 FullyAutomaticAuthori sationUI.this,387 FullyAutomaticAuthorizationUI.this, 388 388 getApiUrl(), 389 389 getAdvancedPropertiesPanel().getAdvancedParameters(), … … 437 437 class FullyAutomaticAuthorisationTask extends PleaseWaitRunnable { 438 438 private boolean canceled; 439 private OsmOAuthAuthori sationClient authClient;439 private OsmOAuthAuthorizationClient authClient; 440 440 441 441 public FullyAutomaticAuthorisationTask(Component parent) { … … 451 451 protected void finish() {} 452 452 453 protected void alertAuthorisationFailed(OsmOAuthAuthori sationException e) {453 protected void alertAuthorisationFailed(OsmOAuthAuthorizationException e) { 454 454 HelpAwareOptionPane.showOptionDialog( 455 FullyAutomaticAuthori sationUI.this,455 FullyAutomaticAuthorizationUI.this, 456 456 tr("<html>" 457 457 + "The automatic process for retrieving an OAuth Access Token<br>" … … 469 469 protected void alertInvalidLoginUrl() { 470 470 HelpAwareOptionPane.showOptionDialog( 471 FullyAutomaticAuthori sationUI.this,471 FullyAutomaticAuthorizationUI.this, 472 472 tr("<html>" 473 473 + "The automatic process for retrieving an OAuth Access Token<br>" … … 488 488 try { 489 489 loginUrl = authClient.buildOsmLoginUrl(); 490 } catch(OsmOAuthAuthori sationException e1) {490 } catch(OsmOAuthAuthorizationException e1) { 491 491 alertInvalidLoginUrl(); 492 492 return; 493 493 } 494 494 HelpAwareOptionPane.showOptionDialog( 495 FullyAutomaticAuthori sationUI.this,495 FullyAutomaticAuthorizationUI.this, 496 496 tr("<html>" 497 497 + "The automatic process for retrieving an OAuth Access Token<br>" … … 509 509 } 510 510 511 protected void handleException(final OsmOAuthAuthori sationException e) {511 protected void handleException(final OsmOAuthAuthorizationException e) { 512 512 Runnable r = new Runnable() { 513 513 public void run() { … … 531 531 try { 532 532 getProgressMonitor().setTicksCount(3); 533 authClient = new OsmOAuthAuthori sationClient(533 authClient = new OsmOAuthAuthorizationClient( 534 534 getAdvancedPropertiesPanel().getAdvancedParameters() 535 535 ); … … 564 564 SwingUtilities.invokeLater(r); 565 565 } 566 } catch(final OsmOAuthAuthori sationException e) {566 } catch(final OsmOAuthAuthorizationException e) { 567 567 handleException(e); 568 568 } -
trunk/src/org/openstreetmap/josm/gui/oauth/ManualAuthorizationUI.java
r2858 r2861 33 33 import org.openstreetmap.josm.tools.ImageProvider; 34 34 35 public class ManualAuthori sationUI extends AbstractAuthorisationUI{35 public class ManualAuthorizationUI extends AbstractAuthorizationUI{ 36 36 37 37 private JTextField tfAccessTokenKey; … … 152 152 } 153 153 154 public ManualAuthori sationUI() {154 public ManualAuthorizationUI() { 155 155 build(); 156 156 } … … 237 237 public void actionPerformed(ActionEvent evt) { 238 238 TestAccessTokenTask task = new TestAccessTokenTask( 239 ManualAuthori sationUI.this,239 ManualAuthorizationUI.this, 240 240 getApiUrl(), 241 241 getAdvancedPropertiesPanel().getAdvancedParameters(), … … 250 250 251 251 public void propertyChange(PropertyChangeEvent evt) { 252 if (! evt.getPropertyName().equals(AbstractAuthori sationUI.ACCESS_TOKEN_PROP))252 if (! evt.getPropertyName().equals(AbstractAuthorizationUI.ACCESS_TOKEN_PROP)) 253 253 return; 254 254 updateEnabledState(); -
trunk/src/org/openstreetmap/josm/gui/oauth/OAuthAuthorizationWizard.java
r2858 r2861 51 51 * 52 52 */ 53 public class OAuthAuthori sationWizard extends JDialog {54 static private final Logger logger = Logger.getLogger(OAuthAuthori sationWizard.class.getName());53 public class OAuthAuthorizationWizard extends JDialog { 54 static private final Logger logger = Logger.getLogger(OAuthAuthorizationWizard.class.getName()); 55 55 56 56 private HtmlPanel pnlMessage; … … 58 58 private String apiUrl; 59 59 60 private Authori sationProcedureComboBox cbAuthorisationProcedure;61 private FullyAutomaticAuthori sationUI pnlFullyAutomaticAuthorisationUI;62 private SemiAutomaticAuthori sationUI pnlSemiAutomaticAuthorisationUI;63 private ManualAuthori sationUI pnlManualAuthorisationUI;60 private AuthorizationProcedureComboBox cbAuthorisationProcedure; 61 private FullyAutomaticAuthorizationUI pnlFullyAutomaticAuthorisationUI; 62 private SemiAutomaticAuthorizationUI pnlSemiAutomaticAuthorisationUI; 63 private ManualAuthorizationUI pnlManualAuthorisationUI; 64 64 private JScrollPane spAuthorisationProcedureUI; 65 65 … … 126 126 gc.gridwidth = 1; 127 127 gc.weightx = 1.0; 128 pnl.add(cbAuthorisationProcedure = new Authori sationProcedureComboBox(),gc);128 pnl.add(cbAuthorisationProcedure = new AuthorizationProcedureComboBox(),gc); 129 129 cbAuthorisationProcedure.addItemListener(new AuthorisationProcedureChangeListener()); 130 130 return pnl; … … 136 136 */ 137 137 protected void refreshAuthorisationProcedurePanel() { 138 Authori sationProcedure procedure = (AuthorisationProcedure)cbAuthorisationProcedure.getSelectedItem();138 AuthorizationProcedure procedure = (AuthorizationProcedure)cbAuthorisationProcedure.getSelectedItem(); 139 139 switch(procedure) { 140 140 case FULLY_AUTOMATIC: … … 162 162 getContentPane().add(buildHeaderInfoPanel(), BorderLayout.NORTH); 163 163 164 pnlFullyAutomaticAuthorisationUI = new FullyAutomaticAuthori sationUI();164 pnlFullyAutomaticAuthorisationUI = new FullyAutomaticAuthorizationUI(); 165 165 pnlFullyAutomaticAuthorisationUI.setApiUrl(apiUrl); 166 166 167 pnlSemiAutomaticAuthorisationUI = new SemiAutomaticAuthori sationUI();167 pnlSemiAutomaticAuthorisationUI = new SemiAutomaticAuthorizationUI(); 168 168 pnlSemiAutomaticAuthorisationUI.setApiUrl(apiUrl); 169 169 170 pnlManualAuthorisationUI = new ManualAuthori sationUI();170 pnlManualAuthorisationUI = new ManualAuthorizationUI(); 171 171 pnlManualAuthorisationUI.setApiUrl(apiUrl); 172 172 … … 206 206 * @throws IllegalArgumentException thrown if apiUrl is null 207 207 */ 208 public OAuthAuthori sationWizard(String apiUrl) throws IllegalArgumentException {208 public OAuthAuthorizationWizard(String apiUrl) throws IllegalArgumentException { 209 209 super(JOptionPane.getFrameForComponent(Main.parent),true /* modal */); 210 210 CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl"); … … 220 220 * @throws IllegalArgumentException thrown if apiUrl is null 221 221 */ 222 public OAuthAuthori sationWizard(Component parent, String apiUrl) {222 public OAuthAuthorizationWizard(Component parent, String apiUrl) { 223 223 super(JOptionPane.getFrameForComponent(parent),true /* modal */); 224 224 CheckParameterUtil.ensureParameterNotNull(apiUrl, "apiUrl"); … … 259 259 } 260 260 261 protected AbstractAuthori sationUI getCurrentAuthorisationUI() {262 switch((Authori sationProcedure)cbAuthorisationProcedure.getSelectedItem()) {261 protected AbstractAuthorizationUI getCurrentAuthorisationUI() { 262 switch((AuthorizationProcedure)cbAuthorisationProcedure.getSelectedItem()) { 263 263 case FULLY_AUTOMATIC: return pnlFullyAutomaticAuthorisationUI; 264 264 case MANUALLY: return pnlManualAuthorisationUI; … … 371 371 372 372 public void propertyChange(PropertyChangeEvent evt) { 373 if (!evt.getPropertyName().equals(AbstractAuthori sationUI.ACCESS_TOKEN_PROP))373 if (!evt.getPropertyName().equals(AbstractAuthorizationUI.ACCESS_TOKEN_PROP)) 374 374 return; 375 375 token = (OAuthToken)evt.getNewValue(); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmLoginFailedException.java
r2801 r2861 2 2 package org.openstreetmap.josm.gui.oauth; 3 3 4 public class OsmLoginFailedException extends OsmOAuthAuthori sationException{4 public class OsmLoginFailedException extends OsmOAuthAuthorizationException{ 5 5 6 6 public OsmLoginFailedException() { -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationClient.java
r2858 r2861 35 35 import org.openstreetmap.josm.tools.CheckParameterUtil; 36 36 37 public class OsmOAuthAuthori sationClient {38 static private final Logger logger = Logger.getLogger(OsmOAuthAuthori sationClient.class.getName());37 public class OsmOAuthAuthorizationClient { 38 static private final Logger logger = Logger.getLogger(OsmOAuthAuthorizationClient.class.getName()); 39 39 40 40 private OAuthParameters oauthProviderParameters; … … 48 48 * 49 49 */ 50 public OsmOAuthAuthori sationClient() {50 public OsmOAuthAuthorizationClient() { 51 51 oauthProviderParameters = OAuthParameters.createDefault(); 52 52 consumer = oauthProviderParameters.buildConsumer(); … … 60 60 * @throws IllegalArgumentException thrown if parameters is null 61 61 */ 62 public OsmOAuthAuthori sationClient(OAuthParameters parameters) throws IllegalArgumentException {62 public OsmOAuthAuthorizationClient(OAuthParameters parameters) throws IllegalArgumentException { 63 63 CheckParameterUtil.ensureParameterNotNull(parameters, "parameters"); 64 64 oauthProviderParameters = new OAuthParameters(parameters); … … 76 76 * @throws IllegalArgumentException thrown if requestToken is null 77 77 */ 78 public OsmOAuthAuthori sationClient(OAuthParameters parameters, OAuthToken requestToken) throws IllegalArgumentException {78 public OsmOAuthAuthorizationClient(OAuthParameters parameters, OAuthToken requestToken) throws IllegalArgumentException { 79 79 CheckParameterUtil.ensureParameterNotNull(parameters, "parameters"); 80 80 oauthProviderParameters = new OAuthParameters(parameters); … … 119 119 * @param monitor a progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null 120 120 * @return the OAuth Request Token 121 * @throws OsmOAuthAuthori sationException thrown if something goes wrong when retrieving the request token122 */ 123 public OAuthToken getRequestToken(ProgressMonitor monitor) throws OsmOAuthAuthori sationException, OsmTransferCancelledException {121 * @throws OsmOAuthAuthorizationException thrown if something goes wrong when retrieving the request token 122 */ 123 public OAuthToken getRequestToken(ProgressMonitor monitor) throws OsmOAuthAuthorizationException, OsmTransferCancelledException { 124 124 if (monitor == null) { 125 125 monitor = NullProgressMonitor.INSTANCE; … … 133 133 if (canceled) 134 134 throw new OsmTransferCancelledException(); 135 throw new OsmOAuthAuthori sationException(e);135 throw new OsmOAuthAuthorizationException(e); 136 136 } catch(OAuthException e){ 137 137 if (canceled) 138 138 throw new OsmTransferCancelledException(); 139 throw new OsmOAuthAuthori sationException(e);139 throw new OsmOAuthAuthorizationException(e); 140 140 } finally { 141 141 monitor.finishTask(); … … 151 151 * @param monitor a progress monitor. Defaults to {@see NullProgressMonitor#INSTANCE} if null 152 152 * @return the OAuth Access Token 153 * @throws OsmOAuthAuthori sationException thrown if something goes wrong when retrieving the request token153 * @throws OsmOAuthAuthorizationException thrown if something goes wrong when retrieving the request token 154 154 * @see #getRequestToken(ProgressMonitor) 155 155 */ 156 public OAuthToken getAccessToken(ProgressMonitor monitor) throws OsmOAuthAuthori sationException, OsmTransferCancelledException {156 public OAuthToken getAccessToken(ProgressMonitor monitor) throws OsmOAuthAuthorizationException, OsmTransferCancelledException { 157 157 if (monitor == null) { 158 158 monitor = NullProgressMonitor.INSTANCE; … … 166 166 if (canceled) 167 167 throw new OsmTransferCancelledException(); 168 throw new OsmOAuthAuthori sationException(e);168 throw new OsmOAuthAuthorizationException(e); 169 169 } catch(OAuthException e){ 170 170 if (canceled) 171 171 throw new OsmTransferCancelledException(); 172 throw new OsmOAuthAuthori sationException(e);172 throw new OsmOAuthAuthorizationException(e); 173 173 } finally { 174 174 monitor.finishTask(); … … 219 219 } 220 220 221 protected String buildPostRequest(Map<String,String> parameters) throws OsmOAuthAuthori sationException {221 protected String buildPostRequest(Map<String,String> parameters) throws OsmOAuthAuthorizationException { 222 222 try { 223 223 StringBuilder sb = new StringBuilder(); … … 234 234 return sb.toString(); 235 235 } catch(UnsupportedEncodingException e) { 236 throw new OsmOAuthAuthori sationException(e);236 throw new OsmOAuthAuthorizationException(e); 237 237 } 238 238 } … … 242 242 * 243 243 * @return the OSM login URL 244 * @throws OsmOAuthAuthori sationException thrown if something went wrong, in particular if the244 * @throws OsmOAuthAuthorizationException thrown if something went wrong, in particular if the 245 245 * URLs are malformed 246 246 */ 247 public String buildOsmLoginUrl() throws OsmOAuthAuthori sationException{247 public String buildOsmLoginUrl() throws OsmOAuthAuthorizationException{ 248 248 try { 249 249 URL autUrl = new URL(oauthProviderParameters.getAuthoriseUrl()); … … 254 254 return url.toString(); 255 255 } catch(MalformedURLException e) { 256 throw new OsmOAuthAuthori sationException(e);256 throw new OsmOAuthAuthorizationException(e); 257 257 } 258 258 } … … 262 262 * 263 263 * @return the OSM logout URL 264 * @throws OsmOAuthAuthori sationException thrown if something went wrong, in particular if the264 * @throws OsmOAuthAuthorizationException thrown if something went wrong, in particular if the 265 265 * URLs are malformed 266 266 */ 267 protected String buildOsmLogoutUrl() throws OsmOAuthAuthori sationException{267 protected String buildOsmLogoutUrl() throws OsmOAuthAuthorizationException{ 268 268 try { 269 269 URL autUrl = new URL(oauthProviderParameters.getAuthoriseUrl()); … … 271 271 return url.toString(); 272 272 } catch(MalformedURLException e) { 273 throw new OsmOAuthAuthori sationException(e);273 throw new OsmOAuthAuthorizationException(e); 274 274 } 275 275 } … … 280 280 * 281 281 * @return the session ID 282 * @throws OsmOAuthAuthori sationException thrown if something went wrong283 */ 284 protected String fetchOsmWebsiteSessionId() throws OsmOAuthAuthori sationException {282 * @throws OsmOAuthAuthorizationException thrown if something went wrong 283 */ 284 protected String fetchOsmWebsiteSessionId() throws OsmOAuthAuthorizationException { 285 285 try { 286 286 StringBuilder sb = new StringBuilder(); … … 297 297 String sessionId = extractOsmSession(connection); 298 298 if (sessionId == null) 299 throw new OsmOAuthAuthori sationException(tr("OSM website did not return a session cookie in response to ''{0}'',", url.toString()));299 throw new OsmOAuthAuthorizationException(tr("OSM website did not return a session cookie in response to ''{0}'',", url.toString())); 300 300 return sessionId; 301 301 } catch(IOException e) { 302 throw new OsmOAuthAuthori sationException(e);302 throw new OsmOAuthAuthorizationException(e); 303 303 } finally { 304 304 synchronized(this) { … … 348 348 int retCode = connection.getResponseCode(); 349 349 if (retCode != HttpURLConnection.HTTP_MOVED_TEMP) 350 throw new OsmOAuthAuthori sationException(tr("Failed to authenticate user ''{0}'' with password ''***'' as OAuth user", userName));351 } catch(OsmOAuthAuthori sationException e) {350 throw new OsmOAuthAuthorizationException(tr("Failed to authenticate user ''{0}'' with password ''***'' as OAuth user", userName)); 351 } catch(OsmOAuthAuthorizationException e) { 352 352 throw new OsmLoginFailedException(e.getCause()); 353 353 } catch(IOException e) { … … 365 365 } 366 366 367 protected void logoutOsmSession(String sessionId) throws OsmOAuthAuthori sationException {367 protected void logoutOsmSession(String sessionId) throws OsmOAuthAuthorizationException { 368 368 try { 369 369 URL url = new URL(buildOsmLogoutUrl()); … … 377 377 connection.connect(); 378 378 }catch(MalformedURLException e) { 379 throw new OsmOAuthAuthori sationException(e);379 throw new OsmOAuthAuthorizationException(e); 380 380 } catch(IOException e) { 381 throw new OsmOAuthAuthori sationException(e);381 throw new OsmOAuthAuthorizationException(e); 382 382 } finally { 383 383 synchronized(this) { … … 387 387 } 388 388 389 protected void sendAuthorisationRequest(String sessionId, OAuthToken requestToken, OsmPrivileges privileges) throws OsmOAuthAuthori sationException {389 protected void sendAuthorisationRequest(String sessionId, OAuthToken requestToken, OsmPrivileges privileges) throws OsmOAuthAuthorizationException { 390 390 Map<String, String> parameters = new HashMap<String, String>(); 391 391 parameters.put("oauth_token", requestToken.getKey()); … … 435 435 int retCode = connection.getResponseCode(); 436 436 if (retCode != HttpURLConnection.HTTP_MOVED_TEMP) 437 throw new OsmOAuthAuthori sationException(tr("Failed to authorise OAuth request ''{0}''", requestToken.getKey()));437 throw new OsmOAuthAuthorizationException(tr("Failed to authorise OAuth request ''{0}''", requestToken.getKey())); 438 438 } catch(MalformedURLException e) { 439 throw new OsmOAuthAuthori sationException(e);439 throw new OsmOAuthAuthorizationException(e); 440 440 } catch(IOException e) { 441 throw new OsmOAuthAuthori sationException(e);441 throw new OsmOAuthAuthorizationException(e); 442 442 } finally { 443 443 if (dout != null) { … … 469 469 * @throws IllegalArgumentException thrown if osmPassword is null 470 470 * @throws IllegalArgumentException thrown if privileges is null 471 * @throws OsmOAuthAuthori sationException thrown if the authorisation fails471 * @throws OsmOAuthAuthorizationException thrown if the authorisation fails 472 472 * @throws OsmTransferCancelledException thrown if the task is cancelled by the user 473 473 */ 474 public void authorise(OAuthToken requestToken, String osmUserName, String osmPassword, OsmPrivileges privileges, ProgressMonitor monitor) throws IllegalArgumentException, OsmOAuthAuthori sationException, OsmTransferCancelledException{474 public void authorise(OAuthToken requestToken, String osmUserName, String osmPassword, OsmPrivileges privileges, ProgressMonitor monitor) throws IllegalArgumentException, OsmOAuthAuthorizationException, OsmTransferCancelledException{ 475 475 CheckParameterUtil.ensureParameterNotNull(requestToken, "requestToken"); 476 476 CheckParameterUtil.ensureParameterNotNull(osmUserName, "osmUserName"); … … 507 507 throw new OsmTransferCancelledException(); 508 508 monitor.worked(1); 509 } catch(OsmOAuthAuthori sationException e) {509 } catch(OsmOAuthAuthorizationException e) { 510 510 if (canceled) 511 511 throw new OsmTransferCancelledException(); -
trunk/src/org/openstreetmap/josm/gui/oauth/OsmOAuthAuthorizationException.java
r2858 r2861 2 2 package org.openstreetmap.josm.gui.oauth; 3 3 4 public class OsmOAuthAuthori sationException extends Exception {4 public class OsmOAuthAuthorizationException extends Exception { 5 5 6 public OsmOAuthAuthori sationException() {6 public OsmOAuthAuthorizationException() { 7 7 super(); 8 8 } 9 9 10 public OsmOAuthAuthori sationException(String arg0, Throwable arg1) {10 public OsmOAuthAuthorizationException(String arg0, Throwable arg1) { 11 11 super(arg0, arg1); 12 12 } 13 13 14 public OsmOAuthAuthori sationException(String arg0) {14 public OsmOAuthAuthorizationException(String arg0) { 15 15 super(arg0); 16 16 } 17 17 18 public OsmOAuthAuthori sationException(Throwable arg0) {18 public OsmOAuthAuthorizationException(Throwable arg0) { 19 19 super(arg0); 20 20 } -
trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveAccessTokenTask.java
r2801 r2861 28 28 private OAuthToken accessToken; 29 29 private OAuthParameters parameters; 30 private OsmOAuthAuthori sationClient client;30 private OsmOAuthAuthorizationClient client; 31 31 private OAuthToken requestToken; 32 32 private Component parent; … … 64 64 protected void finish() { /* not used in this task */} 65 65 66 protected void alertRetrievingAccessTokenFailed(OsmOAuthAuthori sationException e) {66 protected void alertRetrievingAccessTokenFailed(OsmOAuthAuthorizationException e) { 67 67 HelpAwareOptionPane.showOptionDialog( 68 68 parent, … … 81 81 try { 82 82 synchronized(this) { 83 client = new OsmOAuthAuthori sationClient(parameters, requestToken);83 client = new OsmOAuthAuthorizationClient(parameters, requestToken); 84 84 } 85 85 accessToken = client.getAccessToken(getProgressMonitor().createSubTaskMonitor(0, false)); 86 86 } catch(OsmTransferCancelledException e) { 87 87 return; 88 } catch (OsmOAuthAuthori sationException e) {88 } catch (OsmOAuthAuthorizationException e) { 89 89 e.printStackTrace(); 90 90 alertRetrievingAccessTokenFailed(e); -
trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveRequestTokenTask.java
r2801 r2861 27 27 private OAuthToken requestToken; 28 28 private OAuthParameters parameters; 29 private OsmOAuthAuthori sationClient client;29 private OsmOAuthAuthorizationClient client; 30 30 private Component parent; 31 31 … … 58 58 protected void finish() { /* not used in this task */} 59 59 60 protected void alertRetrievingRequestTokenFailed(OsmOAuthAuthori sationException e) {60 protected void alertRetrievingRequestTokenFailed(OsmOAuthAuthorizationException e) { 61 61 HelpAwareOptionPane.showOptionDialog( 62 62 parent, … … 75 75 try { 76 76 synchronized(this) { 77 client = new OsmOAuthAuthori sationClient(parameters);77 client = new OsmOAuthAuthorizationClient(parameters); 78 78 } 79 79 requestToken = client.getRequestToken(getProgressMonitor().createSubTaskMonitor(0, false)); 80 80 } catch(OsmTransferCancelledException e) { 81 81 return; 82 } catch (OsmOAuthAuthori sationException e) {82 } catch (OsmOAuthAuthorizationException e) { 83 83 e.printStackTrace(); 84 84 alertRetrievingRequestTokenFailed(e); -
trunk/src/org/openstreetmap/josm/gui/oauth/SemiAutomaticAuthorizationUI.java
r2858 r2861 38 38 * external browser for login and authorisation. 39 39 */ 40 public class SemiAutomaticAuthori sationUI extends AbstractAuthorisationUI {40 public class SemiAutomaticAuthorizationUI extends AbstractAuthorizationUI { 41 41 private AccessTokenInfoPanel pnlAccessTokenInfo; 42 42 private OAuthToken requestToken; … … 58 58 } 59 59 60 public SemiAutomaticAuthori sationUI() {60 public SemiAutomaticAuthorizationUI() { 61 61 build(); 62 62 } … … 68 68 69 69 protected void transitionToRetrieveAccessToken() { 70 OsmOAuthAuthori sationClient client = new OsmOAuthAuthorisationClient(70 OsmOAuthAuthorizationClient client = new OsmOAuthAuthorizationClient( 71 71 getAdvancedPropertiesPanel().getAdvancedParameters() 72 72 ); … … 374 374 public void actionPerformed(ActionEvent evt) { 375 375 final RetrieveRequestTokenTask task = new RetrieveRequestTokenTask( 376 SemiAutomaticAuthori sationUI.this,376 SemiAutomaticAuthorizationUI.this, 377 377 getAdvancedPropertiesPanel().getAdvancedParameters() 378 378 ); … … 407 407 public void actionPerformed(ActionEvent evt) { 408 408 final RetrieveAccessTokenTask task = new RetrieveAccessTokenTask( 409 SemiAutomaticAuthori sationUI.this,409 SemiAutomaticAuthorizationUI.this, 410 410 getAdvancedPropertiesPanel().getAdvancedParameters(), 411 411 requestToken … … 441 441 public void actionPerformed(ActionEvent evt) { 442 442 TestAccessTokenTask task = new TestAccessTokenTask( 443 SemiAutomaticAuthori sationUI.this,443 SemiAutomaticAuthorizationUI.this, 444 444 getApiUrl(), 445 445 getAdvancedPropertiesPanel().getAdvancedParameters(), -
trunk/src/org/openstreetmap/josm/gui/oauth/TestAccessTokenTask.java
r2850 r2861 97 97 } 98 98 99 protected UserInfo getUserDetails() throws OsmOAuthAuthori sationException, OsmDataParsingException,OsmTransferException {99 protected UserInfo getUserDetails() throws OsmOAuthAuthorizationException, OsmDataParsingException,OsmTransferException { 100 100 boolean authenticatorEnabled = true; 101 101 try { … … 133 133 throw new OsmTransferException(e); 134 134 } catch(OAuthException e) { 135 throw new OsmOAuthAuthori sationException(e);135 throw new OsmOAuthAuthorizationException(e); 136 136 } finally { 137 137 DefaultAuthenticator.getInstance().setEnabled(authenticatorEnabled); … … 253 253 if (canceled) return; 254 254 notifySuccess(userInfo); 255 }catch(OsmOAuthAuthori sationException e) {255 }catch(OsmOAuthAuthorizationException e) { 256 256 if (canceled) return; 257 257 e.printStackTrace(); -
trunk/src/org/openstreetmap/josm/gui/preferences/server/OAuthAuthenticationPreferencesPanel.java
r2849 r2861 31 31 import org.openstreetmap.josm.gui.SideButton; 32 32 import org.openstreetmap.josm.gui.oauth.AdvancedOAuthPropertiesPanel; 33 import org.openstreetmap.josm.gui.oauth.OAuthAuthori sationWizard;33 import org.openstreetmap.josm.gui.oauth.OAuthAuthorizationWizard; 34 34 import org.openstreetmap.josm.gui.oauth.TestAccessTokenTask; 35 35 import org.openstreetmap.josm.io.auth.CredentialsManagerFactory; … … 309 309 } 310 310 public void actionPerformed(ActionEvent arg0) { 311 OAuthAuthori sationWizard wizard = new OAuthAuthorisationWizard(311 OAuthAuthorizationWizard wizard = new OAuthAuthorizationWizard( 312 312 OAuthAuthenticationPreferencesPanel.this, 313 313 apiUrl … … 334 334 } 335 335 public void actionPerformed(ActionEvent arg0) { 336 OAuthAuthori sationWizard wizard = new OAuthAuthorisationWizard(336 OAuthAuthorizationWizard wizard = new OAuthAuthorizationWizard( 337 337 OAuthAuthenticationPreferencesPanel.this, 338 338 apiUrl
Note:
See TracChangeset
for help on using the changeset viewer.