Skip to content

Designer 2.0 Cursor and Tool

Patrick Ziegler edited this page Dec 16, 2025 · 1 revision

Abstract

  1. There is always an active tool. When the active tool is deactivated, a new active tool is set.

  2. When a tool is activated, the cursor is updated using the [cursor calculation algorithm during tool execution]. The very first time a tool is activated is when the EditDomain is created and the IEditPartViewer does not yet exist, and the cursor update will only occur upon the IEditPartViewer's MouseEnter event. This is also how the cursor will be updated for tools activated from the palette or other locations outside the viewer. If activation occurs automatically /loadDefaultTool() or otherwise/ within the viewer, then the EditDomain knows it and the update can be performed immediately.

  3. While the tool is running, some actions may cause the tool to update the cursor again using the [cursor calculation algorithm during tool execution].

  4. When the tool is deactivated, the cursor is set to the shape under the current mouse position. If the shape is undefined, the cursor is set to the system cursor /setCursor(null)/

Cursor calculation algorithm when running the tool

  1. If the tool has a personal cursor (not null) set, use it.

  2. If the tool doesn't have a cursor, the cursor is set from the shape under

the current mouse position. If the shape is undefined, the cursor is set to the system cursor /setCursor(null)/ If a shape is used to define the cursor, the mouse position must be updated beforehand.

Supplement

The Draw2D cursor updates as the mouse moves over the shape's cursor. In GEF, the cursor updates the tool at its own discretion, and can only change based on mouse movement (Draw2D agglomeration) if the tool hasn't set its own cursor.

AbstractCreationTool

The CreationTool has a number of states associated with cursors:

  1. When moving over shapes,
  • it is accepted, then a special add cursor is used.
  • When moving over shapes and not accepted, then a special disable cursor is used.
  • Mouse button 1 is pressed, then the add cursor is used until it is released (after which the tool is deactivated).

if accepted, and disable otherwise.

  1. When mouse button 1 is pressed and the request is accepted, and until the button is released, another button is pressed, then the disable cursor is used until all of these buttons are released.

MarqueeSelectionTool

The MarqueeSelectionTool has a special cursor (crosshair) when moving and when dragging (press 1). If another button is used, or another button is pressed while dragging with button 1, a disable cursor is used until all these buttons are released. After this, the tool is deactivated.

SelectionTool

Since the SelectionTool doesn't have a special cursor, the cursor depends on the shapes under the mouse when moving. When the tracker is running, it automatically determines the cursor; when it's finished, the cursor is updated again based on the shape under the mouse. Since the tracker is activated by pressing button 1, its cursor must also be updated there.

ResizeTracker

One special cursor is always used for all cases: the handle cursor.

DragEditPartTracker

There's a special disable cursor if the tagger's request isn't accepted or if button 1 isn't used.

Clone this wiki locally