Changeset 4758 in josm for trunk/src


Ignore:
Timestamp:
2012-01-01T18:27:06+01:00 (8 years ago)
Author:
jttt
Message:

Fix #7212 "Update data" broken (regression)

Location:
trunk/src/org/openstreetmap/josm/gui/progress
Files:
3 edited

Legend:

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

    r4718 r4758  
    66import java.util.LinkedList;
    77import java.util.Queue;
    8 
    9 import javax.swing.SwingUtilities;
    108
    119public abstract class AbstractProgressMonitor implements ProgressMonitor {
     
    6159        }
    6260        throw new ProgressException("Expected states are %s but current state is %s", Arrays.asList(expectedStates).toString(), state);
    63     }
    64 
    65     protected void doInEDT(Runnable runnable) {
    66         if (SwingUtilities.isEventDispatchThread()) {
    67             runnable.run();
    68         } else {
    69             SwingUtilities.invokeLater(runnable);
    70         }
    7161    }
    7262
  • trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java

    r4756 r4758  
    1313
    1414import javax.swing.JOptionPane;
     15import javax.swing.SwingUtilities;
    1516
    1617import org.openstreetmap.josm.Main;
     
    4849    private boolean cancelable;
    4950
     51    private void doInEDT(Runnable runnable) {
     52        // This must be invoke later even if current thread is EDT because inside there is dialog.setVisible which freeze current code flow until modal dialog is closed
     53        SwingUtilities.invokeLater(runnable);
     54    }
     55
     56
    5057    private void setDialogVisible(boolean visible) {
    5158        if (dialog.isVisible() != visible) {
  • trunk/src/org/openstreetmap/josm/gui/progress/SwingRenderingProgressMonitor.java

    r4718 r4758  
    11// License: GPL. For details, see LICENSE file.
    22package org.openstreetmap.josm.gui.progress;
     3
     4import javax.swing.SwingUtilities;
    35
    46import org.openstreetmap.josm.tools.CheckParameterUtil;
     
    2527        CheckParameterUtil.ensureParameterNotNull(delegate, "delegate");
    2628        this.delegate = delegate;
     29    }
     30
     31    private void doInEDT(Runnable runnable) {
     32        if (SwingUtilities.isEventDispatchThread()) {
     33            runnable.run();
     34        } else {
     35            SwingUtilities.invokeLater(runnable);
     36        }
    2737    }
    2838
Note: See TracChangeset for help on using the changeset viewer.