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


Ignore:
Timestamp:
2016-01-29T22:18:37+01:00 (9 years ago)
Author:
Don-vip
Message:

javadoc, findbugs

File:
1 edited

Legend:

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

    r9670 r9676  
    2424import org.openstreetmap.josm.tools.Shortcut;
    2525
     26/**
     27 * Abstract superclass of save actions.
     28 * @since 290
     29 */
    2630public abstract class SaveActionBase extends DiskAccessAction {
    2731    private File file;
    2832
     33    /**
     34     * Constructs a new {@code SaveActionBase}.
     35     * @param name The action's text as displayed on the menu (if it is added to a menu)
     36     * @param iconName The filename of the icon to use
     37     * @param tooltip A longer description of the action that will be displayed in the tooltip
     38     * @param shortcut A ready-created shortcut object or {@code null} if you don't want a shortcut
     39     */
    2940    public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut) {
    3041        super(name, iconName, tooltip, shortcut);
     
    3849    }
    3950
     51    /**
     52     * Saves the active layer.
     53     * @return {@code true} if the save operation succeeds
     54     */
    4055    public boolean doSave() {
    4156        if (Main.isDisplayingMapView()) {
     
    4863    }
    4964
     65    /**
     66     * Saves the given layer.
     67     * @param layer layer to save
     68     * @return {@code true} if the save operation succeeds
     69     */
    5070    public boolean doSave(Layer layer) {
    5171        if (!layer.checkSaveConditions())
     
    160180     *
    161181     * @param fc FileChooser where file was already selected
     182     * @param extension file extension
    162183     * @return the {@code File} or {@code null} if the user cancelled the dialog.
    163184     */
    164185    public static File checkFileAndConfirmOverWrite(AbstractFileChooser fc, String extension) {
    165         if (fc == null) return null;
     186        if (fc == null)
     187            return null;
    166188        File file = fc.getSelectedFile();
    167189
     
    190212    }
    191213
     214    /**
     215     * Asks user to confirm overwiting a file.
     216     * @param file file to overwrite
     217     * @return {@code true} if the file can be written
     218     */
    192219    public static boolean confirmOverwrite(File file) {
    193         if (file == null || (file.exists())) {
     220        if (file == null || file.exists()) {
    194221            ExtendedDialog dialog = new ExtendedDialog(
    195222                    Main.parent,
     
    210237            filepath = file.getCanonicalPath();
    211238        } catch (IOException ign) {
     239            Main.warn(ign);
    212240            return;
    213241        }
Note: See TracChangeset for help on using the changeset viewer.