Ignore:
Timestamp:
2013-12-06T22:27:39+01:00 (6 years ago)
Author:
simon04
Message:

fix #3626 - Show history for any object in history dialog

If no object is selected, the objects are selected by id via dialog.

Location:
trunk/src/org/openstreetmap/josm/actions
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java

    r6313 r6448  
    5656
    5757        DownloadObjectDialog dialog = new DownloadObjectDialog();
    58         if (dialog.showDialog().getValue() != 1) return;
     58        if (dialog.showDialog().getValue() != dialog.getContinueButtonIndex()) return;
    5959
    6060        processItems(dialog.isNewLayerRequested(), dialog.getOsmIds(), dialog.isReferrersRequested(), dialog.isFullRelationRequested());
  • trunk/src/org/openstreetmap/josm/actions/HistoryInfoAction.java

    r6380 r6448  
    44import java.awt.event.ActionEvent;
    55import java.awt.event.KeyEvent;
    6 import java.util.Collection;
    76
    87import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.data.osm.DataSet;
    10 import org.openstreetmap.josm.data.osm.OsmPrimitive;
     9import org.openstreetmap.josm.gui.dialogs.OsmIdSelectionDialog;
    1110import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
    1211import org.openstreetmap.josm.tools.Shortcut;
     
    2120                tr("Display history information about OSM ways, nodes, or relations."),
    2221                Shortcut.registerShortcut("core:historyinfo",
    23                 tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
     22                        tr("History"), KeyEvent.VK_H, Shortcut.CTRL), false);
    2423        putValue("help", ht("/Action/ObjectHistory"));
    2524        putValue("toolbar", "action/historyinfo");
    2625        Main.toolbar.register(this);
     26        setEnabled(true);
    2727    }
    2828
     
    3030    public void actionPerformed(ActionEvent ae) {
    3131        DataSet set = getCurrentDataSet();
    32         if (set != null) {
     32        if (set != null && !set.getAllSelected().isEmpty()) {
    3333            HistoryBrowserDialogManager.getInstance().showHistory(set.getAllSelected());
     34        } else {
     35            HistoryObjectIDDialog dialog = new HistoryObjectIDDialog();
     36            if (dialog.showDialog().getValue() == dialog.getContinueButtonIndex()) {
     37                HistoryBrowserDialogManager.getInstance().showHistory(dialog.getOsmIds());
     38            }
    3439        }
    3540    }
    3641
    37     @Override
    38     public void updateEnabledState() {
    39         if (getCurrentDataSet() == null) {
    40             setEnabled(false);
    41         } else {
    42             updateEnabledState(getCurrentDataSet().getAllSelected());
     42    public static class HistoryObjectIDDialog extends OsmIdSelectionDialog {
     43
     44        public HistoryObjectIDDialog() {
     45            super(Main.parent, tr("Show history"), new String[]{tr("Show history"), tr("Cancel")});
     46            setButtonIcons(new String[]{"dialogs/history.png", "cancel.png"});
     47            init();
    4348        }
    4449    }
    4550
    46     @Override
    47     protected void updateEnabledState(Collection<? extends OsmPrimitive> selection) {
    48         setEnabled(!selection.isEmpty());
    49     }
    5051}
Note: See TracChangeset for help on using the changeset viewer.