- Timestamp:
- 2020-08-29T16:38:58+02:00 (4 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/PreferencesAction.java
r16505 r16966 109 109 } else if (subTab != null) { 110 110 p.selectSubPreferencesTabByClass(subTab); 111 } else { 112 p.selectPreviouslySelectedPreferences(); 111 113 } 112 114 p.setVisible(true); -
trunk/src/org/openstreetmap/josm/gui/preferences/DefaultTabPreferenceSetting.java
r16553 r16966 142 142 143 143 @Override 144 public Class<? extends SubPreferenceSetting> getSelectedSubTab() { 145 if (tabpane == null || subSettingMap == null) { 146 return null; 147 } 148 final Component selected = tabpane.getSelectedComponent(); 149 return subSettingMap.entrySet().stream() 150 .filter(e -> e.getValue() == selected) 151 .map(e -> e.getKey().getClass()) 152 .findFirst().orElse(null); 153 } 154 155 @Override 144 156 public String getHelpContext() { 145 157 return HelpUtil.ht("/Action/Preferences"); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceDialog.java
r14601 r16966 31 31 import org.openstreetmap.josm.tools.ImageProvider; 32 32 import org.openstreetmap.josm.tools.InputMapUtils; 33 import org.openstreetmap.josm.tools.Pair; 33 34 34 35 /** … … 45 46 private final WindowEventHandler windowEventHandler = new WindowEventHandler(); 46 47 private boolean canceled; 48 private static Pair<Class<? extends TabPreferenceSetting>, Class<? extends SubPreferenceSetting>> previouslySelected; 47 49 48 50 /** … … 145 147 146 148 /** 149 * Select preferences tab that was selected previously. 150 */ 151 public void selectPreviouslySelectedPreferences() { 152 if (previouslySelected != null && previouslySelected.b != null) { 153 tpPreferences.selectSubTabByPref(previouslySelected.b); 154 } else if (previouslySelected != null && previouslySelected.a != null) { 155 tpPreferences.selectTabByPref(previouslySelected.a); 156 } 157 } 158 159 /** 147 160 * Select preferences tab by name. 148 161 * @param name preferences tab name (icon) … … 215 228 @Override 216 229 public void dispose() { 230 previouslySelected = tpPreferences.getSelectedTab(); 217 231 removeWindowListener(windowEventHandler); 218 232 super.dispose(); -
trunk/src/org/openstreetmap/josm/gui/preferences/PreferenceTabbedPane.java
r16553 r16966 71 71 import org.openstreetmap.josm.tools.ImageProvider; 72 72 import org.openstreetmap.josm.tools.Logging; 73 import org.openstreetmap.josm.tools.Pair; 73 74 import org.openstreetmap.josm.tools.Utils; 74 75 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; … … 354 355 Logging.trace(ignore); 355 356 return false; 357 } 358 } 359 360 /** 361 * Returns the currently selected preference and sub preference setting 362 * @return the currently selected preference and sub preference setting 363 */ 364 public Pair<Class<? extends TabPreferenceSetting>, Class<? extends SubPreferenceSetting>> getSelectedTab() { 365 final Component selected = getSelectedComponent(); 366 if (selected instanceof PreferenceTab) { 367 final TabPreferenceSetting setting = ((PreferenceTab) selected).getTabPreferenceSetting(); 368 return Pair.create(setting.getClass(), setting.getSelectedSubTab()); 369 } else { 370 return null; 356 371 } 357 372 } -
trunk/src/org/openstreetmap/josm/gui/preferences/TabPreferenceSetting.java
r13431 r16966 72 72 73 73 /** 74 * Returns the currently selected sub preference setting 75 * @return the currently selected sub preference setting 76 */ 77 Class<? extends SubPreferenceSetting> getSelectedSubTab(); 78 79 /** 74 80 * Selects the specified sub preference settings, if applicable. Not all Tab preference settings need to implement this. 75 81 * @param subPref The sub preference settings to be selected.
Note:
See TracChangeset
for help on using the changeset viewer.