A: 

I don't think there's a platform independent way of doing this. You will have to take a look at the platform-specific API calls and implement them via JNI or JNA.

For Windows, here's a snippet from one of my own applications:

public static void flashWindow(final Shell shell, boolean flashTray,
        boolean flashWindow) {
    try {
        if (isActiveWindow(shell)) {
            flashWindow = false;
            flashTray = false;
        }
        User32 lib = (User32) getLibrary("user32", User32.class);
        User32.FLASHWINFO flash = new User32.FLASHWINFO();
        flash.hWnd = new W32API.HANDLE(new W32API.UINT_PTR(shell.handle)
                .toPointer());
        flash.uCount = 2;
        flash.dwTimeout = 1000;
        if (flashTray || flashWindow) {
            flash.dwFlags = (flashTray ? User32.FLASHW_TRAY : 0)
                    | (flashWindow ? User32.FLASHW_CAPTION : 0);
        } else {
            flash.dwFlags = User32.FLASHW_STOP;
        }
        flash.cbSize = flash.size();
        if (lib.FlashWindowEx(flash) && !flashWindow) {
            final FocusListener focusListener = new FocusListener() {
                public void focusGained(FocusEvent arg0) {
                    flashWindow(shell, false, false);
                    shell.removeFocusListener(this);
                }

                public void focusLost(FocusEvent arg0) {
                }
            };
            shell.addFocusListener(focusListener);
        }
    } catch (UnsatisfiedLinkError e) {
    }
}

Here's a simplified version of getLibrary():

protected static StdCallLibrary getLibrary(String libraryName,
        Class<?> interfaceClass) throws UnsatisfiedLinkError {
    try {
        StdCallLibrary lib = (StdCallLibrary) Native.loadLibrary(libraryName,
                interfaceClass);
        return lib;
    } catch (UnsatisfiedLinkError e) {
        Logger.out.error("Could not load " + libraryName + " library.");
        throw e;
    }
}

Take care to dispose() the library when you're done with it.

Paul Lammertsma
thanks for that snippet - but having several different versions for each OS is not really what I wanted to achieve...
Gnark
To my knowledge, there is no pure Java solution. JNA/JNI can be quite imposing, but you only need to have three implementations. Unfortunately, you'll have to ask somebody else for the other two. :)
Paul Lammertsma
thought so - thanks for clarification!
Gnark
+1  A: 

What you could do to get the users attention without being annoying is to change the windows text this is protable with a simple:

shellName.setText("task 20% complete")

this would allow the user to get an update while having the window minimized and then add a focus listener to return the window to its normal text when focus is regained. This would allow for minimal intrusiveness while informing the user.

A: 

I had a similar problem with my plug-in.

What I ended up doing is creating a small icon for my program in the lower status dock (or whatever that thing at the bottom is called). Based on the completion of processes and other background events, my icon changes color and flashes (e.g., goes from grey to green when its initial setup is complete).

By making double clicks or right-clicks on this icon context-sensitive, I can then do things like open a corresponding window.

Uri
are you talking about the taskbar in windows? or is this an OS idependant workaround?
Gnark
A: 

Well, that's not exactly blinking, but since Eclipse 3.6 M6, you can overlay text, image or progress bar to the TaskItem in a platform-independent way with SWT. See the New and Noteworthy and the SWT snippet.

thSoft
Thanks, I already had a look at that feature but the problem is that I cannot force my users to upgrade to 3.6 :-(
Gnark
Too bad. Maybe separate this functionality into a plugin with the proper version constraints and mark it optional?
thSoft