Changeset 8679 in josm
- Timestamp:
- 2015-08-22T21:24:48+02:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java
r8540 r8679 75 75 import org.openstreetmap.josm.data.osm.event.DatasetEventManager.FireMode; 76 76 import org.openstreetmap.josm.data.osm.event.SelectionEventManager; 77 import org.openstreetmap.josm.data.preferences.StringProperty; 77 78 import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil; 78 79 import org.openstreetmap.josm.gui.DefaultNameFormatter; … … 166 167 private final transient DataSetListenerAdapter dataChangedAdapter = new DataSetListenerAdapter(this); 167 168 private final HelpAction helpAction = new HelpAction(); 169 private final TaginfoAction taginfoAction = new TaginfoAction(); 168 170 private final PasteValueAction pasteValueAction = new PasteValueAction(); 169 171 private final CopyValueAction copyValueAction = new CopyValueAction(); … … 397 399 membershipMenu.addSeparator(); 398 400 membershipMenu.add(helpAction); 401 membershipMenu.add(taginfoAction); 399 402 400 403 membershipTable.addMouseListener(new PopupMenuLauncher(membershipMenu) { … … 450 453 tagMenu.addSeparator(); 451 454 tagMenu.add(helpAction); 455 tagMenu.add(taginfoAction); 452 456 tagTable.addMouseListener(new PopupMenuLauncher(tagMenu)); 453 457 } … … 1147 1151 } 1148 1152 1153 class TaginfoAction extends AbstractAction { 1154 1155 final StringProperty TAGINFO_URL_PROP = new StringProperty("taginfo.url", "https://taginfo.openstreetmap.org/"); 1156 1157 public TaginfoAction() { 1158 putValue(NAME, tr("Go to Taginfo")); 1159 putValue(SHORT_DESCRIPTION, tr("Launch browser with Taginfo statistics for selected object")); 1160 } 1161 1162 @Override 1163 @SuppressWarnings("unchecked") 1164 public void actionPerformed(ActionEvent e) { 1165 final String url; 1166 if (tagTable.getSelectedRowCount() == 1) { 1167 final int row = tagTable.getSelectedRow(); 1168 final String key = Utils.encodeUrl(tagData.getValueAt(row, 0).toString()); 1169 Map<String, Integer> values = (Map<String, Integer>) tagData.getValueAt(row, 1); 1170 if (values.size() == 1) { 1171 url = TAGINFO_URL_PROP.get() + "tags/" + key /* do not URL encode key, otherwise addr:street does not work */ 1172 + "=" + Utils.encodeUrl(values.keySet().iterator().next()); 1173 } else { 1174 url = TAGINFO_URL_PROP.get() + "keys/" + key; /* do not URL encode key, otherwise addr:street does not work */ 1175 } 1176 } else if (membershipTable.getSelectedRowCount() == 1) { 1177 final String type = ((Relation) membershipData.getValueAt(membershipTable.getSelectedRow(), 0)).get("type"); 1178 url = TAGINFO_URL_PROP.get() + "relations/" + type; 1179 } else { 1180 return; 1181 } 1182 OpenBrowser.displayUrl(url); 1183 } 1184 } 1185 1149 1186 class PasteValueAction extends AbstractAction { 1150 1187 public PasteValueAction() {
Note:
See TracChangeset
for help on using the changeset viewer.