Changeset 12695 in josm for trunk/src/org/openstreetmap/josm/gui/MainApplication.java
- Timestamp:
- 2017-08-29T00:16:25+02:00 (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/MainApplication.java
r12691 r12695 38 38 import java.util.concurrent.Callable; 39 39 import java.util.concurrent.ExecutorService; 40 import java.util.concurrent.Executors; 40 41 import java.util.concurrent.Future; 41 42 import java.util.logging.Level; … … 60 61 import org.openstreetmap.josm.actions.JosmAction; 61 62 import org.openstreetmap.josm.actions.OpenFileAction; 63 import org.openstreetmap.josm.actions.OpenFileAction.OpenFileTask; 62 64 import org.openstreetmap.josm.actions.PreferencesAction; 63 65 import org.openstreetmap.josm.actions.RestartAction; … … 103 105 import org.openstreetmap.josm.io.OsmApiInitializationException; 104 106 import org.openstreetmap.josm.io.OsmTransferCanceledException; 107 import org.openstreetmap.josm.io.OsmTransferException; 105 108 import org.openstreetmap.josm.io.auth.CredentialsManager; 106 109 import org.openstreetmap.josm.io.auth.DefaultAuthenticator; … … 117 120 import org.openstreetmap.josm.tools.OsmUrlToBounds; 118 121 import org.openstreetmap.josm.tools.OverpassTurboQueryWizard; 122 import org.openstreetmap.josm.tools.PlatformHook.NativeOsCallback; 119 123 import org.openstreetmap.josm.tools.PlatformHookWindows; 120 124 import org.openstreetmap.josm.tools.RightAndLefthandTraffic; … … 124 128 import org.openstreetmap.josm.tools.bugreport.BugReport; 125 129 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 130 import org.xml.sax.SAXException; 126 131 127 132 /** … … 725 730 // initialize the platform hook, and 726 731 Main.determinePlatformHook(); 732 Main.platform.setNativeOsCallback(new DefaultNativeOsCallback()); 727 733 // call the really early hook before we do anything else 728 734 Main.platform.preStartupHook(); … … 1188 1194 } 1189 1195 } 1196 1197 private static class DefaultNativeOsCallback implements NativeOsCallback { 1198 @Override 1199 public void openFiles(List<File> files) { 1200 Executors.newSingleThreadExecutor(Utils.newThreadFactory("openFiles-%d", Thread.NORM_PRIORITY)).submit( 1201 new OpenFileTask(files, null) { 1202 @Override 1203 protected void realRun() throws SAXException, IOException, OsmTransferException { 1204 // Wait for JOSM startup is advanced enough to load a file 1205 while (Main.parent == null || !Main.parent.isVisible()) { 1206 try { 1207 Thread.sleep(25); 1208 } catch (InterruptedException e) { 1209 Logging.warn(e); 1210 Thread.currentThread().interrupt(); 1211 } 1212 } 1213 super.realRun(); 1214 } 1215 }); 1216 } 1217 1218 @Override 1219 public boolean handleQuitRequest() { 1220 return MainApplication.exitJosm(false, 0, null); 1221 } 1222 1223 @Override 1224 public void handleAbout() { 1225 MainApplication.getMenu().about.actionPerformed(null); 1226 } 1227 1228 @Override 1229 public void handlePreferences() { 1230 MainApplication.getMenu().preferences.actionPerformed(null); 1231 } 1232 } 1190 1233 }
Note:
See TracChangeset
for help on using the changeset viewer.