001// License: GPL. For details, see LICENSE file. 002package org.openstreetmap.josm.gui.progress; 003 004import java.util.concurrent.LinkedBlockingQueue; 005import java.util.concurrent.ThreadPoolExecutor; 006import java.util.concurrent.TimeUnit; 007 008import org.openstreetmap.josm.Main; 009 010public 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}