Ticket #1575: relationListDialog.patch

File relationListDialog.patch, 2.2 KB (added by Mike Forster <email@…>, 4 years ago)

Patch that implements the requested functionality

  • org/openstreetmap/josm/gui/dialogs/RelationListDialog.java

     
    1717import javax.swing.JPanel; 
    1818import javax.swing.JScrollPane; 
    1919import javax.swing.ListSelectionModel; 
     20import javax.swing.event.ListSelectionListener; 
    2021 
    2122import org.openstreetmap.josm.Main; 
    2223import org.openstreetmap.josm.command.DeleteCommand; 
     
    143144                repaint(); 
    144145        } 
    145146         
     147        /** 
     148         * Returns the currently selected relation, or null. 
     149         *  
     150         * @return the currently selected relation, or null 
     151         */ 
     152        public Relation getCurrentRelation() { 
     153                return (Relation) displaylist.getSelectedValue(); 
     154        } 
     155 
     156        /** 
     157         * Adds a selection listener to the relation list. 
     158         *  
     159         * @param listener the listener to add 
     160         */ 
     161        public void addListSelectionListener(ListSelectionListener listener) { 
     162                displaylist.addListSelectionListener(listener); 
     163        } 
     164 
     165        /** 
     166         * Removes a selection listener from the relation list. 
     167         *  
     168         * @param listener the listener to remove 
     169         */ 
     170        public void removeListSelectionListener(ListSelectionListener listener) { 
     171                displaylist.removeListSelectionListener(listener); 
     172        } 
    146173} 
  • org/openstreetmap/josm/gui/MapFrame.java

     
    5959 
    6060        public ConflictDialog conflictDialog; 
    6161        /** 
     62         * The dialog that shows all relations and lets the user edit them. 
     63         */ 
     64        public RelationListDialog relationListDialog; 
     65        /** 
    6266         * The panel list of all toggle dialog icons. To add new toggle dialog actions, use addToggleDialog 
    6367         * instead of adding directly to this list. 
    6468         */ 
     
    99103                addToggleDialog(new UserListDialog()); 
    100104                addToggleDialog(conflictDialog = new ConflictDialog()); 
    101105                addToggleDialog(new CommandStackDialog(this)); 
    102                 addToggleDialog(new RelationListDialog()); 
     106                addToggleDialog(relationListDialog = new RelationListDialog()); 
    103107 
    104108                // status line below the map 
    105109                statusLine = new MapStatus(this);