KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > forms > widgets > FormsResources


1 /*******************************************************************************
2  * Copyright (c) 2003, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ui.internal.forms.widgets;
12
13 import org.eclipse.swt.SWT;
14 import org.eclipse.swt.graphics.Cursor;
15 import org.eclipse.swt.widgets.Display;
16
17 /**
18  * Utility methods to access shared form-specific resources.
19  * <p>
20  * All methods declared on this class are static. This
21  * class cannot be instantiated.
22  * </p>
23  * <p>
24  * </p>
25  */

26 public class FormsResources {
27     private static Cursor busyCursor;
28     private static Cursor handCursor;
29     private static Cursor textCursor;
30     
31     public static Cursor getBusyCursor() {
32         if (busyCursor==null)
33             busyCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT);
34         return busyCursor;
35     }
36     public static Cursor getHandCursor() {
37         if (handCursor==null)
38             handCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_HAND);
39         return handCursor;
40     }
41     public static Cursor getTextCursor() {
42         if (textCursor==null)
43             textCursor = new Cursor(Display.getCurrent(), SWT.CURSOR_IBEAM);
44         return textCursor;
45     }
46     
47     public static int getProgressDelay(int index) {
48         /*
49         if (progressDelays==null)
50             return 0;
51         return progressDelays[index];
52         */

53         return 100;
54     }
55     
56     public static void shutdown() {
57         if (busyCursor!=null)
58             busyCursor.dispose();
59         if (handCursor!=null)
60             handCursor.dispose();
61         if (textCursor!=null)
62             textCursor.dispose();
63         busyCursor=null;
64         handCursor=null;
65         textCursor=null;
66     }
67 }
68
Popular Tags