01: /* uDig - User Friendly Desktop Internet GIS client
02: * http://udig.refractions.net
03: * (C) 2004, Refractions Research Inc.
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation;
08: * version 2.1 of the License.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: */
15: package net.refractions.udig.project.ui;
16:
17: import net.refractions.udig.project.ui.render.displayAdapter.ViewportPane;
18: import net.refractions.udig.ui.PlatformGIS;
19:
20: import org.eclipse.swt.SWT;
21: import org.eclipse.swt.widgets.Display;
22:
23: /**
24: *
25: * @author jones
26: * @since 1.1.0
27: */
28: public class BusyIndicator {
29: public static void showWhile(ViewportPane pane, Runnable runnable) {
30: Display display = Display.getCurrent();
31: if (display == null)
32: display = Display.getDefault();
33: showWhile(pane, display, runnable);
34: }
35:
36: public static void showWhile(final ViewportPane pane,
37: final Display display, final Runnable runnable) {
38:
39: PlatformGIS.syncInDisplayThread(new Runnable() {
40: public void run() {
41: pane
42: .setCursor(display
43: .getSystemCursor(SWT.CURSOR_WAIT));
44: org.eclipse.swt.custom.BusyIndicator.showWhile(display,
45: runnable);
46: pane.setCursor(null);
47: }
48: });
49:
50: }
51: }
|