Changeset 29665 in osm for applications


Ignore:
Timestamp:
2013-06-18T21:16:28+02:00 (11 years ago)
Author:
donvip
Message:

[josm_opendata] fix EDT violation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • applications/editors/josm/plugins/opendata/src/org/openstreetmap/josm/plugins/opendata/core/io/tabular/SpreadSheetReader.java

    r29653 r29665  
    3535import org.openstreetmap.josm.data.projection.Projection;
    3636import org.openstreetmap.josm.gui.progress.ProgressMonitor;
     37import org.openstreetmap.josm.gui.util.GuiHelper;
    3738import org.openstreetmap.josm.io.AbstractReader;
    3839import org.openstreetmap.josm.plugins.opendata.core.OdConstants;
     
    8889        }
    8990        return col;
     91        }
     92       
     93        private class ChooserLauncher implements Runnable {
     94
     95            public Projection proj = null;
     96        private final ProgressMonitor progressMonitor;
     97           
     98        public ChooserLauncher(ProgressMonitor progressMonitor) {
     99            this.progressMonitor = progressMonitor;
     100        }
     101
     102        @Override public void run() {
     103            ProjectionChooser dialog = (ProjectionChooser) new ProjectionChooser(progressMonitor.getWindowParent()).showDialog();
     104            if (dialog.getValue() == 1) {
     105                proj = dialog.getProjection();
     106            }
     107        }
    90108        }
    91109       
     
    141159                        if (!handlerOK) {
    142160                                // TODO: filter proposed projections with min/max values ?
    143                                 ProjectionChooser dialog = (ProjectionChooser) new ProjectionChooser(progressMonitor.getWindowParent()).showDialog();
    144                                 if (dialog.getValue() != 1) {
     161                            ChooserLauncher launcher = new ChooserLauncher(progressMonitor);
     162                            GuiHelper.runInEDTAndWait(launcher);
     163                                if (launcher.proj == null) {
    145164                                        return null; // User clicked Cancel
    146165                                }
    147                                 Projection proj = dialog.getProjection();
    148166                        for (CoordinateColumns c : columns) {
    149                             c.proj = proj;
     167                            c.proj = launcher.proj;
    150168                        }
    151169                        }
Note: See TracChangeset for help on using the changeset viewer.