Changeset 11995 in josm
- Timestamp:
- 2017-04-24T21:16:45+02:00 (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/Main.java
r11988 r11995 830 830 * Handle command line instructions after GUI has been initialized. 831 831 * @param args program arguments 832 */ 833 protected static void postConstructorProcessCmdLine(ProgramArguments args) { 832 * @return the list of submitted tasks 833 */ 834 protected static List<Future<?>> postConstructorProcessCmdLine(ProgramArguments args) { 834 835 List<Future<?>> tasks = new ArrayList<>(); 835 836 List<File> fileList = new ArrayList<>(); … … 843 844 tasks.addAll(DownloadParamType.paramType(s).downloadGps(s)); 844 845 } 845 // Make sure all download tasks complete before handling selection arguments 846 for (Future<?> task : tasks) { 847 try { 848 task.get(); 849 } catch (InterruptedException | ExecutionException e) { 850 error(e); 851 } 852 } 853 for (String s : args.get(Option.SELECTION)) { 854 SearchAction.search(s, SearchAction.SearchMode.add); 855 } 846 final Collection<String> selectionArguments = args.get(Option.SELECTION); 847 if (!selectionArguments.isEmpty()) { 848 tasks.add(Main.worker.submit(() -> { 849 for (String s : selectionArguments) { 850 SearchAction.search(s, SearchAction.SearchMode.add); 851 } 852 })); 853 } 854 return tasks; 856 855 } 857 856 -
trunk/test/unit/org/openstreetmap/josm/MainTest.java
r11988 r11995 12 12 import java.util.Collection; 13 13 import java.util.List; 14 import java.util.concurrent.ExecutionException; 15 import java.util.concurrent.Future; 14 16 15 17 import javax.swing.UIManager; … … 100 102 private static void doTestPostConstructorProcessCmdLine(String download, String downloadGps, boolean gpx) { 101 103 assertNull(Main.getLayerManager().getEditDataSet()); 102 Main.postConstructorProcessCmdLine(new ProgramArguments(new String[]{104 for (Future<?> f : Main.postConstructorProcessCmdLine(new ProgramArguments(new String[]{ 103 105 "--download=" + download, 104 106 "--downloadgps=" + downloadGps, 105 "--selection=type: node"})); 107 "--selection=type: node"}))) { 108 try { 109 f.get(); 110 } catch (InterruptedException | ExecutionException e) { 111 Main.error(e); 112 } 113 } 106 114 DataSet ds = Main.getLayerManager().getEditDataSet(); 107 115 assertNotNull(ds);
Note: See TracChangeset
for help on using the changeset viewer.