1 package net.mograsim.plugin.util;
3 import java.util.concurrent.atomic.AtomicBoolean;
5 import org.eclipse.ui.PlatformUI;
8 * A utility class that requests the asynchronous execution of a Runnable in the SWT Thread. Making a new request before the old one is
9 * processed will override the old request.
11 public class SingleSWTRequest
13 private AtomicBoolean waiting = new AtomicBoolean();
14 private Runnable request;
16 public void request(Runnable request)
18 synchronized (waiting)
20 this.request = request;
24 PlatformUI.getWorkbench().getDisplay().asyncExec(() ->
26 synchronized (waiting)