Ignore:
Timestamp:
2017-11-27T20:19:15+01:00 (9 years ago)
Author:
Don-vip
Message:

fix #15598 - relation editor: handle double click in child and referring browsers the same way (patch by cmuelle8, modified)

File:
1 edited

Legend:

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

    r13130 r13171  
    1010import java.awt.FlowLayout;
    1111import java.awt.event.ActionEvent;
     12import java.awt.event.MouseAdapter;
     13import java.awt.event.MouseEvent;
    1214import java.io.IOException;
    1315import java.net.HttpURLConnection;
     
    6668    private transient OsmDataLayer layer;
    6769
     70    /** the editAction used in the bottom panel and for doubleClick */
     71    private EditAction editAction;
     72
    6873    /**
    6974     * Replies the {@link OsmDataLayer} this editor is related to
     
    8590
    8691        add(buildButtonPanel(), BorderLayout.SOUTH);
     92        childTree.setToggleClickCount(0);
     93        childTree.addMouseListener(new MouseAdapter() {
     94            @Override
     95            public void mouseClicked(MouseEvent e) {
     96                if (e.getClickCount() == 2
     97                    && !e.isAltDown() && !e.isAltGraphDown() && !e.isControlDown() && !e.isMetaDown() && !e.isShiftDown()
     98                    && childTree.getRowForLocation(e.getX(), e.getY()) == childTree.getMinSelectionRow()) {
     99                    Relation r = (Relation) childTree.getLastSelectedPathComponent();
     100                    if (r.isIncomplete()) {
     101                        childTree.expandPath(childTree.getSelectionPath());
     102                    } else {
     103                        editAction.actionPerformed(new ActionEvent(e.getSource(), ActionEvent.ACTION_PERFORMED, null));
     104                    }
     105                }
     106            }
     107        });
    87108    }
    88109
     
    105126
    106127        // ---
    107         EditAction editAction = new EditAction();
     128        editAction = new EditAction();
    108129        childTree.addTreeSelectionListener(editAction);
    109130        pnl.add(new JButton(editAction));
Note: See TracChangeset for help on using the changeset viewer.