Ignore:
Timestamp:
2011-12-27T12:56:27+01:00 (12 years ago)
Author:
jttt
Message:

Add posibility to run please wait runnable tasks in background

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/gui/progress/AbstractProgressMonitor.java

    r4310 r4718  
    66import java.util.LinkedList;
    77import java.util.Queue;
     8
     9import javax.swing.SwingUtilities;
    810
    911public abstract class AbstractProgressMonitor implements ProgressMonitor {
     
    6163    }
    6264
     65    protected void doInEDT(Runnable runnable) {
     66        if (SwingUtilities.isEventDispatchThread()) {
     67            runnable.run();
     68        } else {
     69            SwingUtilities.invokeLater(runnable);
     70        }
     71    }
     72
    6373    /*=======
    6474     * Tasks
     
    6979    }
    7080
    71     public synchronized void beginTask(final String title, int ticks) {
     81    public synchronized void beginTask(String title, int ticks) {
    7282        this.taskTitle = title;
    7383        checkState(State.INIT);
Note: See TracChangeset for help on using the changeset viewer.