Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse GEF
3.3

org.eclipse.gef
Interface Tool

All Known Subinterfaces:
DragTracker
All Known Implementing Classes:
AbstractTool, ConnectionDragCreationTool, ConnectionEndpointTracker, MarqueeDragTracker, SelectEditPartTracker, SimpleDragTracker

public interface Tool

A Tool interprets Mouse and Keyboard input from an EditDomain and its EditPartViewers. The active Tool and its state determines how the EditDomain will interpret input. Input flows from a Viewer, to the EditDomain, to the EditDomain's active Tool.

Tools process low-level events and turn them into higher-level operations. These operations are encapsulated by Requests. The Requests are then used to communicate with EditParts in the Viewer to perform the User's operation. Using Requests, Tools will:

  • Ask EditParts for Commands to perform changes on the model.
  • Ask EditParts to show and erase feedback during an operation.
  • Ask EditParts to perform a generic function, using EditPart.performRequest(Request).

    Tools also perform operations that do not involve the EditParts directly, such as changing the Viewer's selection, scrolling the viewer, or invoking an Action.
    All feedback should be erased and temporary changes reverted prior to executing any command.
    Tools should process most keystrokes. For example, the DELETE key should not be handled by adding a KeyListener to the Viewer's Control. Doing so would mean that pressing DELETE would not be sensitive to which Tool is currently active, and the state of the Tool. See KeyHandler for how keystrokes are generally processed.

    IMPORTANT: This interface is not intended to be implemented by clients. Clients should inherit from AbstractTool. New methods may be added in the future.


    Method Summary
     void activate ()
              Called when this tool becomes the active tool for the EditDomain.
     void deactivate ()
              Called when another Tool becomes the active tool for the EditDomain.
     void focusGained (FocusEvent event, EditPartViewer viewer)
              Called when a Viewer's Control gains keyboard focus.
     void focusLost (FocusEvent event, EditPartViewer viewer)
              Called when a Viewer's Control loses keyboard focus.
     void keyDown (KeyEvent keyEvent, EditPartViewer viewer)
              Called when a Viewer receives a key press.
     void keyTraversed (TraverseEvent event, EditPartViewer viewer)
              Called when a viewer receives a key traversal.
     void keyUp (KeyEvent keyEvent, EditPartViewer viewer)
              Called when a Viewer receives a key up.
     void mouseDoubleClick (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a double-click.
     void mouseDown (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse down.
     void mouseDrag (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse drag.
     void mouseHover (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse hover.
     void mouseMove (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse move.
     void mouseUp (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse up.
     void mouseWheelScrolled (Event event, EditPartViewer viewer)
              Called when the mouse wheel has been scrolled.
     void nativeDragFinished (DragSourceEvent event, EditPartViewer viewer)
              Called when a native drag ends on a Viewer.
     void nativeDragStarted (DragSourceEvent event, EditPartViewer viewer)
              Called when a native drag begins on a Viewer.
     void setEditDomain ( EditDomain domain)
              Called to set the EditDomain for this Tool.
     void setProperties (java.util.Map properties)
              This method can be invoked to set any properties of this tool.
     void setViewer ( EditPartViewer viewer)
              Called to set the current Viewer receiving events.
     void viewerEntered (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse enter.
     void viewerExited (MouseEvent mouseEvent, EditPartViewer viewer)
              Called when a Viewer receives a mouse exit.
     

    Method Detail

    activate

    public void activate()
    Called when this tool becomes the active tool for the EditDomain. implementors can perform any necessary initialization here.

    See Also:
    deactivate()

    deactivate

    public void deactivate()
    Called when another Tool becomes the active tool for the EditDomain. implementors can perform state clean-up or to free resources.


    focusGained

    public void focusGained(FocusEvent event,
                            
    EditPartViewer viewer)
    Called when a Viewer's Control gains keyboard focus.

    Parameters:
    event - The SWT focus event
    viewer - The Viewer which gained focus

    focusLost

    public void focusLost(FocusEvent event,
                          
    EditPartViewer viewer)
    Called when a Viewer's Control loses keyboard focus.

    Parameters:
    event - The SWT focus event
    viewer - The viewer that is losing focus

    keyDown

    public void keyDown(KeyEvent keyEvent,
                        
    EditPartViewer viewer)
    Called when a Viewer receives a key press.

    Parameters:
    keyEvent - the SWT KeyEvent
    viewer - the Viewer which received a key press

    keyTraversed

    public void keyTraversed(TraverseEvent event,
                             
    EditPartViewer viewer)
    Called when a viewer receives a key traversal. A tool can prevent the traversal from occuring by setting the doit field to false.

    Parameters:
    event - the SWT event
    viewer - the viewer which received the traversal
    Since:
    3.1

    keyUp

    public void keyUp(KeyEvent keyEvent,
                      
    EditPartViewer viewer)
    Called when a Viewer receives a key up.

    Parameters:
    keyEvent - the SWT KeyEvent
    viewer - the Viewer which received a key up

    mouseDoubleClick

    public void mouseDoubleClick(MouseEvent mouseEvent,
                                 
    EditPartViewer viewer)
    Called when a Viewer receives a double-click.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a double-click

    mouseDown

    public void mouseDown(MouseEvent mouseEvent,
                          
    EditPartViewer viewer)
    Called when a Viewer receives a mouse down.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse down

    mouseDrag

    public void mouseDrag(MouseEvent mouseEvent,
                          
    EditPartViewer viewer)
    Called when a Viewer receives a mouse drag. SWT does not distinguish between mouse drags and mouse moves, but GEF Viewers will make this distinction when dispatching events. A drag occurs if any mouse button is down.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a drag

    mouseHover

    public void mouseHover(MouseEvent mouseEvent,
                           
    EditPartViewer viewer)
    Called when a Viewer receives a mouse hover.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse down
    See Also:
    MouseTrackListener#mouseHover(MouseEvent)

    mouseMove

    public void mouseMove(MouseEvent mouseEvent,
                          
    EditPartViewer viewer)
    Called when a Viewer receives a mouse move.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse move
    See Also:
    mouseDrag(MouseEvent, EditPartViewer)

    mouseUp

    public void mouseUp(MouseEvent mouseEvent,
                        
    EditPartViewer viewer)
    Called when a Viewer receives a mouse up.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse up

    mouseWheelScrolled

    public void mouseWheelScrolled(Event event,
                                   
    EditPartViewer viewer)
    Called when the mouse wheel has been scrolled.

    Parameters:
    event - The SWT event
    viewer - The source of the event

    nativeDragFinished

    public void nativeDragFinished(DragSourceEvent event,
                                   
    EditPartViewer viewer)
    Called when a native drag ends on a Viewer. This event is important to Tools because mouseUp(..) will not occur once a native drag has started. The Tool should correct its state to handle this lost Event.

    Parameters:
    event - the SWT DragSourceEvent
    viewer - the Viewer on which a native drag started

    nativeDragStarted

    public void nativeDragStarted(DragSourceEvent event,
                                  
    EditPartViewer viewer)
    Called when a native drag begins on a Viewer. This event is important to Tools because mouseUp(..) will not occur once a native drag has started. The Tool should correct its state to handle this lost Event.

    Parameters:
    event - the SWT DragSourceEvent
    viewer - the Viewer on which a native drag started

    setEditDomain

    public void setEditDomain(
    EditDomain domain)
    Called to set the EditDomain for this Tool. This is called right before activate().

    Parameters:
    domain - The EditDomain to which this Tool belongs

    setViewer

    public void setViewer(
    EditPartViewer viewer)
    Called to set the current Viewer receiving events. This method is rarely called, since the Viewer is always passed along with the events themselves. This method really just applies to DragTrackers.

    Parameters:
    viewer - The current Viewer

    viewerEntered

    public void viewerEntered(MouseEvent mouseEvent,
                              
    EditPartViewer viewer)
    Called when a Viewer receives a mouse enter.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse enter

    viewerExited

    public void viewerExited(MouseEvent mouseEvent,
                             
    EditPartViewer viewer)
    Called when a Viewer receives a mouse exit.

    Parameters:
    mouseEvent - the SWT mouse event
    viewer - the Viewer which received a mouse exit

    setProperties

    public void setProperties(java.util.Map properties)
    This method can be invoked to set any properties of this tool. This allows clients who do not have direct access to a Tool to still be able to configure that tool. The given Map should have the property's key and value. This method will ignore unrecognized keys and values that are not of the expected type.

    This method should only be invoked once when the tool is first constructed and is being initialized. Invoking this method at other times may have undesired effects.

    Parameters:
    properties - a mapping of the properties to be set and their new values; can be null
    Since:
    3.1

    Eclipse GEF
    3.3

    Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.

 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire