Changeset 15706 in josm for trunk/src/org
- Timestamp:
- 2020-01-13T23:51:06+01:00 (5 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/AbstractInfoAction.java
r15586 r15706 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 import static org.openstreetmap.josm.tools.I18n.trn;6 5 7 6 import java.awt.event.ActionEvent; … … 16 15 import org.openstreetmap.josm.data.osm.OsmData; 17 16 import org.openstreetmap.josm.data.osm.OsmPrimitive; 18 import org.openstreetmap.josm.gui.HelpAwareOptionPane;19 import org.openstreetmap.josm.gui.HelpAwareOptionPane.ButtonSpec;20 17 import org.openstreetmap.josm.gui.MainApplication; 21 import org.openstreetmap.josm.gui.help.HelpUtil;22 import org.openstreetmap.josm.tools.ImageProvider;23 18 import org.openstreetmap.josm.tools.Logging; 24 19 import org.openstreetmap.josm.tools.OpenBrowser; … … 62 57 * @param numBrowsers the number of browser windows to open 63 58 * @return {@code true} if the user confirms, {@code false} otherwise 59 * @deprecated use {@link OpenBrowserAction#confirmLaunchMultiple(int)} 64 60 */ 61 @Deprecated 65 62 public static boolean confirmLaunchMultiple(int numBrowsers) { 66 String msg = /* for correct i18n of plural forms - see #9110 */ trn( 67 "You are about to launch {0} browser window.<br>" 68 + "This may both clutter your screen with browser windows<br>" 69 + "and take some time to finish.", 70 "You are about to launch {0} browser windows.<br>" 71 + "This may both clutter your screen with browser windows<br>" 72 + "and take some time to finish.", numBrowsers, numBrowsers); 73 ButtonSpec[] spec = { 74 new ButtonSpec( 75 tr("Continue"), 76 new ImageProvider("ok"), 77 trn("Click to continue and to open {0} browser", "Click to continue and to open {0} browsers", 78 numBrowsers, numBrowsers), 79 null // no specific help topic 80 ), 81 new ButtonSpec( 82 tr("Cancel"), 83 new ImageProvider("cancel"), 84 tr("Click to abort launching external browsers"), 85 null // no specific help topic 86 ) 87 }; 88 return 0 == HelpAwareOptionPane.showOptionDialog( 89 MainApplication.getMainFrame(), 90 new StringBuilder(msg).insert(0, "<html>").append("</html>").toString(), 91 tr("Warning"), 92 JOptionPane.WARNING_MESSAGE, 93 null, 94 spec, 95 spec[0], 96 HelpUtil.ht("/WarningMessages#ToManyBrowsersToOpen") 97 ); 63 return OpenBrowserAction.confirmLaunchMultiple(numBrowsers); 98 64 } 99 65 … … 124 90 // 125 91 int max = Math.min(10, primitivesToShow.size()); 126 if (primitivesToShow.size() > max && ! confirmLaunchMultiple(primitivesToShow.size()))92 if (primitivesToShow.size() > max && !OpenBrowserAction.confirmLaunchMultiple(primitivesToShow.size())) 127 93 return; 128 94 for (int i = 0; i < max; i++) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/ChangesetDialog.java
r15650 r15706 33 33 import javax.swing.event.ListSelectionListener; 34 34 35 import org.openstreetmap.josm.actions. AbstractInfoAction;35 import org.openstreetmap.josm.actions.OpenBrowserAction; 36 36 import org.openstreetmap.josm.actions.downloadtasks.ChangesetHeaderDownloadTask; 37 37 import org.openstreetmap.josm.actions.downloadtasks.PostDownloadHandler; … … 432 432 if (sel.isEmpty()) 433 433 return; 434 if (sel.size() > 10 && ! AbstractInfoAction.confirmLaunchMultiple(sel.size()))434 if (sel.size() > 10 && !OpenBrowserAction.confirmLaunchMultiple(sel.size())) 435 435 return; 436 436 String baseUrl = Config.getUrls().getBaseBrowseUrl(); -
trunk/src/org/openstreetmap/josm/gui/history/OpenChangesetPopupMenu.java
r15673 r15706 15 15 import javax.swing.JPopupMenu; 16 16 17 import org.openstreetmap.josm.actions.OpenBrowserAction; 17 18 import org.openstreetmap.josm.data.StructUtils; 18 19 import org.openstreetmap.josm.data.StructUtils.StructEntry; 19 20 import org.openstreetmap.josm.data.osm.PrimitiveId; 20 import org.openstreetmap.josm.gui.util.OpenBrowserAction;21 21 import org.openstreetmap.josm.spi.preferences.Config; 22 22 -
trunk/src/org/openstreetmap/josm/gui/util/AbstractTag2LinkPopupListener.java
r15702 r15706 4 4 import java.awt.Component; 5 5 import java.util.ArrayList; 6 import java.util.List; 6 import java.util.Collection; 7 import java.util.HashMap; 8 import java.util.Map; 7 9 8 10 import javax.swing.JPopupMenu; … … 10 12 import javax.swing.event.PopupMenuListener; 11 13 14 import org.openstreetmap.josm.actions.OpenBrowserAction; 12 15 import org.openstreetmap.josm.tools.Tag2Link; 13 16 … … 19 22 public abstract class AbstractTag2LinkPopupListener implements PopupMenuListener { 20 23 21 private final List<Component> itemList; 24 private final Map<String, org.openstreetmap.josm.actions.OpenBrowserAction> browserActions = new HashMap<>(); 25 private final Collection<Component> itemList = new ArrayList<>(); 22 26 23 27 protected AbstractTag2LinkPopupListener() { 24 this.itemList = new ArrayList<>();25 28 } 26 29 … … 28 31 public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { 29 32 JPopupMenu popup = (JPopupMenu) e.getSource(); 33 browserActions.clear(); 30 34 itemList.forEach(popup::remove); 31 35 itemList.clear(); … … 42 46 } 43 47 44 itemList.add(popup.add(new OpenBrowserAction(name, url))); 48 if (browserActions.containsKey(name)) { 49 browserActions.get(name).addUrl(url); 50 } else { 51 final OpenBrowserAction action = new OpenBrowserAction(name, url); 52 browserActions.put(name, action); 53 itemList.add(popup.add(action)); 54 } 45 55 }); 46 56 } -
trunk/src/org/openstreetmap/josm/tools/Tag2Link.java
r15702 r15706 122 122 public static void getLinksForTag(String key, String value, LinkConsumer linkConsumer) { 123 123 124 if (value == null || value.isEmpty()) { 125 return; 126 } 127 124 128 // Search 125 129 if (key.matches("^(.+[:_])?name([:_].+)?$")) { … … 151 155 if (key.matches("(.*:)?wikidata")) { 152 156 OsmUtils.splitMultipleValues(value) 153 .forEach(q -> linkConsumer.acceptLink(tr("View Wikidata item {0}", q), "https://www.wikidata.org/wiki/" + q));157 .forEach(q -> linkConsumer.acceptLink(tr("View Wikidata item"), "https://www.wikidata.org/wiki/" + q)); 154 158 } 155 159 if (key.matches("(.*:)?species")) {
Note:
See TracChangeset
for help on using the changeset viewer.