Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipse-dev] [aeri] Knowing whether Eclipse has an active window on all platforms

Ah! I've bumped into this; thought it was something in docker tooling :)


On 11 Sep 2015, at 15:29, Marcel Bruch <marcel.bruch@xxxxxxxxxxxxxx> wrote:

In advance: this is an urgent request and your input would be required before Mars.1 RC4 is out. Thank you.

Greetings eclipse-dev,

When an error is logged in Eclipse, AERI tests whether there is an active Eclipse window before it displays a popup notification (no active window - no popup).

This test is executed in a display.syncExec call as given below. This call, however, is now under suspicion to cause deadlocks (see [1] for details). 

public static boolean hasActiveWindow() {
        final Display display = getDisplay().orNull();
        if (display == null) {
            return false;
        if (isUIThread()) {
            return display.getActiveShell() != null;
        // else
        final AtomicBoolean res = new AtomicBoolean(false);
        display.syncExec(new Runnable() {
            public void run() {
                if (display.getActiveShell() == null) {
                } else {
        return res.get();

I’d like to know how I can *reliably* determine (from a background thread) whether Eclipse has an active window (or an open wizard etc.) or not. What is the preferred way to do that? Would something like the lines below work (on all platforms)?

        IWorkbenchWindow[] ww = PlatformUI.getWorkbench().getWorkbenchWindows();
        for(IWorkbenchWindow wwwww){
            activePage = www.getActivePage(); // may be null. Is it always null when called from non-ui-thread?
                // yes, there is an eclipse window that has focus?

I apologize for not running any tests myself on this yet. Time is short to fix that potential regression before Mars.1 and I’m likely not able to test all platforms reliably before RC4. That’s why I’m asking for your input directly.

Thanks in advance,

eclipse-dev mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top