org.eclipse.gef
Class EditDomain
java.lang.Object
org.eclipse.gef.EditDomain
-
Direct Known Subclasses:
-
DefaultEditDomain
- public class EditDomain
- extends java.lang.Object
The collective state of a GEF "application", loosely defined by a CommandStack,
one or more EditPartViewers, and the active Tool. An EditDomain is usually tied with an
Eclipse
IEditorPart
). However, the distinction
between EditorPart and EditDomain was made to allow for much flexible use of the
Graphical Editing Framework.
Constructor Summary
|
EditDomain
()
Constructs an EditDomain and loads the default tool. |
Method Summary
|
void
|
addViewer
(
EditPartViewer viewer)
Adds an EditPartViewer into the EditDomain. |
void
|
focusGained
(FocusEvent event,
EditPartViewer viewer)
Called when one of the EditDomain's Viewers receives keyboard focus. |
void
|
focusLost
(FocusEvent event,
EditPartViewer viewer)
Called when one of the EditDomain's Viewers is losing keyboard focus. |
Tool
|
getActiveTool
()
Returns the active Tool |
CommandStack
|
getCommandStack
()
Returns the CommandStack.
|
Tool
|
getDefaultTool
()
Returns the default tool for this edit domain. |
PaletteViewer
|
getPaletteViewer
()
Returns the palette viewer currently associated with this domain. |
void
|
keyDown
(KeyEvent keyEvent,
EditPartViewer viewer)
Called when a key is pressed on a Viewer. |
void
|
keyTraversed
(TraverseEvent traverseEvent,
EditPartViewer viewer)
Called when a traversal occurs on a viewer. |
void
|
keyUp
(KeyEvent keyEvent,
EditPartViewer viewer)
Called when a key is released on a Viewer. |
void
|
loadDefaultTool
()
Loads the default Tool. |
void
|
mouseDoubleClick
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse button has been double-clicked on a Viewer. |
void
|
mouseDown
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse button has been pressed on a Viewer. |
void
|
mouseDrag
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse has been dragged within a Viewer. |
void
|
mouseHover
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse has hovered on a Viewer. |
void
|
mouseMove
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse has been moved on a Viewer. |
void
|
mouseUp
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse button has been released on a Viewer. |
void
|
mouseWheelScrolled
(Event event,
EditPartViewer viewer)
Called by the DomainEventDispatcher when the mouse wheel has been scrolled. |
void
|
nativeDragFinished
(DragSourceEvent event,
EditPartViewer viewer)
Called when a native drag has finished on a Viewer. |
void
|
nativeDragStarted
(DragSourceEvent event,
EditPartViewer viewer)
Called when a native drag has started on a Viewer. |
void
|
removeViewer
(
EditPartViewer viewer)
Removes a previously added viewer from the EditDomain. |
void
|
setActiveTool
(
Tool tool)
Sets the active Tool for this EditDomain. |
void
|
setCommandStack
(
CommandStack stack)
Sets the CommandStack . |
void
|
setDefaultTool
(
Tool tool)
Sets the default Tool, which is used if the Palette does not provide a default |
void
|
setPaletteRoot
(
PaletteRoot root)
Sets the PalatteRoot for this EditDomain. |
void
|
setPaletteViewer
(
PaletteViewer palette)
Sets the PaletteViewer for this EditDomain |
void
|
viewerEntered
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse enters a Viewer. |
void
|
viewerExited
(MouseEvent mouseEvent,
EditPartViewer viewer)
Called when the mouse exits a Viewer. |
Methods inherited from class java.lang.Object
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
|
EditDomain
public EditDomain()
- Constructs an EditDomain and loads the default tool.
addViewer
public void addViewer(
EditPartViewer viewer)
- Adds an EditPartViewer into the EditDomain. A viewer is most likely placed in a
WorkbenchPart
of some form, such as the IEditorPart or
an IViewPart.
-
-
Parameters:
-
viewer
- The EditPartViewer
focusGained
public void focusGained(FocusEvent event,
EditPartViewer viewer)
- Called when one of the EditDomain's Viewers receives keyboard focus.
-
-
Parameters:
-
event
- The SWT focus event -
viewer
- the Viewer that received the event.
focusLost
public void focusLost(FocusEvent event,
EditPartViewer viewer)
- Called when one of the EditDomain's Viewers is losing keyboard focus.
-
-
Parameters:
-
event
- The SWT focus event -
viewer
- the Viewer that received the event.
getActiveTool
public
Tool getActiveTool()
- Returns the active Tool
-
-
Returns:
- the active Tool
getCommandStack
public
CommandStack getCommandStack()
- Returns the CommandStack.
Command stacks could potentially be shared across domains depending on the application.
-
-
Returns:
- The command stack
getDefaultTool
public
Tool getDefaultTool()
- Returns the default tool for this edit domain. This will be a
SelectionTool
unless specifically replaced using
setDefaultTool(Tool)
.
-
-
Returns:
- The default Tool for this domain
getPaletteViewer
public
PaletteViewer getPaletteViewer()
- Returns the palette viewer currently associated with this domain.
-
-
Returns:
- The current palette viewer
-
Since:
- 1.0
keyDown
public void keyDown(KeyEvent keyEvent,
EditPartViewer viewer)
- Called when a key is pressed on a Viewer.
-
-
Parameters:
-
keyEvent
- The SWT key event -
viewer
- The source of the event.
keyTraversed
public void keyTraversed(TraverseEvent traverseEvent,
EditPartViewer viewer)
- Called when a traversal occurs on a viewer.
-
-
Parameters:
-
traverseEvent
- the SWT traverse event -
viewer
- the source of the event -
Since:
- 3.1
keyUp
public void keyUp(KeyEvent keyEvent,
EditPartViewer viewer)
- Called when a key is released on a Viewer.
-
-
Parameters:
-
keyEvent
- The SWT key event -
viewer
- the source of the event.
loadDefaultTool
public void loadDefaultTool()
- Loads the default Tool. If a palette has been provided and that palette has a default,
then that tool is loaded. If not, the EditDomain's default tool is loaded. By default,
this is the
SelectionTool
.
-
mouseDoubleClick
public void mouseDoubleClick(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse button has been double-clicked on a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The source of the event.
mouseDown
public void mouseDown(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse button has been pressed on a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The source of the event.
mouseDrag
public void mouseDrag(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse has been dragged within a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The source of the event.
mouseHover
public void mouseHover(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse has hovered on a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The source of the event.
mouseMove
public void mouseMove(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse has been moved on a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The viewer that the mouse event is over.
mouseUp
public void mouseUp(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse button has been released on a Viewer.
-
-
Parameters:
-
mouseEvent
- The SWT mouse event -
viewer
- The source of the event.
mouseWheelScrolled
public void mouseWheelScrolled(Event event,
EditPartViewer viewer)
- Called by the DomainEventDispatcher 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 has finished on a Viewer.
-
-
Parameters:
-
event
- The DragSourceEvent -
viewer
- The viewer where the drag finished
nativeDragStarted
public void nativeDragStarted(DragSourceEvent event,
EditPartViewer viewer)
- Called when a native drag has started on a Viewer.
-
-
Parameters:
-
event
- The DragSourceEvent -
viewer
- The viewer where the drag started
removeViewer
public void removeViewer(
EditPartViewer viewer)
- Removes a previously added viewer from the EditDomain. A Viewer that is removed from
the EditDomain will no longer forward input to the domain and its active Tool.
-
-
Parameters:
-
viewer
- the Viewer being removed
setCommandStack
public void setCommandStack(
CommandStack stack)
- Sets the
CommandStack
.
-
-
Parameters:
-
stack
- the CommandStack
setDefaultTool
public void setDefaultTool(
Tool tool)
- Sets the default Tool, which is used if the Palette does not provide a default
-
-
Parameters:
-
tool
- null
or a Tool
setPaletteRoot
public void setPaletteRoot(
PaletteRoot root)
- Sets the PalatteRoot for this EditDomain. If the EditDomain already knows about a
PaletteViewer, this root will be set into the palette viewer also. Loads the default
Tool after the root has been set.
It is recommended that the palette root not be set multiple times. Some components
(such as the PaletteCustomizerDialog for the PaletteViewer) might still hold on to the
old root. If the input has changed or needs to be refreshed, just remove all the
children from the root and add the new ones.
-
-
Parameters:
-
root
- the palette's root
setPaletteViewer
public void setPaletteViewer(
PaletteViewer palette)
- Sets the
PaletteViewer
for this EditDomain
-
-
Parameters:
-
palette
- the PaletteViewer
setActiveTool
public void setActiveTool(
Tool tool)
- Sets the active Tool for this EditDomain. If a current Tool is active, it is
deactivated. The new Tool is told its EditDomain, and is activated.
-
-
Parameters:
-
tool
- the Tool
viewerEntered
public void viewerEntered(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse enters a Viewer.
-
-
Parameters:
-
mouseEvent
- the SWT mouse event -
viewer
- the Viewer being entered
viewerExited
public void viewerExited(MouseEvent mouseEvent,
EditPartViewer viewer)
- Called when the mouse exits a Viewer.
-
-
Parameters:
-
mouseEvent
- the SWT mouse event -
viewer
- the Viewer being exited
Copyright (c) IBM Corp. and others 2000, 2007. All Rights Reserved.