Changeset 9291 in josm


Ignore:
Timestamp:
2016-01-03T23:59:26+01:00 (9 years ago)
Author:
simon04
Message:

Refactoring (clearer method names in UnGlueAction)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java

    r9230 r9291  
    7272        String errMsg = null;
    7373        int errorTime = Notification.TIME_DEFAULT;
    74         if (checkSelection(selection)) {
     74        if (checkSelectionOneNodeAtMostOneWay(selection)) {
    7575            if (!checkAndConfirmOutlyingUnglue()) {
    7676                // FIXME: Leaving action without clearing selectedNode, selectedWay, selectedNodes
     
    9494                if (!selfCrossing)
    9595                    if (checkForUnglueNode(selection)) {
    96                         unglueNode(e);
     96                        unglueOneNodeAtMostOneWay(e);
    9797                    } else {
    9898                        errorTime = Notification.TIME_SHORT;
     
    103103                unglueWays();
    104104            }
    105         } else if (checkSelection2(selection)) {
     105        } else if (checkSelectionOneWayAnyNodes(selection)) {
    106106            if (!checkAndConfirmOutlyingUnglue()) {
    107107                // FIXME: Leaving action without clearing selectedNode, selectedWay, selectedNodes
     
    130130                // and then do the work.
    131131                selectedNodes = tmpNodes;
    132                 unglueWays2();
     132                unglueOneWayAnyNodes();
    133133            }
    134134        } else {
     
    167167     * @param e event that trigerred the action
    168168     */
    169     private void unglueNode(ActionEvent e) {
     169    private void unglueOneNodeAtMostOneWay(ActionEvent e) {
    170170        List<Command> cmds = new LinkedList<>();
    171171
     
    227227     * @return true if either one node is selected or one node and one way are selected and the node is part of the way
    228228     */
    229     private boolean checkSelection(Collection<? extends OsmPrimitive> selection) {
     229    private boolean checkSelectionOneNodeAtMostOneWay(Collection<? extends OsmPrimitive> selection) {
    230230
    231231        int size = selection.size();
     
    262262     * @return true if one way and any number of nodes that are part of that way are selected
    263263     */
    264     private boolean checkSelection2(Collection<? extends OsmPrimitive> selection) {
     264    private boolean checkSelectionOneWayAnyNodes(Collection<? extends OsmPrimitive> selection) {
    265265        if (selection.isEmpty())
    266266            return false;
     
    467467     *
    468468     */
    469     private void unglueWays2() {
     469    private void unglueOneWayAnyNodes() {
    470470        List<Command> cmds = new LinkedList<>();
    471471        List<Node> allNewNodes = new LinkedList<>();
Note: See TracChangeset for help on using the changeset viewer.