Changeset 9521 in josm for trunk/src/org/openstreetmap
- Timestamp:
- 2016-01-17T23:57:57+01:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/dialogs/changeset/ChangesetContentPanel.java
r9520 r9521 36 36 import org.openstreetmap.josm.data.osm.Changeset; 37 37 import org.openstreetmap.josm.data.osm.OsmPrimitive; 38 import org.openstreetmap.josm.data.osm.PrimitiveId; 38 39 import org.openstreetmap.josm.data.osm.history.History; 39 40 import org.openstreetmap.josm.data.osm.history.HistoryDataSet; … … 45 46 import org.openstreetmap.josm.gui.history.HistoryBrowserDialogManager; 46 47 import org.openstreetmap.josm.gui.history.HistoryLoadTask; 48 import org.openstreetmap.josm.gui.io.DownloadPrimitivesWithReferrersTask; 47 49 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 48 50 import org.openstreetmap.josm.gui.util.GuiHelper; … … 51 53 import org.openstreetmap.josm.tools.BugReportExceptionHandler; 52 54 import org.openstreetmap.josm.tools.ImageProvider; 55 import org.openstreetmap.josm.tools.Utils; 53 56 54 57 /** … … 70 73 71 74 private final HeaderPanel pnlHeader = new HeaderPanel(); 75 public DownloadObjectAction actDownloadObjectAction; 72 76 73 77 protected void buildModels() { … … 76 80 actDownloadContentAction = new DownloadChangesetContentAction(this); 77 81 actDownloadContentAction.initProperties(); 82 83 actDownloadObjectAction = new DownloadObjectAction(); 84 model.getSelectionModel().addListSelectionListener(actDownloadObjectAction); 85 78 86 actShowHistory = new ShowHistoryAction(); 79 87 model.getSelectionModel().addListSelectionListener(actShowHistory); … … 118 126 119 127 tb.add(actDownloadContentAction); 128 tb.addSeparator(); 129 tb.add(actDownloadObjectAction); 120 130 tb.add(actShowHistory); 131 tb.addSeparator(); 121 132 tb.add(actSelectInCurrentLayerAction); 122 133 tb.add(actZoomInCurrentLayerAction); … … 190 201 ChangesetContentTablePopupMenu() { 191 202 add(actDownloadContentAction); 203 add(new JSeparator()); 204 add(actDownloadObjectAction); 192 205 add(actShowHistory); 193 206 add(new JSeparator()); … … 280 293 } 281 294 295 class DownloadObjectAction extends AbstractAction implements ListSelectionListener { 296 297 DownloadObjectAction() { 298 putValue(NAME, tr("Download objects")); 299 putValue(SMALL_ICON, ImageProvider.get("downloadprimitive")); 300 putValue(SHORT_DESCRIPTION, tr("Download the current version of the selected objects")); 301 updateEnabledState(); 302 } 303 304 @Override 305 public void actionPerformed(ActionEvent arg0) { 306 final List<PrimitiveId> primitiveIds = new ArrayList<>(Utils.transform( 307 model.getSelectedPrimitives(), new Utils.Function<HistoryOsmPrimitive, PrimitiveId>() { 308 @Override 309 public PrimitiveId apply(HistoryOsmPrimitive x) { 310 return x.getPrimitiveId(); 311 } 312 })); 313 Main.worker.submit(new DownloadPrimitivesWithReferrersTask(false, primitiveIds, true, true, null, null)); 314 } 315 316 protected final void updateEnabledState() { 317 setEnabled(model.hasSelectedPrimitives()); 318 } 319 320 @Override 321 public void valueChanged(ListSelectionEvent e) { 322 updateEnabledState(); 323 } 324 } 325 282 326 abstract class SelectionBasedAction extends AbstractAction implements ListSelectionListener, EditLayerChangeListener { 283 327
Note:
See TracChangeset
for help on using the changeset viewer.