Changeset 16394 in josm
- Timestamp:
- 2020-05-10T08:05:13+02:00 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/history/HistoryBrowserDialogManager.java
r16123 r16394 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn; 5 6 6 7 import java.awt.Component; … … 9 10 import java.util.ArrayList; 10 11 import java.util.Collection; 11 import java.util.HashMap;12 12 import java.util.Iterator; 13 import java.util.LinkedHashMap; 14 import java.util.LinkedList; 13 15 import java.util.List; 14 import java.util.Map;15 16 import java.util.Map.Entry; 16 17 import java.util.Objects; … … 29 30 import org.openstreetmap.josm.gui.layer.LayerManager.LayerRemoveEvent; 30 31 import org.openstreetmap.josm.gui.util.WindowGeometry; 32 import org.openstreetmap.josm.spi.preferences.Config; 31 33 import org.openstreetmap.josm.tools.JosmRuntimeException; 32 34 import org.openstreetmap.josm.tools.Logging; … … 59 61 private static HistoryBrowserDialogManager instance; 60 62 61 private final Map<Long, HistoryBrowserDialog> dialogs = new HashMap<>(); 63 private final LinkedHashMap<Long, HistoryBrowserDialog> dialogs = new LinkedHashMap<>(); 62 64 63 65 private final Predicate<PrimitiveId> unloadedHistoryPredicate = new UnloadedHistoryPredicate(); … … 144 146 dialog.setVisible(false); 145 147 dialog.dispose(); 148 149 if (!dialogs.isEmpty()) { 150 // see #17270: set focus to last dialog 151 new LinkedList<>(dialogs.values()).getLast().toFront(); 152 } 146 153 } 147 154 … … 225 232 */ 226 233 public void showHistory(Component parent, final Collection<? extends PrimitiveId> primitives) { 234 if (primitives.size() > Config.getPref().getInt("warn.open.maxhistory", 5) && 235 /* I18N english text for value 1 makes no real sense, never called for values <= maxhistory (usually 5) */ 236 JOptionPane.OK_OPTION != JOptionPane.showConfirmDialog(MainApplication.getMainFrame(), 237 "<html>" + trn( 238 "You are about to open <b>{0}</b> history dialog.<br/>Do you want to continue?", 239 "You are about to open <b>{0}</b> different history dialogs simultaneously.<br/>Do you want to continue?", 240 primitives.size(), primitives.size()) + "</html>", 241 tr("Confirmation"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.WARNING_MESSAGE)) { 242 return; 243 } 244 227 245 final List<PrimitiveId> realPrimitives = new ArrayList<>(primitives); 228 246 hooks.forEach(h -> h.modifyRequestedIds(realPrimitives));
Note:
See TracChangeset
for help on using the changeset viewer.