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


Ignore:
Timestamp:
2015-10-20T16:49:10+02:00 (9 years ago)
Author:
Don-vip
Message:

move UserCancelException class in tools package and use it where applicable

Location:
trunk/src/org/openstreetmap/josm
Files:
10 edited
1 moved

Legend:

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

    r8856 r8919  
    2727import org.openstreetmap.josm.command.SequenceCommand;
    2828import org.openstreetmap.josm.corrector.ReverseWayTagCorrector;
    29 import org.openstreetmap.josm.corrector.UserCancelException;
    3029import org.openstreetmap.josm.data.osm.Node;
    3130import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    3938import org.openstreetmap.josm.tools.Pair;
    4039import org.openstreetmap.josm.tools.Shortcut;
     40import org.openstreetmap.josm.tools.UserCancelException;
    4141
    4242/**
  • trunk/src/org/openstreetmap/josm/actions/JoinAreasAction.java

    r8870 r8919  
    3030import org.openstreetmap.josm.command.DeleteCommand;
    3131import org.openstreetmap.josm.command.SequenceCommand;
    32 import org.openstreetmap.josm.corrector.UserCancelException;
    3332import org.openstreetmap.josm.data.UndoRedoHandler;
    3433import org.openstreetmap.josm.data.coor.EastNorth;
     
    4645import org.openstreetmap.josm.tools.Pair;
    4746import org.openstreetmap.josm.tools.Shortcut;
     47import org.openstreetmap.josm.tools.UserCancelException;
    4848import org.openstreetmap.josm.tools.Utils;
    4949
  • trunk/src/org/openstreetmap/josm/actions/MergeNodesAction.java

    r8513 r8919  
    2424import org.openstreetmap.josm.command.DeleteCommand;
    2525import org.openstreetmap.josm.command.SequenceCommand;
    26 import org.openstreetmap.josm.corrector.UserCancelException;
    2726import org.openstreetmap.josm.data.coor.EastNorth;
    2827import org.openstreetmap.josm.data.coor.LatLon;
     
    4039import org.openstreetmap.josm.tools.ImageProvider;
    4140import org.openstreetmap.josm.tools.Shortcut;
     41import org.openstreetmap.josm.tools.UserCancelException;
    4242
    4343/**
  • trunk/src/org/openstreetmap/josm/actions/ReverseWayAction.java

    r8855 r8919  
    2121import org.openstreetmap.josm.corrector.ReverseWayNoTagCorrector;
    2222import org.openstreetmap.josm.corrector.ReverseWayTagCorrector;
    23 import org.openstreetmap.josm.corrector.UserCancelException;
    2423import org.openstreetmap.josm.data.osm.Node;
    2524import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    2726import org.openstreetmap.josm.gui.Notification;
    2827import org.openstreetmap.josm.tools.Shortcut;
     28import org.openstreetmap.josm.tools.UserCancelException;
    2929import org.openstreetmap.josm.tools.Utils;
    3030
  • trunk/src/org/openstreetmap/josm/actions/SessionSaveAsAction.java

    r8918 r8919  
    4141import org.openstreetmap.josm.tools.GBC;
    4242import org.openstreetmap.josm.tools.MultiMap;
     43import org.openstreetmap.josm.tools.UserCancelException;
    4344import org.openstreetmap.josm.tools.Utils;
    4445import org.openstreetmap.josm.tools.WindowGeometry;
     
    6667        try {
    6768            saveSession();
    68         } catch (CancelException ignore) {
     69        } catch (UserCancelException ignore) {
    6970            if (Main.isTraceEnabled()) {
    7071                Main.trace(ignore.getMessage());
     
    7475
    7576    /**
    76      * Denotes that the user has cancelled the save process.
     77     * Attempts to save the session.
     78     * @throws UserCancelException when the user has cancelled the save process.
    7779     * @since 8913
    7880     */
    79     public static class CancelException extends Exception {
    80     }
    81 
    82     /**
    83      * Attempts to save the session.
    84      * @throws CancelException when the user has cancelled the save process.
    85      * @since 8913
    86      */
    87     public void saveSession() throws CancelException {
     81    public void saveSession() throws UserCancelException {
    8882        if (!isEnabled()) {
    8983            return;
     
    9387        dlg.showDialog();
    9488        if (dlg.getValue() != 1) {
    95             throw new CancelException();
     89            throw new UserCancelException();
    9690        }
    9791
     
    118112
    119113        if (fc == null) {
    120             throw new CancelException();
     114            throw new UserCancelException();
    121115        }
    122116
     
    142136            file = new File(file.getPath() + (zip ? ".joz" : ".jos"));
    143137            if (!SaveActionBase.confirmOverwrite(file)) {
    144                 throw new CancelException();
     138                throw new UserCancelException();
    145139            }
    146140        }
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayNoTagCorrector.java

    r8408 r8919  
    1515import org.openstreetmap.josm.gui.ConditionalOptionPaneUtil;
    1616import org.openstreetmap.josm.gui.DefaultNameFormatter;
     17import org.openstreetmap.josm.tools.UserCancelException;
    1718import org.openstreetmap.josm.tools.Utils;
    1819
  • trunk/src/org/openstreetmap/josm/corrector/ReverseWayTagCorrector.java

    r8846 r8919  
    2121import org.openstreetmap.josm.data.osm.TagCollection;
    2222import org.openstreetmap.josm.data.osm.Way;
     23import org.openstreetmap.josm.tools.UserCancelException;
    2324
    2425/**
  • trunk/src/org/openstreetmap/josm/corrector/TagCorrector.java

    r8846 r8919  
    3232import org.openstreetmap.josm.tools.GBC;
    3333import org.openstreetmap.josm.tools.ImageProvider;
     34import org.openstreetmap.josm.tools.UserCancelException;
    3435
    3536/**
  • trunk/src/org/openstreetmap/josm/gui/conflict/tags/CombinePrimitiveResolverDialog.java

    r8871 r8919  
    3434import org.openstreetmap.josm.command.ChangePropertyCommand;
    3535import org.openstreetmap.josm.command.Command;
    36 import org.openstreetmap.josm.corrector.UserCancelException;
    3736import org.openstreetmap.josm.data.osm.Node;
    3837import org.openstreetmap.josm.data.osm.OsmPrimitive;
     
    4847import org.openstreetmap.josm.tools.CheckParameterUtil;
    4948import org.openstreetmap.josm.tools.ImageProvider;
     49import org.openstreetmap.josm.tools.UserCancelException;
    5050import org.openstreetmap.josm.tools.Utils;
    5151import org.openstreetmap.josm.tools.Utils.Function;
  • trunk/src/org/openstreetmap/josm/gui/io/SaveLayersDialog.java

    r8918 r8919  
    5252import org.openstreetmap.josm.tools.GBC;
    5353import org.openstreetmap.josm.tools.ImageProvider;
     54import org.openstreetmap.josm.tools.UserCancelException;
    5455import org.openstreetmap.josm.tools.Utils;
    5556import org.openstreetmap.josm.tools.WindowGeometry;
     
    375376                setUserAction(UserAction.PROCEED);
    376377                closeDialog();
    377             } catch (CancelException ignore) {
     378            } catch (UserCancelException ignore) {
    378379                if (Main.isTraceEnabled()) {
    379380                    Main.trace(ignore.getMessage());
  • trunk/src/org/openstreetmap/josm/tools/UserCancelException.java

    r8917 r8919  
    11// License: GPL. For details, see LICENSE file.
    2 package org.openstreetmap.josm.corrector;
     2package org.openstreetmap.josm.tools;
    33
     4/**
     5 * Exception thrown when an operation is canceled by user.
     6 * @since 1001 (creation)
     7 * @since 8919 (move into this package)
     8 */
    49public class UserCancelException extends Exception {
    510
     11    /**
     12     * Constructs a new {@code UserCancelException}.
     13     */
     14    public UserCancelException() {
     15        super();
     16    }
     17
     18    /**
     19     * Constructs a new {@code UserCancelException} with the specified detail message and cause.
     20     *
     21     * @param  message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
     22     * @param  cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
     23     *         (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.)
     24     */
     25    public UserCancelException(String message, Throwable cause) {
     26        super(message, cause);
     27    }
     28
     29    /**
     30     * Constructs a new {@code UserCancelException} with the specified detail message.
     31     *
     32     * @param  message the detail message (which is saved for later retrieval by the {@link #getMessage()} method).
     33     */
     34    public UserCancelException(String message) {
     35        super(message);
     36    }
     37
     38    /**
     39     * Constructs a new {@code UserCancelException} with the specified cause.
     40     *
     41     * @param  cause the cause (which is saved for later retrieval by the {@link #getCause()} method).
     42     *         (A <tt>null</tt> value is permitted, and indicates that the cause is nonexistent or unknown.)
     43     */
     44    public UserCancelException(Throwable cause) {
     45        super(cause);
     46    }
    647}
Note: See TracChangeset for help on using the changeset viewer.