Changeset 5452 in josm
- Timestamp:
- 2012-08-18T19:21:29+02:00 (13 years ago)
- Location:
- trunk/src/org/openstreetmap/josm
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/openstreetmap/josm/actions/CombineWayAction.java
r5132 r5452 20 20 21 21 import javax.swing.JOptionPane; 22 import javax.swing.SwingUtilities;23 22 24 23 import org.openstreetmap.josm.Main; … … 36 35 import org.openstreetmap.josm.gui.ExtendedDialog; 37 36 import org.openstreetmap.josm.gui.conflict.tags.CombinePrimitiveResolverDialog; 37 import org.openstreetmap.josm.gui.util.GuiHelper; 38 38 import org.openstreetmap.josm.tools.Pair; 39 39 import org.openstreetmap.josm.tools.Shortcut; … … 224 224 } 225 225 }; 226 if (SwingUtilities.isEventDispatchThread()) { 227 guiTask.run(); 228 } else { 229 SwingUtilities.invokeLater(guiTask); 230 } 226 GuiHelper.runInEDT(guiTask); 231 227 } 232 228 } -
trunk/src/org/openstreetmap/josm/actions/ValidateAction.java
r5360 r5452 11 11 import java.util.List; 12 12 13 import javax.swing.SwingUtilities;14 15 13 import org.openstreetmap.josm.Main; 16 14 import org.openstreetmap.josm.data.osm.OsmPrimitive; … … 21 19 import org.openstreetmap.josm.gui.PleaseWaitRunnable; 22 20 import org.openstreetmap.josm.gui.preferences.ValidatorPreference; 21 import org.openstreetmap.josm.gui.util.GuiHelper; 23 22 import org.openstreetmap.josm.io.OsmTransferException; 24 23 import org.openstreetmap.josm.tools.Shortcut; … … 138 137 // update GUI on Swing EDT 139 138 // 140 Runnable r =new Runnable() {139 GuiHelper.runInEDT(new Runnable() { 141 140 @Override 142 141 public void run() { … … 145 144 Main.main.getCurrentDataSet().fireSelectionChanged(); 146 145 } 147 }; 148 if (SwingUtilities.isEventDispatchThread()) { 149 r.run(); 150 } else { 151 SwingUtilities.invokeLater(r); 152 } 146 }); 153 147 } 154 148 -
trunk/src/org/openstreetmap/josm/data/osm/ChangesetCache.java
r5266 r5452 11 11 import java.util.concurrent.CopyOnWriteArrayList; 12 12 13 import javax.swing.SwingUtilities;14 15 13 import org.openstreetmap.josm.Main; 16 14 import org.openstreetmap.josm.data.Preferences.PreferenceChangeEvent; 17 15 import org.openstreetmap.josm.data.Preferences.PreferenceChangedListener; 16 import org.openstreetmap.josm.gui.util.GuiHelper; 18 17 19 18 /** … … 65 64 66 65 protected void fireChangesetCacheEvent(final ChangesetCacheEvent e) { 67 Runnable r =new Runnable() {66 GuiHelper.runInEDT(new Runnable() { 68 67 public void run() { 69 68 for(ChangesetCacheListener l: listeners) { … … 71 70 } 72 71 } 73 }; 74 if (SwingUtilities.isEventDispatchThread()) { 75 r.run(); 76 } else { 77 SwingUtilities.invokeLater(r); 78 } 72 }); 79 73 } 80 74 -
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); -
trunk/src/org/openstreetmap/josm/io/NMEAImporter.java
r5361 r5452 9 9 10 10 import javax.swing.JOptionPane; 11 import javax.swing.SwingUtilities;12 11 13 12 import org.openstreetmap.josm.Main; … … 17 16 import org.openstreetmap.josm.gui.layer.markerlayer.MarkerLayer; 18 17 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 18 import org.openstreetmap.josm.gui.util.GuiHelper; 19 19 20 20 public class NMEAImporter extends FileImporter { … … 35 35 final File fileFinal = file; 36 36 37 Runnable uiStuff =new Runnable() {37 GuiHelper.runInEDT(new Runnable() { 38 38 public void run() { 39 39 Main.main.addLayer(gpxLayer); … … 45 45 } 46 46 } 47 }; 48 if (SwingUtilities.isEventDispatchThread()) { 49 uiStuff.run(); 50 } else { 51 SwingUtilities.invokeLater(uiStuff); 52 } 47 }); 53 48 } 54 49 showNmeaInfobox(r.getNumberOfCoordinates() > 0, r); -
trunk/src/org/openstreetmap/josm/io/OsmChangeImporter.java
r5361 r5452 11 11 12 12 import javax.swing.JOptionPane; 13 import javax.swing.SwingUtilities;14 13 15 14 import org.openstreetmap.josm.Main; … … 19 18 import org.openstreetmap.josm.gui.progress.NullProgressMonitor; 20 19 import org.openstreetmap.josm.gui.progress.ProgressMonitor; 20 import org.openstreetmap.josm.gui.util.GuiHelper; 21 21 22 22 public class OsmChangeImporter extends FileImporter { … … 60 60 // FIXME: remove UI stuff from IO subsystem 61 61 // 62 Runnable uiStuff =new Runnable() {62 GuiHelper.runInEDT(new Runnable() { 63 63 @Override 64 64 public void run() { … … 73 73 layer.onPostLoadFromFile(); 74 74 } 75 }; 76 if (SwingUtilities.isEventDispatchThread()) { 77 uiStuff.run(); 78 } else { 79 SwingUtilities.invokeLater(uiStuff); 80 } 75 }); 81 76 } 82 77 }
Note:
See TracChangeset
for help on using the changeset viewer.