Changeset 9676 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-29T22:18:37+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r9670 r9676 24 24 import org.openstreetmap.josm.tools.Shortcut; 25 25 26 /** 27 * Abstract superclass of save actions. 28 * @since 290 29 */ 26 30 public abstract class SaveActionBase extends DiskAccessAction { 27 31 private File file; 28 32 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 */ 29 40 public SaveActionBase(String name, String iconName, String tooltip, Shortcut shortcut) { 30 41 super(name, iconName, tooltip, shortcut); … … 38 49 } 39 50 51 /** 52 * Saves the active layer. 53 * @return {@code true} if the save operation succeeds 54 */ 40 55 public boolean doSave() { 41 56 if (Main.isDisplayingMapView()) { … … 48 63 } 49 64 65 /** 66 * Saves the given layer. 67 * @param layer layer to save 68 * @return {@code true} if the save operation succeeds 69 */ 50 70 public boolean doSave(Layer layer) { 51 71 if (!layer.checkSaveConditions()) … … 160 180 * 161 181 * @param fc FileChooser where file was already selected 182 * @param extension file extension 162 183 * @return the {@code File} or {@code null} if the user cancelled the dialog. 163 184 */ 164 185 public static File checkFileAndConfirmOverWrite(AbstractFileChooser fc, String extension) { 165 if (fc == null) return null; 186 if (fc == null) 187 return null; 166 188 File file = fc.getSelectedFile(); 167 189 … … 190 212 } 191 213 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 */ 192 219 public static boolean confirmOverwrite(File file) { 193 if (file == null || (file.exists())) {220 if (file == null || file.exists()) { 194 221 ExtendedDialog dialog = new ExtendedDialog( 195 222 Main.parent, … … 210 237 filepath = file.getCanonicalPath(); 211 238 } catch (IOException ign) { 239 Main.warn(ign); 212 240 return; 213 241 }
Note:
See TracChangeset
for help on using the changeset viewer.