Changeset 33434 in osm for applications/editors/josm/plugins/pt_assistant
- Timestamp:
- 2017-07-10T11:27:18+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
applications/editors/josm/plugins/pt_assistant/src/org/openstreetmap/josm/plugins/pt_assistant/actions/SortPTStopsAction.java
r33433 r33434 3 3 package org.openstreetmap.josm.plugins.pt_assistant.actions; 4 4 5 import static org.openstreetmap.josm.tools.I18n.tr; 6 5 7 import java.awt.event.ActionEvent; 6 8 import java.util.ArrayList; 7 9 import java.util.Collection; 10 import java.util.Collections; 8 11 import java.util.HashMap; 9 12 import java.util.List; 10 13 import java.util.Map; 14 import java.util.concurrent.ExecutionException; 15 import java.util.concurrent.Future; 11 16 17 import javax.swing.JOptionPane; 18 19 import org.openstreetmap.josm.Main; 12 20 import org.openstreetmap.josm.actions.JosmAction; 21 import org.openstreetmap.josm.actions.relation.DownloadSelectedIncompleteMembersAction; 13 22 import org.openstreetmap.josm.data.osm.OsmPrimitive; 14 23 import org.openstreetmap.josm.data.osm.OsmPrimitiveType; … … 16 25 import org.openstreetmap.josm.data.osm.RelationMember; 17 26 import org.openstreetmap.josm.data.osm.Way; 27 import org.openstreetmap.josm.gui.dialogs.relation.DownloadRelationMemberTask; 18 28 import org.openstreetmap.josm.gui.dialogs.relation.sort.RelationSorter; 19 29 import org.openstreetmap.josm.plugins.pt_assistant.data.PTStop; … … 38 48 39 49 Relation rel = (Relation) getLayerManager().getEditDataSet().getSelected().iterator().next(); 50 51 if (rel.hasIncompleteMembers()) { 52 if (JOptionPane.YES_OPTION == JOptionPane.showOptionDialog(Main.parent, 53 tr("The relation has incomplete members. Do you want to download them and continue with the sorting?"), 54 tr("Incomplete Members"), JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE, 55 null, null, null)) { 56 57 List<Relation> incomplete = Collections.singletonList(rel); 58 Future<?> future = Main.worker.submit(new DownloadRelationMemberTask( 59 incomplete, 60 DownloadSelectedIncompleteMembersAction.buildSetOfIncompleteMembers(incomplete), 61 Main.getLayerManager().getEditLayer())); 62 63 Main.worker.submit(() -> { 64 try { 65 future.get(); 66 continueAfterDownload(rel); 67 } catch (InterruptedException | ExecutionException e1) { 68 Main.error(e1); 69 return; 70 } 71 }); 72 } else 73 return; 74 } else 75 continueAfterDownload(rel); 76 } 77 78 private void continueAfterDownload(Relation rel) { 40 79 List<RelationMember> members = rel.getMembers(); 41 80
Note:
See TracChangeset
for help on using the changeset viewer.