Changeset 16122 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2020-03-14T15:49:56+01:00 (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r16121 r16122 14 14 import java.util.ArrayList; 15 15 import java.util.Collection; 16 import java.util. HashSet;16 import java.util.Collections; 17 17 import java.util.List; 18 import java.util.Objects; 18 19 import java.util.Set; 19 20 import java.util.stream.Collectors; … … 30 31 import javax.swing.JTable; 31 32 import javax.swing.JToolBar; 33 import javax.swing.SwingConstants; 32 34 import javax.swing.event.ListSelectionEvent; 33 35 import javax.swing.event.ListSelectionListener; … … 63 65 * It listens to property change events for {@link ChangesetCacheManagerModel#CHANGESET_IN_DETAIL_VIEW_PROP} 64 66 * and updates its view accordingly. 65 * 67 * @since 2689 66 68 */ 67 69 public class ChangesetContentPanel extends JPanel implements PropertyChangeListener, ChangesetAware { … … 76 78 77 79 private final HeaderPanel pnlHeader = new HeaderPanel(); 78 p ublicDownloadObjectAction actDownloadObjectAction;80 protected DownloadObjectAction actDownloadObjectAction; 79 81 80 82 protected void buildModels() { … … 131 133 protected JPanel buildActionButtonPanel() { 132 134 JPanel pnl = new JPanel(new FlowLayout(FlowLayout.LEFT)); 133 JToolBar tb = new JToolBar( JToolBar.VERTICAL);135 JToolBar tb = new JToolBar(SwingConstants.VERTICAL); 134 136 tb.setFloatable(false); 135 137 … … 321 323 322 324 protected Set<OsmPrimitive> getTarget() { 323 if (!isEnabled()) {324 return null;325 }326 325 DataSet ds = MainApplication.getLayerManager().getActiveDataSet(); 327 if (ds == null) { 328 return null; 329 } 330 Set<OsmPrimitive> target = new HashSet<>(); 331 for (HistoryOsmPrimitive p : model.getSelectedPrimitives()) { 332 OsmPrimitive op = ds.getPrimitiveById(p.getPrimitiveId()); 333 if (op != null) { 334 target.add(op); 335 } 336 } 337 return target; 326 if (isEnabled() && ds != null) { 327 return model.getSelectedPrimitives().stream() 328 .map(p -> ds.getPrimitiveById(p.getPrimitiveId())).filter(Objects::nonNull).collect(Collectors.toSet()); 329 } 330 return Collections.emptySet(); 338 331 } 339 332 … … 365 358 public void actionPerformed(ActionEvent e) { 366 359 final Set<OsmPrimitive> target = getTarget(); 367 if (target == null) { 368 return; 369 } else if (target.isEmpty()) { 360 if (target.isEmpty()) { 370 361 alertNoPrimitivesTo(model.getSelectedPrimitives(), tr("Nothing to select"), 371 362 HelpUtil.ht("/Dialog/ChangesetCacheManager#NothingToSelectInLayer")); … … 388 379 public void actionPerformed(ActionEvent e) { 389 380 final Set<OsmPrimitive> target = getTarget(); 390 if (target == null) { 391 return; 392 } else if (target.isEmpty()) { 381 if (target.isEmpty()) { 393 382 alertNoPrimitivesTo(model.getSelectedPrimitives(), tr("Nothing to zoom to"), 394 383 HelpUtil.ht("/Dialog/ChangesetCacheManager#NothingToZoomTo"));
Note:
See TracChangeset
for help on using the changeset viewer.