GEF v2.0

org.eclipse.gef
Class DefaultEditDomain

java.lang.Object
  |
  +--org.eclipse.gef.DefaultEditDomain
All Implemented Interfaces:
EditDomain

public class DefaultEditDomain
extends Object
implements EditDomain

A default implementation of the EditDomain interface. This implementation will create a CommandStack by default. A SelectionTool will be used if no Palette or Tool is set. Users of this class must provide one or more EditPartViewers.


Constructor Summary
DefaultEditDomain(IEditorPart editorPart)
          Creates a DefaultEditDomain for the given IEditorPart
 
Method Summary
 void addViewer(EditPartViewer viewer)
          Adds a new viewer to the editor.
protected  CommandStack createCommandStack()
          Creates the default command Stack
 void focusGained(FocusEvent event, EditPartViewer viewer)
          Called when a viewer that the editor controls has gained focus.
 void focusLost(FocusEvent event, EditPartViewer viewer)
          Called when a viewer that the editor controls has lost focus.
 Tool getActiveTool()
          Return the current tool for the editor.
 CommandStack getCommandStack()
          Returns the command stack of this Editor.
 Tool getDefaultTool()
          Gets the default tool for this Editor.
 IEditorPart getEditorPart()
           
protected  void init()
           
 void keyDown(KeyEvent keyEvent, EditPartViewer viewer)
          Called when a key is pressed within a viewer that the editor controls.
 void keyUp(KeyEvent keyEvent, EditPartViewer viewer)
          Called when a key is pressed within a viewer that the editor controls.
 void loadDefaultTool()
          Sets the current tool to the default tool.
 void mouseDoubleClick(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been double clicked over a viewer that the editor controls.
 void mouseDown(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been pressed over a viewer that the editor controls.
 void mouseDrag(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been dragged over a viewer that the editor controls.
 void mouseHover(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been dragged over a viewer that the editor controls.
 void mouseMove(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been moved over a viewer that the editor controls.
 void mouseUp(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse button has been released over a viewer that the editor controls.
 void removeViewer(EditPartViewer viewer)
          Removes an already added viewer from the editor.
 void setCommandStack(CommandStack stack)
          Sets the command stack of this Editor with the input stack given.
 void setDefaultTool(Tool tool)
          Sets the default tool, which is used if the PaletteRoot has no default entry.
protected  void setEditorPart(IEditorPart editorPart)
           
 void setPaletteRoot(PaletteRoot root)
          Called to set the palette model for this Editor.
 void setPaletteViewer(PaletteViewer palette)
          Sets the palette viewer to be used by the editor.
 void setTool(Tool newTool)
          Set the current tool for the editor.
 void viewerEntered(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse has entered a viewer that the editor controls.
 void viewerExited(MouseEvent mouseEvent, EditPartViewer viewer)
          Called when the mouse has exited a viewer that the editor controls.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEditDomain

public DefaultEditDomain(IEditorPart editorPart)
Creates a DefaultEditDomain for the given IEditorPart
Method Detail

addViewer

public void addViewer(EditPartViewer viewer)
Adds a new viewer to the editor.
Specified by:
addViewer in interface EditDomain
Parameters:
viewer - The viewer to add

createCommandStack

protected CommandStack createCommandStack()
Creates the default command Stack

focusGained

public void focusGained(FocusEvent event,
                        EditPartViewer viewer)
Description copied from interface: EditDomain
Called when a viewer that the editor controls has gained focus.
Specified by:
focusGained in interface EditDomain
See Also:
EditDomain.focusGained(FocusEvent, EditPartViewer)

focusLost

public void focusLost(FocusEvent event,
                      EditPartViewer viewer)
Description copied from interface: EditDomain
Called when a viewer that the editor controls has lost focus.
Specified by:
focusLost in interface EditDomain
See Also:
EditDomain.focusLost(FocusEvent, EditPartViewer)

getActiveTool

public Tool getActiveTool()
Return the current tool for the editor. The current tool is the tool that will be routed all the input events for the viewers that the editor manages.
Specified by:
getActiveTool in interface EditDomain
Returns:
The current tool

getCommandStack

public CommandStack getCommandStack()
Returns the command stack of this Editor.
Specified by:
getCommandStack in interface EditDomain
Returns:
Command stack for this Editor.

getDefaultTool

public Tool getDefaultTool()
Gets the default tool for this Editor.
Returns:
The default Tool of this Editor.

getEditorPart

public IEditorPart getEditorPart()

init

protected void init()

keyDown

public void keyDown(KeyEvent keyEvent,
                    EditPartViewer viewer)
Called when a key is pressed within a viewer that the editor controls. Passes on the event to the current active tool.
Specified by:
keyDown in interface EditDomain
Parameters:
keyEvent - Event representing the key press.
viewer - Viewer where the key was pressed.

keyUp

public void keyUp(KeyEvent keyEvent,
                  EditPartViewer viewer)
Called when a key is pressed within a viewer that the editor controls. Passes on the event to the current active tool.
Specified by:
keyUp in interface EditDomain
Parameters:
keyEvent - Event representing the key press.
viewer - Viewer where the key was pressed.

loadDefaultTool

public void loadDefaultTool()
Sets the current tool to the default tool.
Specified by:
loadDefaultTool in interface EditDomain

mouseDoubleClick

public void mouseDoubleClick(MouseEvent mouseEvent,
                             EditPartViewer viewer)
Called when the mouse button has been double clicked over a viewer that the editor controls.
Specified by:
mouseDoubleClick in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse double-click.
viewer - Viewer where the mouse was double-clicked.

mouseDown

public void mouseDown(MouseEvent mouseEvent,
                      EditPartViewer viewer)
Called when the mouse button has been pressed over a viewer that the editor controls.
Specified by:
mouseDown in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse press down.
viewer - Viewer where the mouse was pressed.

mouseDrag

public void mouseDrag(MouseEvent mouseEvent,
                      EditPartViewer viewer)
Called when the mouse button has been dragged over a viewer that the editor controls.
Specified by:
mouseDrag in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse drag.
viewer - Viewer where the mouse was dragged.

mouseHover

public void mouseHover(MouseEvent mouseEvent,
                       EditPartViewer viewer)
Called when the mouse button has been dragged over a viewer that the editor controls.
Specified by:
mouseHover in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse drag.
viewer - Viewer where the mouse was dragged.

mouseMove

public void mouseMove(MouseEvent mouseEvent,
                      EditPartViewer viewer)
Called when the mouse button has been moved over a viewer that the editor controls.
Specified by:
mouseMove in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse move.
viewer - Viewer where the mouse was moved.

mouseUp

public void mouseUp(MouseEvent mouseEvent,
                    EditPartViewer viewer)
Called when the mouse button has been released over a viewer that the editor controls.
Specified by:
mouseUp in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse press release.
viewer - Viewer where the mouse was released.

removeViewer

public void removeViewer(EditPartViewer viewer)
Removes an already added viewer from the editor. A viewer that is removed from the editor will no longer be manipulatable by the editor.
Specified by:
removeViewer in interface EditDomain
Parameters:
viewer - The viewer to remove

setCommandStack

public void setCommandStack(CommandStack stack)
Sets the command stack of this Editor with the input stack given.
Parameters:
stack - The new command stack for this Editor.

setDefaultTool

public void setDefaultTool(Tool tool)
Sets the default tool, which is used if the PaletteRoot has no default entry.
Parameters:
tool - Default tool for this Editor.

setEditorPart

protected void setEditorPart(IEditorPart editorPart)

setPaletteRoot

public void setPaletteRoot(PaletteRoot root)
Called to set the palette model for this Editor. It loads the default tool from the given model, and sets the model to a palette viewer if present.
Parameters:
root - Model of the new palette.

setPaletteViewer

public void setPaletteViewer(PaletteViewer palette)
Sets the palette viewer to be used by the editor.
Parameters:
palette - Viewer of the palette for this Editor.

setTool

public void setTool(Tool newTool)
Set the current tool for the editor. The current tool is the tool that will be routed all the input events for the viewers that the editor manages.
Specified by:
setTool in interface EditDomain
Parameters:
newTool - The new tool for this Editor.

viewerEntered

public void viewerEntered(MouseEvent mouseEvent,
                          EditPartViewer viewer)
Called when the mouse has entered a viewer that the editor controls.
Specified by:
viewerEntered in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse press down.
viewer - Viewer that the mouse entered.

viewerExited

public void viewerExited(MouseEvent mouseEvent,
                         EditPartViewer viewer)
Called when the mouse has exited a viewer that the editor controls.
Specified by:
viewerExited in interface EditDomain
Parameters:
mouseEvent - Event representing the mouse press down.
viewer - Viewer that the mouse exited.

GEF v2.0