Changeset 2700 in josm for trunk/src/org/openstreetmap


Ignore:
Timestamp:
2009-12-29T07:53:23+01:00 (15 years ago)
Author:
mjulius
Message:

fixes #4226 - add reverse members command to relation editor

Location:
trunk/src/org/openstreetmap/josm/gui/dialogs/relation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/GenericRelationEditor.java

    r2665 r2700  
    456456        memberTableModel.addTableModelListener(sortAction);
    457457        tb.add(sortAction);
     458
     459        // -- reverse action
     460        ReverseAction reverseAction = new ReverseAction();
     461        memberTableModel.addTableModelListener(reverseAction);
     462        tb.add(reverseAction);
    458463
    459464        tb.addSeparator();
     
    895900    }
    896901
     902    class ReverseAction extends AbstractAction implements TableModelListener {
     903        public ReverseAction() {
     904            putValue(SHORT_DESCRIPTION, tr("Reverse the order of the relation members"));
     905            putValue(SMALL_ICON, ImageProvider.get("dialogs/relation", "reverse"));
     906            putValue(NAME, tr("Reverse"));
     907            Shortcut.registerShortcut("relationeditor:reverse", tr("Relation Editor: Reverse"), KeyEvent.VK_R,
     908                    Shortcut.GROUP_MNEMONIC);
     909            updateEnabledState();
     910        }
     911
     912        public void actionPerformed(ActionEvent e) {
     913            memberTableModel.reverse();
     914        }
     915
     916        protected void updateEnabledState() {
     917            setEnabled(memberTableModel.getRowCount() > 0);
     918        }
     919
     920        public void tableChanged(TableModelEvent e) {
     921            updateEnabledState();
     922        }
     923    }
     924
    897925    class MoveUpAction extends AbstractAction implements ListSelectionListener {
    898926        public MoveUpAction() {
  • trunk/src/org/openstreetmap/josm/gui/dialogs/relation/MemberTableModel.java

    r2655 r2700  
    744744
    745745    /**
     746     * Reverse the relation members.
     747     */
     748    void reverse() {
     749        Collections.reverse(members);
     750        fireTableDataChanged();
     751    }
     752
     753    /**
    746754     * Determines the direction of way k with respect to the way ref_i.
    747755     * The way ref_i is assumed to have the direction ref_direction and
Note: See TracChangeset for help on using the changeset viewer.