Ticket #19275: 19275.2b.patch

File 19275.2b.patch, 2.3 KB (added by GerdP, 6 years ago)

alternative solution which adds History to the standard context menu for relations

  • src/org/openstreetmap/josm/actions/ShowHistoryAction.java

     
     1// License: GPL. For details, see LICENSE file.
     2package org.openstreetmap.josm.actions;
     3
     4import java.awt.event.ActionEvent;
     5import java.util.Collection;
     6
     7import org.openstreetmap.josm.data.osm.IPrimitive;
     8import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager;
     9
     10/**
     11 * History action for use in Popup menus
     12 * @author Gerd
     13 *
     14 */
     15public class ShowHistoryAction extends AbstractShowHistoryAction implements IPrimitiveAction {
     16    private Collection<? extends IPrimitive> primitives;
     17
     18    @Override
     19    public void actionPerformed(ActionEvent e) {
     20        if (primitives != null && !primitives.isEmpty()) {
     21            HistoryBrowserDialogManager.getInstance().showHistory(primitives);
     22        }
     23    }
     24
     25    @Override
     26    public void setPrimitives(Collection<? extends IPrimitive> primitives) {
     27        this.primitives = primitives;
     28    }
     29}
     30 No newline at end of file
  • src/org/openstreetmap/josm/gui/dialogs/relation/RelationPopupMenus.java

    Property changes on: src/org/openstreetmap/josm/actions/ShowHistoryAction.java
    ___________________________________________________________________
    Added: svn:mime-type
    ## -0,0 +1 ##
    +text/plain
    \ No newline at end of property
     
    66
    77import javax.swing.Action;
    88
     9import org.openstreetmap.josm.actions.ShowHistoryAction;
    910import org.openstreetmap.josm.actions.relation.DeleteRelationsAction;
    1011import org.openstreetmap.josm.actions.relation.DownloadMembersAction;
    1112import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction;
     
    6061        menu.addAction(new DownloadMembersAction());
    6162        menu.addAction(new DownloadSelectedIncompleteMembersAction());
    6263
     64        menu.addSeparator();
     65        menu.addAction(new ShowHistoryAction());
     66
    6367        return menu;
    6468    }
     69
    6570}