Changeset 3146 in josm for trunk/src


Ignore:
Timestamp:
2010-03-19T22:05:48+01:00 (10 years ago)
Author:
jttt
Message:

Use referrers when loading members of primitive in PropertiesDialog

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

Legend:

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

    r3124 r3146  
    8080/**
    8181 * A small tool dialog for displaying the current selection.
    82  * 
     82 *
    8383 */
    8484public class SelectionListDialog extends ToggleDialog  {
     
    9696    /**
    9797     * Builds the panel with the list of selected OSM primitives
    98      * 
     98     *
    9999     * @return the panel with the list of selected OSM primitives
    100100     */
     
    114114    /**
    115115     * Builds the row of action buttons at the bottom of this dialog
    116      * 
     116     *
    117117     * @return the panel
    118118     */
     
    147147    /**
    148148     * Builds the content panel for this dialog
    149      * 
     149     *
    150150     * @return the content panel
    151151     */
     
    326326    /**
    327327     * The action for zooming to the primitives in the current JOSM selection
    328      * 
     328     *
    329329     */
    330330    class ZoomToJOSMSelectionAction extends AbstractAction implements ListDataListener {
     
    361361     * The action for zooming to the primitives which are currently selected in
    362362     * the list displaying the JOSM selection
    363      * 
     363     *
    364364     */
    365365    class ZoomToListSelection extends AbstractAction implements ListSelectionListener{
     
    393393    /**
    394394     * The list model for the list of OSM primitives in the current JOSM selection.
    395      * 
     395     *
    396396     * The model also maintains a history of the last {@see SelectionListModel#SELECTION_HISTORY_SIZE}
    397397     * JOSM selection.
    398      * 
     398     *
    399399     */
    400400    static private class SelectionListModel extends AbstractListModel implements EditLayerChangeListener, SelectionChangedListener, DataSetListener{
     
    416416        /**
    417417         * Replies a summary of the current JOSM selection
    418          * 
     418         *
    419419         * @return a summary of the current JOSM selection
    420420         */
     
    436436        /**
    437437         * Remembers a JOSM selection the history of JOSM selections
    438          * 
     438         *
    439439         * @param selection the JOSM selection. Ignored if null or empty.
    440440         */
     
    455455        /**
    456456         * Replies the history of JOSM selections
    457          * 
     457         *
    458458         * @return
    459459         */
     
    473473         * Replies the collection of OSM primitives currently selected in the view
    474474         * of this model
    475          * 
     475         *
    476476         * @return
    477477         */
     
    488488        /**
    489489         * Sets the OSM primitives to be selected in the view of this model
    490          * 
     490         *
    491491         * @param sel the collection of primitives to select
    492492         */
     
    511511        /**
    512512         * Sets the collection of currently selected OSM objects
    513          * 
     513         *
    514514         * @param selection the collection of currently selected OSM objects
    515515         */
     
    529529         * Triggers a refresh of the view for all primitives in {@code toUpdate}
    530530         * which are currently displayed in the view
    531          * 
     531         *
    532532         * @param toUpdate the collection of primitives to update
    533533         */
     
    547547        /**
    548548         * Replies the list of selected relations with incomplete members
    549          * 
     549         *
    550550         * @return the list of selected relations with incomplete members
    551551         */
     
    654654    /**
    655655     * The popup menu for the search history entries
    656      * 
     656     *
    657657     */
    658658    protected static class SearchPopupMenu extends JPopupMenu {
     
    738738    /**
    739739     * Action for downloading incomplete members of selected relations
    740      * 
     740     *
    741741     */
    742742    class DownloadSelectedIncompleteMembersAction extends AbstractAction implements ListSelectionListener{
     
    778778
    779779    static private class OsmPrimitiveComparator implements Comparator<OsmPrimitive> {
    780         final private HashMap<Object, String> cache= new HashMap<Object, String>();
     780        final private HashMap<OsmPrimitive, String> cache= new HashMap<OsmPrimitive, String>();
    781781        final private DefaultNameFormatter df  = DefaultNameFormatter.getInstance();
    782782
  • trunk/src/org/openstreetmap/josm/gui/dialogs/properties/PropertiesDialog.java

    r2951 r3146  
    267267            value = null; // delete the key instead
    268268        }
    269         if (key.equals(newkey) && tr("<different>").equals(value)) {
     269        if (key.equals(newkey) && tr("<different>").equals(value))
    270270            return;
    271         }
    272271        if (key.equals(newkey) || value == null) {
    273272            Main.main.undoRedo.add(new ChangePropertyCommand(sel, newkey, value));
     
    763762
    764763        Map<Relation, Collection<RelationMember>> roles = new HashMap<Relation, Collection<RelationMember>>();
    765         if (Main.main.getCurrentDataSet() != null) {
    766             for (Relation r : Main.main.getCurrentDataSet().getRelations()) {
    767                 if (!r.isFiltered() && !r.isIncomplete() && !r.isDeleted()) {
     764        for (OsmPrimitive primitive: newSelection) {
     765            for (OsmPrimitive ref: primitive.getReferrers()) {
     766                if (ref instanceof Relation && !ref.isFiltered() && !ref.isIncomplete() && !ref.isDeleted()) {
     767                    Relation r = (Relation) ref;
    768768                    for (RelationMember m : r.getMembers()) {
    769                         if (newSelection.contains(m.getMember())) {
     769                        if (m.getMember() == primitive) {
    770770                            Collection<RelationMember> value = roles.get(r);
    771771                            if (value == null) {
     
    779779            }
    780780        }
     781
    781782        for (Entry<Relation, Collection<RelationMember>> e : roles.entrySet()) {
    782783            membershipData.addRow(new Object[]{e.getKey(), e.getValue()});
Note: See TracChangeset for help on using the changeset viewer.