Changeset 5452 in josm for trunk/src/org/openstreetmap/josm/gui
- Timestamp:
- 2012-08-18T19:21:29+02:00 (12 years ago)
- Location:
- trunk/src/org/openstreetmap/josm/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/gui/io/DownloadPrimitivesTask.java
r4497 r5452 6 6 7 7 import java.io.IOException; 8 import java.lang.reflect.InvocationTargetException;9 8 import java.util.List; 10 9 import java.util.Set; 11 12 import javax.swing.SwingUtilities;13 10 14 11 import org.openstreetmap.josm.actions.AutoScaleAction; … … 25 22 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 26 23 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 24 import org.openstreetmap.josm.gui.util.GuiHelper; 27 25 import org.openstreetmap.josm.io.MultiFetchServerObjectReader; 28 26 import org.openstreetmap.josm.io.OsmServerObjectReader; … … 82 80 return; 83 81 } 84 Runnable r =new Runnable() {82 GuiHelper.runInEDTAndWait(new Runnable() { 85 83 public void run() { 86 84 layer.mergeFrom(ds); … … 88 86 layer.onPostDownloadFromServer(); 89 87 } 90 }; 91 92 if (SwingUtilities.isEventDispatchThread()) { 93 r.run(); 94 } else { 95 try { 96 SwingUtilities.invokeAndWait(r); 97 } catch(InterruptedException e) { 98 e.printStackTrace(); 99 } catch(InvocationTargetException e) { 100 e.printStackTrace(); 101 } 102 } 88 }); 103 89 } 104 90 -
trunk/src/org/openstreetmap/josm/gui/io/UpdatePrimitivesTask.java
r4191 r5452 23 23 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 24 24 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 25 import org.openstreetmap.josm.gui.util.GuiHelper; 25 26 import org.openstreetmap.josm.io.MultiFetchServerObjectReader; 26 27 import org.openstreetmap.josm.io.OsmServerObjectReader; … … 80 81 return; 81 82 } 82 Runnable r =new Runnable() {83 GuiHelper.runInEDTAndWait(new Runnable() { 83 84 public void run() { 84 85 layer.mergeFrom(ds); 85 86 layer.onPostDownloadFromServer(); 86 87 } 87 }; 88 89 if (SwingUtilities.isEventDispatchThread()) { 90 r.run(); 91 } else { 92 try { 93 SwingUtilities.invokeAndWait(r); 94 } catch(InterruptedException e) { 95 e.printStackTrace(); 96 } catch(InvocationTargetException e) { 97 e.printStackTrace(); 98 } 99 } 88 }); 100 89 } 101 90 -
trunk/src/org/openstreetmap/josm/gui/io/UploadPrimitivesTask.java
r5057 r5452 28 28 import org.openstreetmap.josm.gui.layer.OsmDataLayer; 29 29 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 30 import org.openstreetmap.josm.gui.util.GuiHelper; 30 31 import org.openstreetmap.josm.io.ChangesetClosedException; 31 32 import org.openstreetmap.josm.io.OsmApi; … … 316 317 // - to the Upload Dialog 317 318 // - to map editing 318 Runnable r =new Runnable() {319 GuiHelper.runInEDT(new Runnable() { 319 320 public void run() { 320 321 // if the changeset is still open after this upload we want it to … … 357 358 } 358 359 } 359 }; 360 if (SwingUtilities.isEventDispatchThread()) { 361 r.run(); 362 } else { 363 SwingUtilities.invokeLater(r); 364 } 360 }); 365 361 } 366 362 -
trunk/src/org/openstreetmap/josm/gui/oauth/FullyAutomaticAuthorizationUI.java
r5422 r5452 24 24 import javax.swing.JTabbedPane; 25 25 import javax.swing.JTextField; 26 import javax.swing.SwingUtilities;27 26 import javax.swing.event.DocumentEvent; 28 27 import javax.swing.event.DocumentListener; … … 38 37 import org.openstreetmap.josm.gui.SideButton; 39 38 import org.openstreetmap.josm.gui.help.HelpUtil; 39 import org.openstreetmap.josm.gui.util.GuiHelper; 40 40 import org.openstreetmap.josm.gui.widgets.AbstractTextComponentValidator; 41 41 import org.openstreetmap.josm.gui.widgets.HtmlPanel; … … 519 519 }; 520 520 e.printStackTrace(); 521 if (SwingUtilities.isEventDispatchThread()) { 522 r.run(); 523 } else { 524 SwingUtilities.invokeLater(r); 525 } 521 GuiHelper.runInEDT(r); 526 522 } 527 523 … … 552 548 getProgressMonitor().worked(1); 553 549 if (canceled)return; 554 Runnable r =new Runnable() {550 GuiHelper.runInEDT(new Runnable() { 555 551 public void run() { 556 552 prepareUIForResultDisplay(); 557 553 setAccessToken(accessToken); 558 554 } 559 }; 560 if (SwingUtilities.isEventDispatchThread()) { 561 r.run(); 562 } else { 563 SwingUtilities.invokeLater(r); 564 } 555 }); 565 556 } catch(final OsmOAuthAuthorizationException e) { 566 557 handleException(e); -
trunk/src/org/openstreetmap/josm/gui/progress/SwingRenderingProgressMonitor.java
r5266 r5452 4 4 import java.awt.Component; 5 5 6 import javax.swing.SwingUtilities;7 8 6 import org.openstreetmap.josm.Main; 7 import org.openstreetmap.josm.gui.util.GuiHelper; 9 8 import org.openstreetmap.josm.tools.CheckParameterUtil; 10 9 … … 32 31 } 33 32 34 private void doInEDT(Runnable runnable) {35 if (SwingUtilities.isEventDispatchThread()) {36 runnable.run();37 } else {38 SwingUtilities.invokeLater(runnable);39 }40 }41 42 33 @Override 43 34 public void doBeginTask() { 44 doInEDT(new Runnable() {35 GuiHelper.runInEDT(new Runnable() { 45 36 public void run() { 46 37 delegate.setCustomText(""); … … 60 51 if (newValue != currentProgressValue) { 61 52 currentProgressValue = newValue; 62 doInEDT(new Runnable() {53 GuiHelper.runInEDT(new Runnable() { 63 54 public void run() { 64 55 delegate.setValue(currentProgressValue); … … 71 62 protected void doSetCustomText(final String title) { 72 63 checkState(State.IN_TASK, State.IN_SUBTASK); 73 doInEDT(new Runnable() {64 GuiHelper.runInEDT(new Runnable() { 74 65 public void run() { 75 66 delegate.setCustomText(title); … … 81 72 protected void doSetTitle(final String title) { 82 73 checkState(State.IN_TASK, State.IN_SUBTASK); 83 doInEDT(new Runnable() {74 GuiHelper.runInEDT(new Runnable() { 84 75 public void run() { 85 76 delegate.setTaskTitle(title); … … 90 81 @Override 91 82 protected void doSetIntermediate(final boolean value) { 92 doInEDT(new Runnable() {83 GuiHelper.runInEDT(new Runnable() { 93 84 public void run() { 94 85 delegate.setIndeterminate(value);
Note:
See TracChangeset
for help on using the changeset viewer.