001 // License: GPL. For details, see LICENSE file.
002 package org.openstreetmap.josm.gui.progress;
003
004 import java.util.concurrent.LinkedBlockingQueue;
005 import java.util.concurrent.ThreadPoolExecutor;
006 import java.util.concurrent.TimeUnit;
007
008 import org.openstreetmap.josm.Main;
009
010 public class ProgressMonitorExecutor extends ThreadPoolExecutor {
011
012 public ProgressMonitorExecutor() {
013 super(1, 1, 0L, TimeUnit.MILLISECONDS,
014 new LinkedBlockingQueue<Runnable>());
015 }
016
017 @Override
018 public void execute(Runnable command) {
019 if (Main.currentProgressMonitor != null) {
020 //TODO show only if this can't be in background or better if always in background is not checked
021 Main.currentProgressMonitor.showForegroundDialog();
022 }
023 super.execute(command);
024 }
025
026 }