Changeset 18828 in josm
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/preferences/server/AuthenticationPreferencesPanel.java
r18764 r18828 18 18 import javax.swing.JRadioButton; 19 19 20 import org.openstreetmap.josm.actions.ExpertToggleAction; 20 21 import org.openstreetmap.josm.data.UserIdentityManager; 21 22 import org.openstreetmap.josm.data.oauth.OAuthAccessTokenHolder; 22 23 import org.openstreetmap.josm.data.oauth.OAuthVersion; 24 import org.openstreetmap.josm.data.preferences.JosmUrls; 23 25 import org.openstreetmap.josm.gui.help.HelpUtil; 24 26 import org.openstreetmap.josm.gui.widgets.VerticallyScrollablePanel; … … 50 52 private OAuthAuthenticationPreferencesPanel pnlOAuth20Preferences; 51 53 54 /** Used to determine which API we are using for disabling/enabling Basic Auth/OAuth 1.0a */ 55 private String apiUrl = OsmApi.getOsmApi().getServerUrl(); 56 /** ExpertToggleAction uses weak references; we don't want this listener to be garbage collected */ 57 private final ExpertToggleAction.ExpertModeChangeListener expertModeChangeListener = isExpert -> { 58 final String authMethod = OsmApi.getAuthMethod(); 59 final boolean defaultApi = JosmUrls.getInstance().getDefaultOsmApiUrl().equals(apiUrl); 60 rbBasicAuthentication.setEnabled(rbBasicAuthentication.isSelected() || "basic".equals(authMethod) || isExpert || !defaultApi); 61 rbOAuth.setEnabled(rbOAuth.isSelected() || "oauth".equals(authMethod) || isExpert || !defaultApi); 62 }; 63 52 64 /** 53 65 * Constructs a new {@code AuthenticationPreferencesPanel}. … … 110 122 pnlOAuth20Preferences = new OAuthAuthenticationPreferencesPanel(OAuthVersion.OAuth20); 111 123 112 rbBasicAuthentication.setSelected(true); 113 pnlAuthenticationParameters.add(pnlBasicAuthPreferences, BorderLayout.CENTER); 124 ExpertToggleAction.addExpertModeChangeListener(expertModeChangeListener, true); 125 126 rbOAuth20.setSelected(true); 127 pnlAuthenticationParameters.add(pnlOAuth20Preferences, BorderLayout.CENTER); 114 128 } 115 129 … … 178 192 } 179 193 } 194 ExpertToggleAction.removeExpertModeChangeListener(this.expertModeChangeListener); 180 195 } 181 196 … … 210 225 pnlOAuthPreferences.propertyChange(evt); 211 226 } 227 if (pnlOAuth20Preferences != null) { 228 pnlOAuth20Preferences.propertyChange(evt); 229 } 230 if (OsmApiUrlInputPanel.API_URL_PROP.equals(evt.getPropertyName())) { 231 this.apiUrl = (String) evt.getNewValue(); 232 this.expertModeChangeListener.expertChanged(ExpertToggleAction.isExpert()); 233 } 212 234 } 213 235 } -
trunk/test/unit/org/openstreetmap/josm/gui/io/importexport/OsmPbfImporterTest.java
r18827 r18828 19 19 import org.junit.jupiter.api.BeforeAll; 20 20 import org.junit.jupiter.api.Test; 21 import org.junit.jupiter.params.ParameterizedTest;22 import org.junit.jupiter.params.provider.ValueSource;23 21 import org.openstreetmap.josm.TestUtils; 24 22 import org.openstreetmap.josm.data.coor.ILatLon;
Note:
See TracChangeset
for help on using the changeset viewer.