Changeset 10129 in josm for trunk/src/org/openstreetmap/josm/actions
- Timestamp:
- 2016-04-09T23:24:01+02:00 (8 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/actions/downloadtasks
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/downloadtasks/AbstractChangesetDownloadTask.java
r10124 r10129 3 3 4 4 import java.awt.Component; 5 import java.lang.reflect.InvocationTargetException; 5 6 import java.net.URL; 6 7 import java.util.HashSet; … … 8 9 import java.util.concurrent.Future; 9 10 11 import javax.swing.SwingUtilities; 12 10 13 import org.openstreetmap.josm.Main; 11 14 import org.openstreetmap.josm.data.Bounds; 12 15 import org.openstreetmap.josm.data.osm.Changeset; 16 import org.openstreetmap.josm.data.osm.ChangesetCache; 13 17 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 14 18 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 15 19 import org.openstreetmap.josm.io.OsmServerChangesetReader; 20 import org.openstreetmap.josm.tools.ExceptionUtil; 21 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler; 16 22 17 23 /** … … 46 52 lastException = e; 47 53 setFailed(true); 54 } 55 56 protected final void updateChangesets() { 57 // update the global changeset cache with the downloaded changesets. 58 // this will trigger change events which views are listening to. They 59 // will update their views accordingly. 60 // 61 // Run on the EDT because UI updates are triggered. 62 // 63 Runnable r = new Runnable() { 64 @Override public void run() { 65 ChangesetCache.getInstance().update(downloadedChangesets); 66 } 67 }; 68 if (SwingUtilities.isEventDispatchThread()) { 69 r.run(); 70 } else { 71 try { 72 SwingUtilities.invokeAndWait(r); 73 } catch (InterruptedException e) { 74 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while updating changeset cache"); 75 } catch (InvocationTargetException e) { 76 Throwable t = e.getTargetException(); 77 if (t instanceof RuntimeException) { 78 BugReportExceptionHandler.handleException(t); 79 } else if (t instanceof Exception) { 80 ExceptionUtil.explainException(e); 81 } else { 82 BugReportExceptionHandler.handleException(t); 83 } 84 } 85 } 48 86 } 49 87 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetHeaderDownloadTask.java
r10124 r10129 6 6 import java.awt.Component; 7 7 import java.io.IOException; 8 import java.lang.reflect.InvocationTargetException;9 8 import java.util.Collection; 10 9 import java.util.Collections; 11 10 import java.util.HashSet; 12 11 import java.util.Set; 13 14 import javax.swing.SwingUtilities;15 12 16 13 import org.openstreetmap.josm.Main; … … 20 17 import org.openstreetmap.josm.io.OsmTransferException; 21 18 import org.openstreetmap.josm.tools.CheckParameterUtil; 22 import org.openstreetmap.josm.tools.ExceptionUtil;23 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;24 19 import org.xml.sax.SAXException; 25 20 … … 74 69 ExceptionDialogUtil.explainException(lastException); 75 70 } 76 Runnable r = new Runnable() { 77 @Override 78 public void run() { 79 ChangesetCache.getInstance().update(downloadedChangesets); 80 } 81 }; 82 83 if (SwingUtilities.isEventDispatchThread()) { 84 r.run(); 85 } else { 86 try { 87 SwingUtilities.invokeAndWait(r); 88 } catch (InterruptedException e) { 89 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while updating changeset cache"); 90 } catch (InvocationTargetException e) { 91 Throwable t = e.getTargetException(); 92 if (t instanceof RuntimeException) { 93 BugReportExceptionHandler.handleException(t); 94 } else if (t instanceof Exception) { 95 ExceptionUtil.explainException(e); 96 } else { 97 BugReportExceptionHandler.handleException(t); 98 } 99 } 100 } 71 updateChangesets(); 101 72 } 102 73 } -
trunk/src/org/openstreetmap/josm/actions/downloadtasks/ChangesetQueryTask.java
r10124 r10129 6 6 import java.awt.Component; 7 7 import java.io.IOException; 8 import java.lang.reflect.InvocationTargetException;9 8 10 9 import javax.swing.JOptionPane; 11 import javax.swing.SwingUtilities;12 10 13 11 import org.openstreetmap.josm.Main; 14 import org.openstreetmap.josm.data.osm.ChangesetCache;15 12 import org.openstreetmap.josm.data.osm.UserInfo; 16 13 import org.openstreetmap.josm.gui.JosmUserIdentityManager; … … 22 19 import org.openstreetmap.josm.tools.CheckParameterUtil; 23 20 import org.openstreetmap.josm.tools.ExceptionUtil; 24 import org.openstreetmap.josm.tools.bugreport.BugReportExceptionHandler;25 21 import org.xml.sax.SAXException; 26 22 … … 103 99 return; 104 100 } 105 106 // update the global changeset cache with the downloaded changesets. 107 // this will trigger change events which views are listening to. They 108 // will update their views accordingly. 109 // 110 // Run on the EDT because UI updates are triggered. 111 // 112 Runnable r = new Runnable() { 113 @Override public void run() { 114 ChangesetCache.getInstance().update(downloadedChangesets); 115 } 116 }; 117 if (SwingUtilities.isEventDispatchThread()) { 118 r.run(); 119 } else { 120 try { 121 SwingUtilities.invokeAndWait(r); 122 } catch (InterruptedException e) { 123 Main.warn("InterruptedException in "+getClass().getSimpleName()+" while updating changeset cache"); 124 } catch (InvocationTargetException e) { 125 Throwable t = e.getTargetException(); 126 if (t instanceof RuntimeException) { 127 BugReportExceptionHandler.handleException(t); 128 } else if (t instanceof Exception) { 129 ExceptionUtil.explainException(e); 130 } else { 131 BugReportExceptionHandler.handleException(t); 132 } 133 } 134 } 101 updateChangesets(); 135 102 } 136 103
Note:
See TracChangeset
for help on using the changeset viewer.