Package org.eclipse.gef.tools
Class AbstractTool.Input
java.lang.Object
org.eclipse.gef.util.FlagSupport
org.eclipse.gef.tools.AbstractTool.Input
- Enclosing class:
- AbstractTool
Allows the user to access mouse and keyboard input.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected int
Returns the event modifiers.Returns the current location of the mouse.boolean
Returnstrue
if the ALT key is pressed.boolean
Returnstrue
if any of the mouse buttons are pressed.boolean
Returnstrue
if the CTRL key is pressed.boolean
isModKeyDown
(int mod) Returnstrue
if any of the given mod keys are pressed.boolean
isMouseButtonDown
(int which) Returnstrue
if the specified button is down.boolean
Returnstrue
if the SHIFT key is pressed.void
Sets the keyboard input based on the KeyEvent.void
setInput
(MouseEvent me) Sets the mouse and keyboard input based on the MouseEvent.void
setMouseButton
(int which, boolean state) Sets mouse button #which
to be pressed ifstate
is true.void
setMouseLocation
(int x, int y) Sets the current location of the mouseMethods inherited from class org.eclipse.gef.util.FlagSupport
getFlag, setFlag
-
Constructor Details
-
Input
public Input()
-
-
Method Details
-
getModifiers
protected int getModifiers()Returns the event modifiers. Modifiers are defined inMouseEvent.stateMask
, and include things like the mouse buttons and keyboard modifier keys.- Returns:
- the event modifiers
-
getMouseLocation
Returns the current location of the mouse.- Returns:
- the mouse location
-
isAltKeyDown
public boolean isAltKeyDown()Returnstrue
if the ALT key is pressed.- Returns:
true
if the ALT key is pressed
-
isAnyButtonDown
public boolean isAnyButtonDown()Returnstrue
if any of the mouse buttons are pressed.- Returns:
true
if any of the mouse buttons are pressed
-
isControlKeyDown
public boolean isControlKeyDown()Returnstrue
if the CTRL key is pressed.- Returns:
true
of CTRL pressed
-
isModKeyDown
public boolean isModKeyDown(int mod) Returnstrue
if any of the given mod keys are pressed.- Parameters:
mod
- SWT.MOD1, SWT.MOD2, SWT.MOD3, SWT.MOD4 or any combination thereof- Returns:
true
if the given mod key is pressed- Since:
- 3.1
-
isMouseButtonDown
public boolean isMouseButtonDown(int which) Returnstrue
if the specified button is down.- Parameters:
which
- which button- Returns:
true
if the button is down
-
isShiftKeyDown
public boolean isShiftKeyDown()Returnstrue
if the SHIFT key is pressed.- Returns:
true
if SHIFT pressed
-
setInput
Sets the keyboard input based on the KeyEvent.- Parameters:
ke
- the key event providing the input
-
setInput
Sets the mouse and keyboard input based on the MouseEvent.- Parameters:
me
- the mouse event providing the input
-
setMouseButton
public void setMouseButton(int which, boolean state) Sets mouse button #which
to be pressed ifstate
is true.- Parameters:
which
- which buttonstate
-true
if button down
-
setMouseLocation
public void setMouseLocation(int x, int y) Sets the current location of the mouse- Parameters:
x
- x locationy
- y location- Since:
- 3.4
-