Changeset 11553 in josm for trunk/src/org/openstreetmap/josm/gui/io
- Timestamp:
- 2017-02-12T16:32:18+01:00 (7 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui/io
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/CloseChangesetTask.java
r10611 r11553 8 8 import java.util.Collection; 9 9 import java.util.List; 10 import java.util.Optional; 10 11 11 12 import javax.swing.SwingUtilities; … … 38 39 public CloseChangesetTask(Collection<Changeset> changesets) { 39 40 super(tr("Closing changeset"), false /* don't ignore exceptions */); 40 if (changesets == null) { 41 changesets = new ArrayList<>(); 42 } 43 this.changesets = changesets; 41 this.changesets = Optional.ofNullable(changesets).orElseGet(ArrayList::new); 44 42 this.closedChangesets = new ArrayList<>(); 45 43 } -
trunk/src/org/openstreetmap/josm/gui/io/SaveLayerTask.java
r10378 r11553 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.util.Optional; 5 7 6 8 import org.openstreetmap.josm.Main; … … 38 40 protected SaveLayerTask(SaveLayerInfo layerInfo, ProgressMonitor monitor) { 39 41 CheckParameterUtil.ensureParameterNotNull(layerInfo, "layerInfo"); 40 if (monitor == null) {41 monitor = NullProgressMonitor.INSTANCE;42 }43 42 this.layerInfo = layerInfo; 44 this.parentMonitor = monitor;43 this.parentMonitor = Optional.ofNullable(monitor).orElse(NullProgressMonitor.INSTANCE); 45 44 } 46 45 -
trunk/src/org/openstreetmap/josm/gui/io/TagSettingsPanel.java
r10413 r11553 4 4 import java.awt.BorderLayout; 5 5 import java.util.Map; 6 import java.util.Optional; 6 7 7 8 import javax.swing.JPanel; … … 125 126 if (e.getSource() instanceof ChangesetCommentModel) { 126 127 String newValue = ((ChangesetCommentModel) e.getSource()).getComment(); 127 String oldValue = getTagEditorValue(key); 128 if (oldValue == null) { 129 oldValue = ""; 130 } 128 String oldValue = Optional.ofNullable(getTagEditorValue(key)).orElse(""); 131 129 if (!oldValue.equals(newValue)) { 132 130 setProperty(key, newValue); -
trunk/src/org/openstreetmap/josm/gui/io/UploadDialog.java
r11452 r11553 25 25 import java.util.Map; 26 26 import java.util.Map.Entry; 27 import java.util.Optional; 27 28 import java.util.concurrent.TimeUnit; 28 29 … … 343 344 */ 344 345 public Changeset getChangeset() { 345 Changeset cs = pnlChangesetManagement.getSelectedChangeset(); 346 if (cs == null) { 347 cs = new Changeset(); 348 } 346 Changeset cs = Optional.ofNullable(pnlChangesetManagement.getSelectedChangeset()).orElseGet(Changeset::new); 349 347 cs.setKeys(pnlTagSettings.getTags(false)); 350 348 return cs; -
trunk/src/org/openstreetmap/josm/gui/io/UploadLayerTask.java
r11386 r11553 6 6 import java.util.Collection; 7 7 import java.util.HashSet; 8 import java.util.Optional; 8 9 import java.util.Set; 9 10 … … 62 63 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 63 64 CheckParameterUtil.ensureParameterNotNull(strategy, "strategy"); 64 if (monitor == null) {65 monitor = NullProgressMonitor.INSTANCE;66 }67 65 this.layer = layer; 68 this.monitor = monitor;66 this.monitor = Optional.ofNullable(monitor).orElse(NullProgressMonitor.INSTANCE); 69 67 this.changeset = changeset; 70 68 this.strategy = strategy; -
trunk/src/org/openstreetmap/josm/gui/io/UploadNoteLayerTask.java
r8624 r11553 3 3 4 4 import static org.openstreetmap.josm.tools.I18n.tr; 5 6 import java.util.Optional; 5 7 6 8 import org.openstreetmap.josm.actions.upload.UploadNotesTask; … … 29 31 public UploadNoteLayerTask(NoteLayer layer, ProgressMonitor monitor) { 30 32 CheckParameterUtil.ensureParameterNotNull(layer, "layer"); 31 if (monitor == null) {32 monitor = NullProgressMonitor.INSTANCE;33 }34 33 this.layer = layer; 35 this.monitor = monitor;34 this.monitor = Optional.ofNullable(monitor).orElse(NullProgressMonitor.INSTANCE); 36 35 } 37 36 -
trunk/src/org/openstreetmap/josm/gui/io/UploadedObjectsSummaryPanel.java
r10378 r11553 9 9 import java.util.ArrayList; 10 10 import java.util.List; 11 import java.util.Optional; 11 12 12 13 import javax.swing.AbstractListModel; … … 174 175 175 176 public void setPrimitives(List<OsmPrimitive> primitives) { 176 if (primitives == null) { 177 this.primitives = new ArrayList<>(); 178 } else { 179 this.primitives = primitives; 180 } 177 this.primitives = Optional.ofNullable(primitives).orElseGet(ArrayList::new); 181 178 fireContentsChanged(this, 0, getSize()); 182 179 }
Note:
See TracChangeset
for help on using the changeset viewer.