Changeset 9510 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-17T20:09:12+01:00 (9 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/RenameLayerAction.java
r9230 r9510 86 86 if (Main.platform.rename(file, newFile)) { 87 87 layer.setAssociatedFile(newFile); 88 nameText = newFile.getName(); 88 if (!layer.isRenamed()) { 89 nameText = newFile.getName(); 90 } 89 91 } else { 90 92 JOptionPane.showMessageDialog( … … 98 100 } 99 101 } 100 layer. setName(nameText);102 layer.rename(nameText); 101 103 Main.parent.repaint(); 102 104 } -
trunk/src/org/openstreetmap/josm/actions/SaveActionBase.java
r9466 r9510 93 93 return false; 94 94 } 95 layer.setName(file.getName()); 95 if (!layer.isRenamed()) { 96 layer.setName(file.getName()); 97 } 96 98 layer.setAssociatedFile(file); 97 99 if (layer instanceof OsmDataLayer) { -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r9413 r9510 1601 1601 break; 1602 1602 case 2: 1603 l. setName((String) value);1603 l.rename((String) value); 1604 1604 break; 1605 1605 default: throw new RuntimeException(); -
trunk/src/org/openstreetmap/josm/gui/layer/Layer.java
r9231 r9510 62 62 /** 63 63 * Special class that can be returned by getMenuEntries when JSeparator needs to be created 64 *65 64 */ 66 65 public static class SeparatorLayerAction extends AbstractAction implements LayerAction { … … 90 89 public static final int ICON_SIZE = 16; 91 90 92 /** keeps track of property change listeners */ 91 /** 92 * keeps track of property change listeners 93 */ 93 94 protected PropertyChangeSupport propertyChangeSupport; 94 95 95 96 /** 96 97 * The visibility state of the layer. 97 *98 98 */ 99 99 private boolean visible = true; … … 101 101 /** 102 102 * The opacity of the layer. 103 *104 103 */ 105 104 private double opacity = 1; … … 107 106 /** 108 107 * The layer should be handled as a background layer in automatic handling 109 *110 108 */ 111 109 private boolean background; … … 113 111 /** 114 112 * The name of this layer. 115 * 116 */ 117 private String name; 113 */ 114 private String name; 115 116 /** 117 * This is set if user renamed this layer. 118 */ 119 private boolean renamed = false; 118 120 119 121 /** … … 264 266 * Sets the name of the layer 265 267 * 266 *@param name the name. If null, the name is set to the empty string. 267 * 268 * @param name the name. If null, the name is set to the empty string. 268 269 */ 269 270 public final void setName(String name) { … … 276 277 propertyChangeSupport.firePropertyChange(NAME_PROP, oldValue, this.name); 277 278 } 279 } 280 281 /** 282 * Rename layer and set renamed flag to mark it as renamed (has user given name). 283 * 284 * @param name the name. If null, the name is set to the empty string. 285 */ 286 public final void rename(String name) { 287 renamed = true; 288 setName(name); 289 } 290 291 /** 292 * Replies true if this layer was renamed by user 293 * 294 * @return true if this layer was renamed by user 295 */ 296 public boolean isRenamed() { 297 return renamed; 278 298 } 279 299 … … 427 447 /** 428 448 * The action to save a layer 429 *430 449 */ 431 450 public static class LayerSaveAction extends AbstractAction {
Note:
See TracChangeset
for help on using the changeset viewer.