- Timestamp:
- 2016-07-23T04:10:39+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r10580 r10601 596 596 public Main() { 597 597 main = this; 598 mainPanel.addMapFrameListener(new MapFrameListener() { 599 @Override 600 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 601 redoUndoListener.commandChanged(0, 0); 602 } 603 }); 598 mainPanel.addMapFrameListener((o, n) -> redoUndoListener.commandChanged(0, 0)); 604 599 } 605 600 … … 697 692 698 693 // hooks for the jmapviewer component 699 FeatureAdapter.registerBrowserAdapter(new FeatureAdapter.BrowserAdapter() { 700 @Override 701 public void openLink(String url) { 702 OpenBrowser.displayUrl(url); 703 } 704 }); 694 FeatureAdapter.registerBrowserAdapter(OpenBrowser::displayUrl); 705 695 FeatureAdapter.registerTranslationAdapter(I18n.getTranslationAdapter()); 706 FeatureAdapter.registerLoggingAdapter(new FeatureAdapter.LoggingAdapter() { 707 @Override 708 public Logger getLogger(String name) { 696 FeatureAdapter.registerLoggingAdapter(name -> { 709 697 Logger logger = Logger.getAnonymousLogger(); 710 698 logger.setUseParentHandlers(false); … … 740 728 } 741 729 return logger; 742 } 743 }); 730 }); 744 731 745 732 new InitializationTask(tr("Updating user interface")) { … … 991 978 public static final JPanel panel = mainPanel; 992 979 993 private final CommandQueueListener redoUndoListener = new CommandQueueListener() { 994 @Override 995 public void commandChanged(final int queueSize, final int redoSize) { 980 private final CommandQueueListener redoUndoListener = (queueSize, redoSize) -> { 996 981 menu.undo.setEnabled(queueSize > 0); 997 982 menu.redo.setEnabled(redoSize > 0); 998 } 999 }; 983 }; 1000 984 1001 985 /** -
trunk/src/org/openstreetmap/josm/actions/AddImageryLayerAction.java
r10463 r10601 32 32 import org.openstreetmap.josm.tools.GBC; 33 33 import org.openstreetmap.josm.tools.ImageProvider; 34 import org.openstreetmap.josm.tools.ImageProvider.ImageResourceCallback;35 34 import org.openstreetmap.josm.tools.ImageResource; 36 35 … … 57 56 String icon = info.getIcon(); 58 57 if (icon != null) { 59 new ImageProvider(icon).setOptional(true).getInBackground(new ImageResourceCallback() { 60 @Override 61 public void finished(final ImageResource result) { 62 if (result != null) { 63 GuiHelper.runInEDT(new Runnable() { 64 @Override 65 public void run() { 66 result.attachImageIcon(AddImageryLayerAction.this); 67 } 68 }); 69 } 70 } 71 }); 58 new ImageProvider(icon).setOptional(true).getInBackground((ImageResource result) -> { 59 if (result != null) { 60 GuiHelper.runInEDT(() -> result.attachImageIcon(AddImageryLayerAction.this)); 61 } 62 }); 72 63 } 73 64 } -
trunk/src/org/openstreetmap/josm/actions/AutoScaleAction.java
r10453 r10601 17 17 18 18 import javax.swing.JOptionPane; 19 import javax.swing.event.ListSelectionEvent;20 19 import javax.swing.event.ListSelectionListener; 21 import javax.swing.event.TreeSelectionEvent;22 20 import javax.swing.event.TreeSelectionListener; 23 21 … … 410 408 MapFrameAdapter() { 411 409 if ("conflict".equals(mode)) { 412 conflictSelectionListener = new ListSelectionListener() { 413 @Override 414 public void valueChanged(ListSelectionEvent e) { 415 updateEnabledState(); 416 } 417 }; 410 conflictSelectionListener = e -> updateEnabledState(); 418 411 } else if ("problem".equals(mode)) { 419 validatorSelectionListener = new TreeSelectionListener() { 420 @Override 421 public void valueChanged(TreeSelectionEvent e) { 422 updateEnabledState(); 423 } 424 }; 412 validatorSelectionListener = e -> updateEnabledState(); 425 413 } 426 414 } -
trunk/src/org/openstreetmap/josm/actions/CloseChangesetAction.java
r10212 r10601 97 97 @Override 98 98 protected void finish() { 99 SwingUtilities.invokeLater( 100 new Runnable() { 101 @Override 102 public void run() { 99 SwingUtilities.invokeLater(() -> { 103 100 if (lastException != null) { 104 101 ExceptionDialogUtil.explainException(lastException); … … 108 105 onPostDownloadOpenChangesets(); 109 106 } 110 } 111 } 112 ); 107 }); 113 108 } 114 109 -
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r10548 r10601 233 233 Main.main.undoRedo.add(combineResult.b); 234 234 if (selectedWay != null) { 235 Runnable guiTask = new Runnable() { 236 @Override 237 public void run() { 238 ds.setSelected(selectedWay); 239 } 240 }; 241 GuiHelper.runInEDT(guiTask); 235 GuiHelper.runInEDT(() -> ds.setSelected(selectedWay)); 242 236 } 243 237 } -
trunk/src/org/openstreetmap/josm/actions/CreateMultipolygonAction.java
r10548 r10601 104 104 105 105 // to avoid EDT violations 106 SwingUtilities.invokeLater(new Runnable() { 107 @Override 108 public void run() { 106 SwingUtilities.invokeLater(() -> { 109 107 Main.main.undoRedo.add(command); 110 108 … … 113 111 // (Yes, we are already in event dispatch thread. But DatasetEventManager 114 112 // uses 'SwingUtilities.invokeLater' to fire events so we have to do the same.) 115 SwingUtilities.invokeLater(new Runnable() { 116 @Override 117 public void run() { 113 SwingUtilities.invokeLater(() -> { 118 114 Main.map.relationListDialog.selectRelation(relation); 119 115 if (Main.pref.getBoolean("multipoly.show-relation-editor", false)) { 120 116 //Open relation edit window, if set up in preferences 121 117 RelationEditor editor = RelationEditor.getEditor(Main.getLayerManager().getEditLayer(), relation, null); 122 123 118 editor.setModal(true); 124 119 editor.setVisible(true); … … 126 121 Main.getLayerManager().getEditLayer().setRecentRelation(relation); 127 122 } 128 }129 123 }); 130 }131 124 }); 132 125 } … … 296 289 if (error != null) { 297 290 if (showNotif) { 298 GuiHelper.runInEDT(new Runnable() { 299 @Override 300 public void run() { 291 GuiHelper.runInEDT( 301 292 new Notification(error) 302 293 .setIcon(JOptionPane.INFORMATION_MESSAGE) 303 .show(); 304 } 305 }); 294 ::show); 306 295 } 307 296 return null; -
trunk/src/org/openstreetmap/josm/actions/DownloadPrimitiveAction.java
r10446 r10601 53 53 new DownloadPrimitivesWithReferrersTask(newLayer, ids, downloadReferrers, full, null, null); 54 54 Main.worker.submit(task); 55 Main.worker.submit(new Runnable() { 56 @Override 57 public void run() { 55 Main.worker.submit(() -> { 58 56 final List<PrimitiveId> downloaded = task.getDownloadedId(); 59 57 if (downloaded != null) { 60 GuiHelper.runInEDT(new Runnable() { 61 @Override 62 public void run() { 63 Main.getLayerManager().getEditDataSet().setSelected(downloaded); 64 } 65 }); 58 GuiHelper.runInEDT(() -> Main.getLayerManager().getEditDataSet().setSelected(downloaded)); 66 59 } 67 }68 60 }); 69 61 } -
trunk/src/org/openstreetmap/josm/actions/JosmAction.java
r10428 r10601 293 293 294 294 protected static void waitFuture(final Future<?> future, final PleaseWaitProgressMonitor monitor) { 295 Main.worker.submit( 296 new Runnable() { 297 @Override 298 public void run() { 295 Main.worker.submit(() -> { 299 296 try { 300 297 future.get(); … … 304 301 } 305 302 monitor.close(); 306 } 307 } 308 ); 303 }); 309 304 } 310 305 -
trunk/src/org/openstreetmap/josm/actions/JumpToAction.java
r10181 r10601 19 19 import org.openstreetmap.josm.data.Bounds; 20 20 import org.openstreetmap.josm.data.coor.LatLon; 21 import org.openstreetmap.josm.gui.MapFrame;22 import org.openstreetmap.josm.gui.MapFrameListener;23 21 import org.openstreetmap.josm.gui.MapView; 24 22 import org.openstreetmap.josm.gui.dialogs.LatLonDialog; … … 223 221 super.installAdapters(); 224 222 // make this action listen to mapframe change events 225 Main.addMapFrameListener(new MapFrameListener() { 226 @Override 227 public void mapFrameInitialized(MapFrame oldFrame, MapFrame newFrame) { 228 updateEnabledState(); 229 } 230 }); 223 Main.addMapFrameListener((o, n) -> updateEnabledState()); 231 224 } 232 225 } -
trunk/src/org/openstreetmap/josm/actions/MergeLayerAction.java
r10436 r10601 41 41 if (targetLayer == null) 42 42 return; 43 Main.worker.submit(new Runnable() { 44 @Override 45 public void run() { 43 Main.worker.submit(() -> { 46 44 boolean layerMerged = false; 47 45 for (final Layer sourceLayer: sourceLayers) { … … 54 52 } 55 53 targetLayer.mergeFrom(sourceLayer); 56 GuiHelper.runInEDTAndWait(new Runnable() { 57 @Override 58 public void run() { 59 Main.getLayerManager().removeLayer(sourceLayer); 60 } 61 }); 54 GuiHelper.runInEDTAndWait(() -> Main.getLayerManager().removeLayer(sourceLayer)); 62 55 layerMerged = true; 63 56 } … … 66 59 Main.getLayerManager().setActiveLayer(targetLayer); 67 60 } 68 }69 61 }); 70 62 } … … 100 92 @Override 101 93 protected void updateEnabledState() { 102 GuiHelper.runInEDT(new Runnable() { 103 @Override 104 public void run() { 94 GuiHelper.runInEDT(() -> { 105 95 final Layer sourceLayer = getSourceLayer(); 106 96 if (sourceLayer == null) { … … 110 100 setEnabled(!possibleMergeTargets.isEmpty()); 111 101 } 112 }113 102 }); 114 103 } -
trunk/src/org/openstreetmap/josm/actions/OpenFileAction.java
r10407 r10601 10 10 import java.io.BufferedReader; 11 11 import java.io.File; 12 import java.io.FilenameFilter;13 12 import java.io.IOException; 14 13 import java.nio.charset.StandardCharsets; … … 127 126 } else if (file.getParentFile() != null) { 128 127 // try to guess an extension using the specified fileFilter 129 final File[] matchingFiles = file.getParentFile().listFiles(new FilenameFilter() { 130 @Override 131 public boolean accept(File dir, String name) { 132 return name.startsWith(file.getName()) 133 && fileFilter != null && fileFilter.accept(new File(dir, name)); 134 } 135 }); 128 final File[] matchingFiles = file.getParentFile().listFiles((dir, name) -> 129 name.startsWith(file.getName()) && fileFilter != null && fileFilter.accept(new File(dir, name))); 136 130 if (matchingFiles != null && matchingFiles.length == 1) { 137 131 // use the unique match as filename … … 260 254 if (!chosenImporter.acceptFile(f)) { 261 255 if (f.isDirectory()) { 262 SwingUtilities.invokeLater(new Runnable() { 263 @Override 264 public void run() { 265 JOptionPane.showMessageDialog(Main.parent, tr( 266 "<html>Cannot open directory ''{0}''.<br>Please select a file.</html>", 267 f.getAbsolutePath()), tr("Open file"), JOptionPane.ERROR_MESSAGE); 268 } 269 }); 256 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog(Main.parent, tr( 257 "<html>Cannot open directory ''{0}''.<br>Please select a file.</html>", 258 f.getAbsolutePath()), tr("Open file"), JOptionPane.ERROR_MESSAGE)); 270 259 // TODO when changing to Java 6: Don't cancel the task here but use different modality. (Currently 2 dialogs 271 260 // would block each other.) -
trunk/src/org/openstreetmap/josm/actions/PurgeAction.java
r10413 r10601 14 14 import java.util.Collection; 15 15 import java.util.Collections; 16 import java.util.Comparator;17 16 import java.util.HashSet; 18 17 import java.util.List; … … 245 244 ImageProvider.get("warning-small"), JLabel.LEFT), GBC.eol().fill(GBC.HORIZONTAL)); 246 245 247 Collections.sort(toPurgeAdditionally, new Comparator<OsmPrimitive>() { 248 @Override 249 public int compare(OsmPrimitive o1, OsmPrimitive o2) { 250 int type = o2.getType().compareTo(o1.getType()); 251 if (type != 0) 252 return type; 253 return Long.compare(o1.getUniqueId(), o2.getUniqueId()); 254 } 246 Collections.sort(toPurgeAdditionally, (o1, o2) -> { 247 int type = o2.getType().compareTo(o1.getType()); 248 if (type != 0) 249 return type; 250 return Long.compare(o1.getUniqueId(), o2.getUniqueId()); 255 251 }); 256 252 JList<OsmPrimitive> list = new JList<>(toPurgeAdditionally.toArray(new OsmPrimitive[toPurgeAdditionally.size()])); -
trunk/src/org/openstreetmap/josm/actions/SessionLoadAction.java
r10432 r10601 112 112 @Override 113 113 protected void finish() { 114 SwingUtilities.invokeLater(new Runnable() { 115 @Override 116 public void run() { 117 if (canceled) 118 return; 119 addLayers(); 120 runPostLoadTasks(); 121 } 114 SwingUtilities.invokeLater(() -> { 115 if (canceled) 116 return; 117 addLayers(); 118 runPostLoadTasks(); 122 119 }); 123 120 } -
trunk/src/org/openstreetmap/josm/actions/SplitWayAction.java
r10599 r10601 27 27 import javax.swing.JPanel; 28 28 import javax.swing.ListSelectionModel; 29 import javax.swing.event.ListSelectionEvent;30 import javax.swing.event.ListSelectionListener;31 29 32 30 import org.openstreetmap.josm.Main; … … 252 250 private void configureList() { 253 251 list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); 254 list.addListSelectionListener(new ListSelectionListener() { 255 @Override 256 public void valueChanged(ListSelectionEvent e) { 257 final Way selected = list.getSelectedValue(); 258 if (Main.isDisplayingMapView() && selected != null && selected.getNodesCount() > 1) { 259 final Collection<WaySegment> segments = new ArrayList<>(selected.getNodesCount() - 1); 260 final Iterator<Node> it = selected.getNodes().iterator(); 261 Node previousNode = it.next(); 262 while (it.hasNext()) { 263 final Node node = it.next(); 264 segments.add(WaySegment.forNodePair(selectedWay, previousNode, node)); 265 previousNode = node; 266 } 267 setHighlightedWaySegments(segments); 252 list.addListSelectionListener(e -> { 253 final Way selected = list.getSelectedValue(); 254 if (Main.isDisplayingMapView() && selected != null && selected.getNodesCount() > 1) { 255 final Collection<WaySegment> segments = new ArrayList<>(selected.getNodesCount() - 1); 256 final Iterator<Node> it = selected.getNodes().iterator(); 257 Node previousNode = it.next(); 258 while (it.hasNext()) { 259 final Node node = it.next(); 260 segments.add(WaySegment.forNodePair(selectedWay, previousNode, node)); 261 previousNode = node; 268 262 } 263 setHighlightedWaySegments(segments); 269 264 } 270 265 }); -
trunk/src/org/openstreetmap/josm/actions/UnGlueAction.java
r10448 r10601 43 43 import org.openstreetmap.josm.tools.GBC; 44 44 import org.openstreetmap.josm.tools.ImageProvider; 45 import org.openstreetmap.josm.tools.Predicate;46 45 import org.openstreetmap.josm.tools.Shortcut; 47 46 import org.openstreetmap.josm.tools.UserCancelException; … … 251 250 252 251 private static boolean isTagged(final Iterable<Node> existingNodes) { 253 return Utils.exists(existingNodes, new Predicate<Node>() { 254 @Override 255 public boolean evaluate(final Node selectedNode) { 256 return selectedNode.hasKeys(); 257 } 258 }); 252 return Utils.exists(existingNodes, selectedNode -> selectedNode.hasKeys()); 259 253 } 260 254 261 255 private static boolean isUsedInRelations(final Iterable<Node> existingNodes) { 262 return Utils.exists(existingNodes, new Predicate<Node>() { 263 @Override 264 public boolean evaluate(final Node selectedNode) { 265 return Utils.exists(selectedNode.getReferrers(), OsmPrimitive.relationPredicate); 266 } 267 }); 256 return Utils.exists(existingNodes, selectedNode -> Utils.exists(selectedNode.getReferrers(), OsmPrimitive.relationPredicate)); 268 257 } 269 258 -
trunk/src/org/openstreetmap/josm/actions/UploadSelectionAction.java
r10548 r10601 289 289 return; 290 290 } 291 Runnable r = new Runnable() { 292 @Override 293 public void run() { 294 processPostParentChecker(layer, toUpload); 295 } 296 }; 297 SwingUtilities.invokeLater(r); 291 SwingUtilities.invokeLater(() -> processPostParentChecker(layer, toUpload)); 298 292 } 299 293 -
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r10446 r10601 142 142 // update GUI on Swing EDT 143 143 // 144 GuiHelper.runInEDT(new Runnable() { 145 @Override 146 public void run() { 147 Main.map.validatorDialog.tree.setErrors(errors); 148 Main.map.validatorDialog.unfurlDialog(); 149 Main.getLayerManager().getEditDataSet().fireSelectionChanged(); 150 } 144 GuiHelper.runInEDT(() -> { 145 Main.map.validatorDialog.tree.setErrors(errors); 146 Main.map.validatorDialog.unfurlDialog(); 147 Main.getLayerManager().getEditDataSet().fireSelectionChanged(); 151 148 }); 152 149 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java
r10250 r10601 61 61 // Run on the EDT because UI updates are triggered. 62 62 // 63 Runnable r = new Runnable() { 64 @Override public void run() { 65 ChangesetCache.getInstance().update(downloadedChangesets); 66 } 67 }; 63 Runnable r = () -> ChangesetCache.getInstance().update(downloadedChangesets); 68 64 if (SwingUtilities.isEventDispatchThread()) { 69 65 r.run(); -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadReferrersTask.java
r10467 r10601 117 117 DataSetMerger visitor = new DataSetMerger(targetLayer.data, parents); 118 118 visitor.merge(); 119 SwingUtilities.invokeLater( 120 new Runnable() { 121 @Override 122 public void run() { 123 targetLayer.onPostDownloadFromServer(); 124 } 125 } 126 ); 119 SwingUtilities.invokeLater(targetLayer::onPostDownloadFromServer); 127 120 if (visitor.getConflicts().isEmpty()) 128 121 return; … … 131 124 Main.parent, 132 125 trn("There was {0} conflict during import.", 133 134 135 126 "There were {0} conflicts during import.", 127 visitor.getConflicts().size(), 128 visitor.getConflicts().size() 136 129 ), 137 130 trn("Conflict during download", "Conflicts during download", visitor.getConflicts().size()), -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/DownloadTaskList.java
r10436 r10601 33 33 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 34 34 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 35 import org.openstreetmap.josm.gui.progress.ProgressMonitor.CancelListener;36 35 import org.openstreetmap.josm.gui.util.GuiHelper; 37 36 import org.openstreetmap.josm.tools.ExceptionUtil; … … 88 87 } 89 88 } 90 progressMonitor.addCancelListener(new CancelListener() { 91 @Override 92 public void operationCanceled() { 93 for (DownloadTask dt : tasks) { 94 dt.cancel(); 95 } 89 progressMonitor.addCancelListener(() -> { 90 for (DownloadTask dt : tasks) { 91 dt.cancel(); 96 92 } 97 93 }); … … 151 147 } 152 148 } 153 EventQueue.invokeLater(new Runnable() { 154 @Override public void run() { 155 UpdateSelectionAction.updatePrimitives(toSelect); 156 } 157 }); 149 EventQueue.invokeLater(() -> UpdateSelectionAction.updatePrimitives(toSelect)); 158 150 } 159 151 … … 270 262 } 271 263 272 GuiHelper.runInEDT(new Runnable() { 273 @Override 274 public void run() { 275 if (items.size() == 1 && tr("No data found in this area.").equals(items.iterator().next())) { 276 new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 277 } else { 278 JOptionPane.showMessageDialog(Main.parent, "<html>" 279 + tr("The following errors occurred during mass download: {0}", 280 Utils.joinAsHtmlUnorderedList(items)) + "</html>", 281 tr("Errors during download"), JOptionPane.ERROR_MESSAGE); 282 } 264 GuiHelper.runInEDT(() -> { 265 if (items.size() == 1 && tr("No data found in this area.").equals(items.iterator().next())) { 266 new Notification(items.iterator().next()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 267 } else { 268 JOptionPane.showMessageDialog(Main.parent, "<html>" 269 + tr("The following errors occurred during mass download: {0}", 270 Utils.joinAsHtmlUnorderedList(items)) + "</html>", 271 tr("Errors during download"), JOptionPane.ERROR_MESSAGE); 283 272 } 284 273 }); … … 312 301 } 313 302 if (!myPrimitives.isEmpty()) { 314 GuiHelper.runInEDT(new Runnable() { 315 @Override public void run() { 316 handlePotentiallyDeletedPrimitives(myPrimitives); 317 } 318 }); 303 GuiHelper.runInEDT(() -> handlePotentiallyDeletedPrimitives(myPrimitives)); 319 304 } 320 305 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/PostDownloadHandler.java
r10212 r10601 58 58 final Object error = errors.iterator().next(); 59 59 if (!GraphicsEnvironment.isHeadless()) { 60 SwingUtilities.invokeLater(new Runnable() { 61 @Override 62 public void run() { 63 if (error instanceof Exception) { 64 ExceptionDialogUtil.explainException((Exception) error); 65 } else if (tr("No data found in this area.").equals(error)) { 66 new Notification(error.toString()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 67 } else { 68 JOptionPane.showMessageDialog( 69 Main.parent, 70 error.toString(), 71 tr("Error during download"), 72 JOptionPane.ERROR_MESSAGE); 73 } 60 SwingUtilities.invokeLater(() -> { 61 if (error instanceof Exception) { 62 ExceptionDialogUtil.explainException((Exception) error); 63 } else if (tr("No data found in this area.").equals(error)) { 64 new Notification(error.toString()).setIcon(JOptionPane.WARNING_MESSAGE).show(); 65 } else { 66 JOptionPane.showMessageDialog( 67 Main.parent, 68 error.toString(), 69 tr("Error during download"), 70 JOptionPane.ERROR_MESSAGE); 74 71 } 75 72 }); … … 91 88 92 89 if (!GraphicsEnvironment.isHeadless()) { 93 SwingUtilities.invokeLater(new Runnable() { 94 @Override 95 public void run() { 96 JOptionPane.showMessageDialog( 97 Main.parent, 98 "<html>"+Utils.joinAsHtmlUnorderedList(items)+"</html>", 99 tr("Errors during download"), 100 JOptionPane.ERROR_MESSAGE); 101 } 102 }); 90 SwingUtilities.invokeLater(() -> JOptionPane.showMessageDialog( 91 Main.parent, 92 "<html>"+Utils.joinAsHtmlUnorderedList(items)+"</html>", 93 tr("Errors during download"), 94 JOptionPane.ERROR_MESSAGE)); 103 95 } 104 96 return; -
trunk/src/org/openstreetmap/josm/actions/mapmode/SelectAction.java
r10448 r10601 9 9 import java.awt.Point; 10 10 import java.awt.Rectangle; 11 import java.awt.event.ActionEvent;12 import java.awt.event.ActionListener;13 11 import java.awt.event.KeyEvent; 14 12 import java.awt.event.MouseEvent; … … 447 445 useLastMoveCommandIfPossible(); 448 446 // Schedule a timer to update status line "initialMoveDelay+1" ms in the future 449 GuiHelper.scheduleTimer(initialMoveDelay+1, new ActionListener() { 450 @Override 451 public void actionPerformed(ActionEvent evt) { 452 updateStatusLine(); 453 } 454 }, false); 447 GuiHelper.scheduleTimer(initialMoveDelay+1, evt -> updateStatusLine(), false); 455 448 break; 456 449 case SELECT: … … 616 609 // We need to do it like this as otherwise drawAction will see a double 617 610 // click and switch back to SelectMode 618 Main.worker.execute(new Runnable() { 619 @Override 620 public void run() { 621 Main.map.selectDrawTool(true); 622 } 623 }); 611 Main.worker.execute(() -> Main.map.selectDrawTool(true)); 624 612 return; 625 613 } -
trunk/src/org/openstreetmap/josm/actions/relation/AddSelectionToRelations.java
r10446 r10601 63 63 @Override 64 64 public void selectionChanged(final Collection<? extends OsmPrimitive> newSelection) { 65 GuiHelper.runInEDT(new Runnable() { 66 @Override 67 public void run() { 68 setEnabled(newSelection != null && !newSelection.isEmpty()); 69 } 70 }); 65 GuiHelper.runInEDT(() -> setEnabled(newSelection != null && !newSelection.isEmpty())); 71 66 } 72 67 } -
trunk/src/org/openstreetmap/josm/actions/relation/DownloadMembersAction.java
r10413 r10601 10 10 import org.openstreetmap.josm.Main; 11 11 import org.openstreetmap.josm.data.osm.OsmPrimitive; 12 import org.openstreetmap.josm.data.osm.Relation;13 12 import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationTask; 14 13 import org.openstreetmap.josm.io.OnlineResource; 15 14 import org.openstreetmap.josm.tools.ImageProvider; 16 import org.openstreetmap.josm.tools.Predicate;17 15 import org.openstreetmap.josm.tools.Utils; 18 16 … … 42 40 public void setPrimitives(Collection<? extends OsmPrimitive> primitives) { 43 41 // selected non-new relations 44 this.relations = Utils.filter(getRelations(primitives), new Predicate<Relation>() { 45 @Override 46 public boolean evaluate(Relation r) { 47 return !r.isNew(); 48 } 49 }); 42 this.relations = Utils.filter(getRelations(primitives), r -> !r.isNew()); 50 43 updateEnabledState(); 51 44 } -
trunk/src/org/openstreetmap/josm/actions/relation/DownloadSelectedIncompleteMembersAction.java
r10413 r10601 15 15 import org.openstreetmap.josm.io.OnlineResource; 16 16 import org.openstreetmap.josm.tools.ImageProvider; 17 import org.openstreetmap.josm.tools.Predicate;18 17 import org.openstreetmap.josm.tools.Utils; 19 18 … … 43 42 Set<OsmPrimitive> ret = new HashSet<>(); 44 43 for (Relation r : rels) { 45 ret.addAll(Utils.filter(r.getIncompleteMembers(), new Predicate<OsmPrimitive>() { 46 @Override 47 public boolean evaluate(OsmPrimitive osm) { 48 return !osm.isNew(); 49 } 50 })); 44 ret.addAll(Utils.filter(r.getIncompleteMembers(), osm -> !osm.isNew())); 51 45 } 52 46 return ret; … … 65 59 public void setPrimitives(Collection<? extends OsmPrimitive> primitives) { 66 60 // selected relations with incomplete members 67 this.relations = Utils.filter(getRelations(primitives), new Predicate<Relation>() { 68 @Override 69 public boolean evaluate(Relation r) { 70 return r.hasIncompleteMembers(); 71 } 72 }); 61 this.relations = Utils.filter(getRelations(primitives), r -> r.hasIncompleteMembers()); 73 62 this.incompleteMembers = buildSetOfIncompleteMembers(relations); 74 63 updateEnabledState(); -
trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java
r10600 r10601 651 651 private static SearchTask newSearchTask(SearchSetting setting, final DataSet ds, SearchReceiver resultReceiver) { 652 652 final Collection<OsmPrimitive> selection = new HashSet<>(ds.getAllSelected()); 653 return new SearchTask(ds, setting, selection, new Predicate<OsmPrimitive>() { 654 @Override 655 public boolean evaluate(OsmPrimitive o) { 656 return ds.isSelected(o); 657 } 658 }, resultReceiver); 653 return new SearchTask(ds, setting, selection, ds::isSelected, resultReceiver); 659 654 } 660 655 -
trunk/src/org/openstreetmap/josm/actions/upload/FixDataHook.java
r10600 r10601 46 46 deprecated.add(new FixDataTag("highway", "stile", "barrier", "stile")); 47 47 // CHECKSTYLE.ON: SingleSpaceSeparator 48 deprecated.add(new FixData() { 49 @Override 50 public boolean fixKeys(Map<String, String> keys, OsmPrimitive osm) { 51 if (osm instanceof Relation && "multipolygon".equals(keys.get("type")) && "administrative".equals(keys.get("boundary"))) { 52 keys.put("type", "boundary"); 53 return true; 54 } 55 return false; 56 } 48 deprecated.add((keys, osm) -> { 49 if (osm instanceof Relation && "multipolygon".equals(keys.get("type")) && "administrative".equals(keys.get("boundary"))) { 50 keys.put("type", "boundary"); 51 return true; 52 } 53 return false; 57 54 }); 58 55 }
Note:
See TracChangeset
for help on using the changeset viewer.