Changeset 12638 in josm


Ignore:
Timestamp:
2017-08-25T00:57:47+02:00 (4 weeks ago)
Author:
Don-vip
Message:

see #15182 - remove Main.currentProgressMonitor. Replacement: PleaseWaitProgressMonitor.getCurrent()

Location:
trunk/src/org/openstreetmap/josm
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/Main.java

    r12637 r12638  
    4848import org.openstreetmap.josm.gui.MapFrameListener;
    4949import org.openstreetmap.josm.gui.layer.MainLayerManager;
    50 import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
    5150import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
    5251import org.openstreetmap.josm.gui.preferences.projection.ProjectionPreference;
    53 import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
    5452import org.openstreetmap.josm.io.FileWatcher;
    5553import org.openstreetmap.josm.io.OnlineResource;
     
    147145
    148146    /**
    149      * The progress monitor being currently displayed.
    150      */
    151     public static PleaseWaitProgressMonitor currentProgressMonitor;
    152 
    153     /**
    154147     * The main menu bar at top of screen.
    155148     */
     
    726719    //  Implementation part
    727720    ///////////////////////////////////////////////////////////////////////////
    728 
    729     /**
    730      * Listener that sets the enabled state of undo/redo menu entries.
    731      */
    732     protected final CommandQueueListener redoUndoListener = (queueSize, redoSize) -> {
    733             menu.undo.setEnabled(queueSize > 0);
    734             menu.redo.setEnabled(redoSize > 0);
    735         };
    736721
    737722    /**
  • trunk/src/org/openstreetmap/josm/gui/MainApplication.java

    r12637 r12638  
    7676import org.openstreetmap.josm.gui.layer.AutosaveTask;
    7777import org.openstreetmap.josm.gui.layer.MainLayerManager;
     78import org.openstreetmap.josm.gui.layer.OsmDataLayer.CommandQueueListener;
    7879import org.openstreetmap.josm.gui.layer.TMSLayer;
    7980import org.openstreetmap.josm.gui.preferences.ToolbarPreferences;
     
    152153     */
    153154    private static final MainLayerManager layerManager = new MainLayerManager();
     155
     156    /**
     157     * Listener that sets the enabled state of undo/redo menu entries.
     158     */
     159    private final CommandQueueListener redoUndoListener = (queueSize, redoSize) -> {
     160            menu.undo.setEnabled(queueSize > 0);
     161            menu.redo.setEnabled(redoSize > 0);
     162        };
    154163
    155164    /**
  • trunk/src/org/openstreetmap/josm/gui/MainPanel.java

    r12636 r12638  
    1414import org.openstreetmap.josm.gui.layer.MainLayerManager.LayerAvailabilityEvent;
    1515import org.openstreetmap.josm.gui.layer.MainLayerManager.LayerAvailabilityListener;
     16import org.openstreetmap.josm.gui.progress.PleaseWaitProgressMonitor;
    1617import org.openstreetmap.josm.gui.util.GuiHelper;
    1718
     
    8081            listener.mapFrameInitialized(old, map);
    8182        }
    82         if (map == null && Main.currentProgressMonitor != null) {
    83             Main.currentProgressMonitor.showForegroundDialog();
     83        if (map == null && PleaseWaitProgressMonitor.getCurrent() != null) {
     84            PleaseWaitProgressMonitor.getCurrent().showForegroundDialog();
    8485        }
    8586    }
  • trunk/src/org/openstreetmap/josm/gui/MapStatus.java

    r12636 r12638  
    139139        @Override
    140140        public void mouseClicked(MouseEvent e) {
    141             PleaseWaitProgressMonitor monitor = Main.currentProgressMonitor;
     141            PleaseWaitProgressMonitor monitor = PleaseWaitProgressMonitor.getCurrent();
    142142            if (monitor != null) {
    143143                monitor.showForegroundDialog();
  • trunk/src/org/openstreetmap/josm/gui/progress/PleaseWaitProgressMonitor.java

    r12630 r12638  
    7373     */
    7474    public static final int PROGRESS_BAR_MAX = 10_000;
     75
     76    /**
     77     * The progress monitor being currently displayed.
     78     */
     79    static PleaseWaitProgressMonitor currentProgressMonitor;
     80
    7581    private final Component dialogParent;
    7682
     
    8692
    8793    private boolean cancelable;
     94
     95    /**
     96     * Returns the progress monitor being currently displayed.
     97     * @return the progress monitor being currently displayed
     98     * @since 12638
     99     */
     100    public static PleaseWaitProgressMonitor getCurrent() {
     101        return currentProgressMonitor;
     102    }
    88103
    89104    private void doInEDT(Runnable runnable) {
     
    215230    public void doBeginTask() {
    216231        doInEDT(() -> {
    217             Main.currentProgressMonitor = this;
     232            currentProgressMonitor = this;
    218233            if (GraphicsEnvironment.isHeadless()) {
    219234                return;
     
    339354                dialog.dispose();
    340355                dialog = null;
    341                 Main.currentProgressMonitor = null;
     356                currentProgressMonitor = null;
    342357                MapFrame map = MainApplication.getMap();
    343358                if (map != null) {
  • trunk/src/org/openstreetmap/josm/gui/progress/ProgressMonitorExecutor.java

    r9665 r12638  
    66import java.util.concurrent.TimeUnit;
    77
    8 import org.openstreetmap.josm.Main;
    98import org.openstreetmap.josm.tools.Utils;
    109
     
    3029    @Override
    3130    public void execute(Runnable command) {
    32         if (Main.currentProgressMonitor != null) {
     31        if (PleaseWaitProgressMonitor.currentProgressMonitor != null) {
    3332            //TODO show only if this can't be in background or better if always in background is not checked
    34             Main.currentProgressMonitor.showForegroundDialog();
     33            PleaseWaitProgressMonitor.currentProgressMonitor.showForegroundDialog();
    3534        }
    3635        super.execute(command);
Note: See TracChangeset for help on using the changeset viewer.