-
-
Notifications
You must be signed in to change notification settings - Fork 267
/
SharedCursors.java
65 lines (56 loc) · 2.15 KB
/
SharedCursors.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*******************************************************************************
* Copyright (c) 2000, 2010 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
package org.eclipse.gef;
import org.eclipse.swt.graphics.Cursor;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.draw2d.Cursors;
import org.eclipse.gef.internal.Internal;
/**
* A shared collection of Cursors.
*
* @since 2.0
*/
public class SharedCursors extends Cursors {
/**
* Cursor for valid connection
*/
public static final Cursor CURSOR_PLUG;
/**
* Cursor for invalid connection
*/
public static final Cursor CURSOR_PLUG_NOT;
/**
* Cursor for adding to a tree
*/
public static final Cursor CURSOR_TREE_ADD;
/**
* Cursor for dragging in a tree
*/
public static final Cursor CURSOR_TREE_MOVE;
static {
CURSOR_PLUG = createCursor("icons/plugmask.gif", //$NON-NLS-1$
"icons/plug.bmp"); //$NON-NLS-1$
CURSOR_PLUG_NOT = createCursor("icons/plugmasknot.gif", //$NON-NLS-1$
"icons/plugnot.bmp"); //$NON-NLS-1$
CURSOR_TREE_ADD = createCursor("icons/Tree_Add_Mask.gif", //$NON-NLS-1$
"icons/Tree_Add.gif"); //$NON-NLS-1$
CURSOR_TREE_MOVE = createCursor("icons/Tree_Move_Mask.gif", //$NON-NLS-1$
"icons/Tree_Move.gif"); //$NON-NLS-1$
}
@SuppressWarnings("deprecation")
private static Cursor createCursor(String sourceName, String maskName) {
ImageDescriptor src = ImageDescriptor.createFromFile(Internal.class,
sourceName);
ImageDescriptor mask = ImageDescriptor.createFromFile(Internal.class,
maskName);
return new Cursor(null, src.getImageData(), mask.getImageData(), 0, 0);
}
}