Changeset 13849 in josm
- Timestamp:
- 2018-05-26T19:36:19+02:00 (6 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 1 added
- 33 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetContentDownloadTask.java
r12620 r13849 78 78 setCanceled(true); 79 79 Logging.trace(e); 80 return;81 80 } catch (OsmTransferException e) { 82 if ( isCanceled())83 re turn;84 rememberLastException(e);81 if (!isCanceled()) { 82 rememberLastException(e); 83 } 85 84 } 86 85 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r12620 r13849 120 120 JOptionPane.ERROR_MESSAGE)); 121 121 } 122 return;123 122 } 124 123 } -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r13444 r13849 275 275 } 276 276 277 mv.setNewCursor(getCursor(c ), this);277 mv.setNewCursor(getCursor(c.orElse(null)), this); 278 278 279 279 // return early if there can't be any highlights … … 296 296 * features. The only exception is the "move" cursor when actually dragging 297 297 * primitives. 298 * @param nearbyStuff 298 * @param nearbyStuff primitives near the cursor 299 299 * @return the cursor that should be displayed 300 300 */ 301 private Cursor getCursor(O ptional<OsmPrimitive>nearbyStuff) {301 private Cursor getCursor(OsmPrimitive nearbyStuff) { 302 302 String c = "rect"; 303 303 switch(mode) { … … 307 307 break; 308 308 } 309 final OsmPrimitive osm = nearbyStuff .orElse(null);309 final OsmPrimitive osm = nearbyStuff; 310 310 311 311 if (dragInProgress()) { … … 516 516 needsRepaint = true; 517 517 } 518 mv.setNewCursor(getCursor( Optional.ofNullable(p)), this);518 mv.setNewCursor(getCursor(p), this); 519 519 // also update the stored mouse event, so we can display the correct cursor 520 520 // when dragging a node onto another one and then press CTRL to merge -
trunk/src/org/openstreetmap/josm/data/Preferences.java
r13838 r13849 406 406 continue; 407 407 Utils.instanceOfAndCast(e.getValue(), ListSetting.class) 408 .map( d -> d.getValue())408 .map(ListSetting::getValue) 409 409 .map(lst -> ColorInfo.fromPref(lst, false)) 410 410 .ifPresent(info -> all.put(e.getKey(), info)); … … 414 414 continue; 415 415 Utils.instanceOfAndCast(e.getValue(), ListSetting.class) 416 .map( d -> d.getValue())416 .map(ListSetting::getValue) 417 417 .map(lst -> ColorInfo.fromPref(lst, true)) 418 418 .ifPresent(infoDef -> { -
trunk/src/org/openstreetmap/josm/data/projection/ProjectionCLI.java
r13207 r13849 33 33 public static final ProjectionCLI INSTANCE = new ProjectionCLI(); 34 34 35 private boolean argInverse = false; // NOPMD36 private boolean argSwitchInput = false; // NOPMD37 private boolean argSwitchOutput = false; // NOPMD35 private boolean argInverse; 36 private boolean argSwitchInput; 37 private boolean argSwitchOutput; 38 38 39 39 @Override … … 77 77 if (arg.isEmpty()) throw new IllegalArgumentException("non-empty argument expected"); 78 78 if (arg.startsWith("+")) { 79 if ( arg.equals("+to")) {79 if ("+to".equals(arg)) { 80 80 toTokenSeen = true; 81 81 } else { … … 142 142 } 143 143 144 if (files.isEmpty() || files.get(0).equals("-")) {144 if (files.isEmpty() || "-".equals(files.get(0))) { 145 145 processInput(fromProj, toProj, new BufferedReader(new InputStreamReader(System.in, Charset.defaultCharset()))); 146 146 } else { … … 174 174 } 175 175 176 private CustomProjection createProjection(String params) throws ProjectionConfigurationException {176 private static CustomProjection createProjection(String params) throws ProjectionConfigurationException { 177 177 CustomProjection proj = new CustomProjection(); 178 178 proj.update(params); -
trunk/src/org/openstreetmap/josm/data/validation/tests/WronglyOrderedWays.java
r11129 r13849 37 37 38 38 String natural = w.get("natural"); 39 if (natural == null) 39 if (natural == null) { 40 40 return; 41 else if ("coastline".equals(natural) && Geometry.isClockwise(w)) {41 } else if ("coastline".equals(natural) && Geometry.isClockwise(w)) { 42 42 reportError(w, tr("Reversed coastline: land not on left side"), WRONGLY_ORDERED_COAST); 43 43 } else if ("land".equals(natural) && Geometry.isClockwise(w)) { 44 44 reportError(w, tr("Reversed land: land not on left side"), WRONGLY_ORDERED_LAND); 45 } else 46 return; 47 45 } 48 46 } 49 47 -
trunk/src/org/openstreetmap/josm/gui/ExceptionDialogUtil.java
r13761 r13849 194 194 if (ex != null) { 195 195 // Users should be able to submit a bug report for an invocation target exception 196 //197 196 BugReportExceptionHandler.handleException(ex); 198 return;199 197 } 200 198 } -
trunk/src/org/openstreetmap/josm/gui/autofilter/AutoFilterRule.java
r12414 r13849 5 5 import java.util.Objects; 6 6 import java.util.function.Function; 7 import java.util.function.UnaryOperator; 7 8 8 9 /** … … 19 20 private final int minZoomLevel; 20 21 21 private Function<String,String> valueFormatter = s -> s;22 private UnaryOperator<String> valueFormatter = s -> s; 22 23 23 24 private Comparator<String> valueComparator = Comparator.comparingInt(s -> Integer.parseInt(valueFormatter.apply(s))); … … 63 64 * @throws NullPointerException if {@code valueFormatter} is null 64 65 */ 65 public AutoFilterRule setValueFormatter( Function<String,String> valueFormatter) {66 public AutoFilterRule setValueFormatter(UnaryOperator<String> valueFormatter) { 66 67 this.valueFormatter = Objects.requireNonNull(valueFormatter); 67 68 return this; -
trunk/src/org/openstreetmap/josm/gui/dialogs/LayerListDialog.java
r13821 r13849 604 604 AbstractProperty<Color> prop = layer.getColorProperty(); 605 605 Color c = prop == null ? null : prop.get(); 606 if (c == null || !model.getLayers().stream()606 if (c == null || model.getLayers().stream() 607 607 .map(Layer::getColorProperty) 608 608 .filter(Objects::nonNull) 609 609 .map(AbstractProperty::get) 610 . anyMatch(oc -> oc != null && !oc.equals(c))) {610 .noneMatch(oc -> oc != null && !oc.equals(c))) { 611 611 /* not more than one color, don't use coloring */ 612 612 label.setForeground(UIManager.getColor(isSelected ? "Table.selectionForeground" : "Table.foreground")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/DateValidator.java
r12620 r13849 78 78 String msg = "<html>The current value isn't a valid date.<br>" + getStandardTooltipText()+ "</html>"; 79 79 feedbackInvalid(msg); 80 return;81 80 } else { 82 81 String msg = "<html>" + getStandardTooltipText() + "</html>"; -
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/query/TimeValidator.java
r12620 r13849 80 80 String msg = "<html>The current value isn't a valid time.<br>" + getStandardTooltipText() + "</html>"; 81 81 feedbackInvalid(msg); 82 return;83 82 } else { 84 83 String msg = "<html>" + getStandardTooltipText() + "</html>"; -
trunk/src/org/openstreetmap/josm/gui/dialogs/layer/LayerVisibilityAction.java
r12419 r13849 300 300 Collection<? extends Layer> usedLayers = filterLayers(layers); 301 301 setVisible(!usedLayers.isEmpty()); 302 if ( !usedLayers.stream().anyMatch(Layer::isVisible)) {302 if (usedLayers.stream().noneMatch(Layer::isVisible)) { 303 303 slider.setEnabled(false); 304 304 } else { -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/AbstractCopyAction.java
r13521 r13849 7 7 import java.util.Set; 8 8 import java.util.TreeSet; 9 import java.util.function. Function;9 import java.util.function.IntFunction; 10 10 import java.util.function.Supplier; 11 11 … … 24 24 25 25 private final JTable tagTable; 26 private final Function<Integer,String> keySupplier;26 private final IntFunction<String> keySupplier; 27 27 private final Supplier<Collection<? extends Tagged>> objectSupplier; 28 28 … … 33 33 * @param objectSupplier a supplier which returns the selected tagged object(s) 34 34 */ 35 public AbstractCopyAction(JTable tagTable, Function<Integer,String> keySupplier, Supplier<Collection<? extends Tagged>> objectSupplier) {35 public AbstractCopyAction(JTable tagTable, IntFunction<String> keySupplier, Supplier<Collection<? extends Tagged>> objectSupplier) { 36 36 this.tagTable = Objects.requireNonNull(tagTable); 37 37 this.keySupplier = Objects.requireNonNull(keySupplier); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/CopyAllKeyValueAction.java
r13521 r13849 9 9 import java.util.List; 10 10 import java.util.Map.Entry; 11 import java.util.function. Function;11 import java.util.function.IntFunction; 12 12 import java.util.function.Supplier; 13 13 … … 31 31 * @param objectSp a supplier which returns the selected tagged object(s) 32 32 */ 33 public CopyAllKeyValueAction(JTable tagTable, Function<Integer,String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) {33 public CopyAllKeyValueAction(JTable tagTable, IntFunction<String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) { 34 34 super(tagTable, keyFn, objectSp); 35 35 putValue(NAME, tr("Copy all Keys/Values")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/CopyKeyValueAction.java
r13521 r13849 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 import java.util.function. Function;8 import java.util.function.IntFunction; 9 9 import java.util.function.Supplier; 10 10 … … 26 26 * @param objectSp a supplier which returns the selected tagged object(s) 27 27 */ 28 public CopyKeyValueAction(JTable tagTable, Function<Integer,String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) {28 public CopyKeyValueAction(JTable tagTable, IntFunction<String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) { 29 29 super(tagTable, keyFn, objectSp); 30 30 putValue(NAME, tr("Copy selected Key(s)/Value(s)")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/CopyValueAction.java
r13521 r13849 6 6 import java.util.Collection; 7 7 import java.util.Collections; 8 import java.util.function. Function;8 import java.util.function.IntFunction; 9 9 import java.util.function.Supplier; 10 10 … … 25 25 * @param objectSp a supplier which returns the selected tagged object(s) 26 26 */ 27 public CopyValueAction(JTable tagTable, Function<Integer,String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) {27 public CopyValueAction(JTable tagTable, IntFunction<String> keyFn, Supplier<Collection<? extends Tagged>> objectSp) { 28 28 super(tagTable, keyFn, objectSp); 29 29 putValue(NAME, tr("Copy Value")); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/HelpAction.java
r13522 r13849 14 14 import java.util.Map; 15 15 import java.util.Objects; 16 import java.util.function. Function;16 import java.util.function.IntFunction; 17 17 18 18 import javax.swing.AbstractAction; … … 36 36 public class HelpAction extends AbstractAction { 37 37 private final JTable tagTable; 38 private final Function<Integer,String> tagKeySupplier;39 private final Function<Integer,Map<String, Integer>> tagValuesSupplier;38 private final IntFunction<String> tagKeySupplier; 39 private final IntFunction<Map<String, Integer>> tagValuesSupplier; 40 40 41 41 private final JTable membershipTable; 42 private final Function<Integer,Relation> memberValueSupplier;42 private final IntFunction<Relation> memberValueSupplier; 43 43 44 44 /** … … 50 50 * @param memberValueSupplier Finds the parent relation from given row of membership table. Can be null 51 51 */ 52 public HelpAction(JTable tagTable, Function<Integer, String> tagKeySupplier, Function<Integer,Map<String, Integer>> tagValuesSupplier,53 JTable membershipTable, Function<Integer,Relation> memberValueSupplier) {52 public HelpAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier, 53 JTable membershipTable, IntFunction<Relation> memberValueSupplier) { 54 54 this.tagTable = Objects.requireNonNull(tagTable); 55 55 this.tagKeySupplier = Objects.requireNonNull(tagKeySupplier); -
trunk/src/org/openstreetmap/josm/gui/dialogs/properties/TaginfoAction.java
r13521 r13849 7 7 import java.util.Map; 8 8 import java.util.Objects; 9 import java.util.function. Function;9 import java.util.function.IntFunction; 10 10 11 11 import javax.swing.JTable; … … 26 26 27 27 private final JTable tagTable; 28 private final Function<Integer,String> tagKeySupplier;29 private final Function<Integer,Map<String, Integer>> tagValuesSupplier;28 private final IntFunction<String> tagKeySupplier; 29 private final IntFunction<Map<String, Integer>> tagValuesSupplier; 30 30 31 31 private final JTable membershipTable; 32 private final Function<Integer,Relation> memberValueSupplier;32 private final IntFunction<Relation> memberValueSupplier; 33 33 34 34 /** … … 40 40 * @param memberValueSupplier Finds the parent relation from given row of membership table. Can be null 41 41 */ 42 public TaginfoAction(JTable tagTable, Function<Integer, String> tagKeySupplier, Function<Integer,Map<String, Integer>> tagValuesSupplier,43 JTable membershipTable, Function<Integer,Relation> memberValueSupplier) {42 public TaginfoAction(JTable tagTable, IntFunction<String> tagKeySupplier, IntFunction<Map<String, Integer>> tagValuesSupplier, 43 JTable membershipTable, IntFunction<Relation> memberValueSupplier) { 44 44 super(tr("Go to Taginfo"), "dialogs/taginfo", tr("Launch browser with Taginfo statistics for selected object"), null, false); 45 45 this.tagTable = Objects.requireNonNull(tagTable); -
trunk/src/org/openstreetmap/josm/gui/dialogs/relation/actions/AddFromSelectionAction.java
r12846 r13849 52 52 ret.add(primitive); 53 53 } 54 continue;55 54 } else { 56 55 ret.add(primitive); -
trunk/src/org/openstreetmap/josm/gui/history/HistoryLoadTask.java
r12713 r13849 174 174 } catch (OsmTransferException e) { 175 175 lastException = e; 176 return;177 176 } 178 177 } -
trunk/src/org/openstreetmap/josm/gui/history/TagInfoViewer.java
r13521 r13849 8 8 import java.util.HashMap; 9 9 import java.util.Map; 10 import java.util.function. Function;10 import java.util.function.IntFunction; 11 11 import java.util.function.Supplier; 12 12 … … 80 80 JPopupMenu tagMenu = new JPopupMenu(); 81 81 82 Function<Integer,String> tagKeyFn = x -> (String) table.getValueAt(x, 0);83 Function<Integer,Map<String, Integer>> tagValuesFn = x -> {82 IntFunction<String> tagKeyFn = x -> (String) table.getValueAt(x, 0); 83 IntFunction<Map<String, Integer>> tagValuesFn = x -> { 84 84 Map<String, Integer> map = new HashMap<>(); 85 85 String key = tagTableModel.getValue((String) table.getValueAt(x, 0)); -
trunk/src/org/openstreetmap/josm/gui/io/CredentialDialog.java
r12992 r13849 402 402 if (currentTF.getText().trim().isEmpty()) { 403 403 currentTF.selectAll(); 404 return;405 404 } else if (nextTF.getText().trim().isEmpty()) { 406 405 nextTF.requestFocusInWindow(); 407 406 nextTF.selectAll(); 408 return;409 407 } else { 410 408 owner.new OKAction().actionPerformed(null); -
trunk/src/org/openstreetmap/josm/gui/layer/GpxLayer.java
r13281 r13849 148 148 public Object getInfoComponent() { 149 149 StringBuilder info = new StringBuilder(128) 150 .append("<html><head><style>") 151 .append("td { padding: 4px 16px; }") 152 .append("</style></head><body>"); 150 .append("<html><head><style>td { padding: 4px 16px; }</style></head><body>"); 153 151 154 152 if (data.attr.containsKey("name")) { -
trunk/src/org/openstreetmap/josm/gui/mappaint/RenderingCLI.java
r13399 r13849 15 15 import java.util.Locale; 16 16 import java.util.Optional; 17 import java.util.function. Supplier;17 import java.util.function.DoubleSupplier; 18 18 import java.util.logging.Level; 19 19 … … 238 238 break; 239 239 case 'b': 240 if (! getopt.getOptarg().equals("auto")) {240 if (!"auto".equals(getopt.getOptarg())) { 241 241 try { 242 242 argBounds = new Bounds(getopt.getOptarg(), ",", Bounds.ParseMethod.LEFT_BOTTOM_RIGHT_TOP, false); … … 459 459 EastNorth projAnchor = proj.latlon2eastNorth(argAnchor); 460 460 461 Double enPerMeter = null;462 Supplier<Double>getEnPerMeter = () -> {461 double enPerMeter = Double.NaN; 462 DoubleSupplier getEnPerMeter = () -> { 463 463 double shiftMeter = 10; 464 464 EastNorth projAnchorShifted = projAnchor.add( … … 470 470 if (scale == null) { 471 471 if (argScale != null) { 472 enPerMeter = getEnPerMeter.get ();472 enPerMeter = getEnPerMeter.getAsDouble(); 473 473 scale = argScale * enPerMeter / PIXEL_PER_METER; 474 474 } else if (argWidthM != null && argWidthPx != null) { 475 enPerMeter = getEnPerMeter.get ();475 enPerMeter = getEnPerMeter.getAsDouble(); 476 476 scale = argWidthM / argWidthPx * enPerMeter; 477 477 } else if (argHeightM != null && argHeightPx != null) { 478 enPerMeter = getEnPerMeter.get ();478 enPerMeter = getEnPerMeter.getAsDouble(); 479 479 scale = argHeightM / argHeightPx * enPerMeter; 480 480 } else { … … 486 486 double widthEn; 487 487 if (argWidthM != null) { 488 enPerMeter = Optional.ofNullable(enPerMeter).orElseGet(getEnPerMeter); 488 if (enPerMeter == Double.NaN) { 489 enPerMeter = getEnPerMeter.getAsDouble(); 490 } 489 491 widthEn = argWidthM * enPerMeter; 490 492 } else if (argWidthPx != null) { … … 497 499 double heightEn; 498 500 if (argHeightM != null) { 499 enPerMeter = Optional.ofNullable(enPerMeter).orElseGet(getEnPerMeter); 501 if (enPerMeter == Double.NaN) { 502 enPerMeter = getEnPerMeter.getAsDouble(); 503 } 500 504 heightEn = argHeightM * enPerMeter; 501 505 } else if (argHeightPx != null) { -
trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveAccessTokenTask.java
r12620 r13849 88 88 } catch (OsmTransferCanceledException e) { 89 89 Logging.trace(e); 90 return;91 90 } catch (final OsmOAuthAuthorizationException e) { 92 91 Logging.error(e); -
trunk/src/org/openstreetmap/josm/gui/oauth/RetrieveRequestTokenTask.java
r12620 r13849 82 82 } catch (OsmTransferCanceledException e) { 83 83 Logging.trace(e); 84 return;85 84 } catch (final OsmOAuthAuthorizationException e) { 86 85 Logging.error(e); -
trunk/src/org/openstreetmap/josm/gui/preferences/display/ColorPreference.java
r13761 r13849 211 211 212 212 @Override 213 public boolean isCellEditable(int rowIndex, int columnIndex) {214 return false;215 }216 217 @Override218 213 public void setValueAt(Object aValue, int rowIndex, int columnIndex) { 219 214 if (columnIndex == 1 && aValue instanceof Color) { … … 386 381 } 387 382 388 private boolean isRemoveColor(ColorEntry ce) {389 return ce.info.getCategory().equals(NamedColorProperty.COLOR_CATEGORY_LAYER);383 private static boolean isRemoveColor(ColorEntry ce) { 384 return NamedColorProperty.COLOR_CATEGORY_LAYER.equals(ce.info.getCategory()); 390 385 } 391 386 -
trunk/src/org/openstreetmap/josm/gui/preferences/server/ApiUrlTestTask.java
r12620 r13849 202 202 Logging.error(e); 203 203 alertConnectionFailed(); 204 return;205 204 } 206 205 } -
trunk/src/org/openstreetmap/josm/gui/tagging/presets/TaggingPresetNameTemplateList.java
r13564 r13849 60 60 if (t.nameTemplateFilter.match(primitive)) 61 61 return t; 62 else {63 continue;64 }65 62 } else if (t.matches(type, primitive.getKeys(), false)) { 66 63 return t; -
trunk/src/org/openstreetmap/josm/gui/widgets/OsmIdTextField.java
r12620 r13849 104 104 // convert tokens to int skipping v-words (version v2 etc) 105 105 c = s.charAt(0); 106 if (c == 'v') { 107 continue; 108 } else { 106 if (c != 'v') { 109 107 try { 110 108 ids.addAll(SimplePrimitiveId.multipleFromString(s)); -
trunk/src/org/openstreetmap/josm/io/OsmConnection.java
r12992 r13849 120 120 if (response.isCanceled()) { 121 121 cancel = true; 122 return;123 122 } else { 124 123 String username = response.getUsername() == null ? "" : response.getUsername(); -
trunk/src/org/openstreetmap/josm/plugins/PluginClassLoader.java
r13581 r13849 47 47 // Add dependency only if not already present (directly or transitively through another one) 48 48 boolean result = !dependencies.contains(Objects.requireNonNull(dependency, "dependency")) 49 && !dependencies.stream().anyMatch(pcl -> pcl.dependencies.contains(dependency))49 && dependencies.stream().noneMatch(pcl -> pcl.dependencies.contains(dependency)) 50 50 && dependencies.add(dependency); 51 51 if (result) { -
trunk/src/org/openstreetmap/josm/tools/HiDPISupport.java
r13202 r13849 192 192 } 193 193 List<List<Image>> allVars = imgs.stream().map(HiDPISupport::getResolutionVariants).collect(Collectors.toList()); 194 int maxVariants = allVars.stream().mapToInt( lst -> lst.size()).max().getAsInt();194 int maxVariants = allVars.stream().mapToInt(List<Image>::size).max().getAsInt(); 195 195 if (maxVariants == 1) 196 196 return processor.apply(imgs);
Note:
See TracChangeset
for help on using the changeset viewer.