Package org.eclipse.gef.ui.parts
Class GraphicalViewerImpl
java.lang.Object
org.eclipse.gef.ui.parts.AbstractEditPartViewer
org.eclipse.gef.ui.parts.GraphicalViewerImpl
- All Implemented Interfaces:
EditPartViewer
,GraphicalViewer
,ISelectionProvider
- Direct Known Subclasses:
ScrollingGraphicalViewer
An EditPartViewer implementation based on
Figures
.-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.gef.EditPartViewer
EditPartViewer.Conditional
-
Field Summary
Fields inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
constantSelection, focusPart, selection, selectionListeners
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a GraphicalViewerImpl with the default root editpart. -
Method Summary
Modifier and TypeMethodDescriptioncreateControl
(Composite composite) Optionally creates the defaultControl
using the default style.protected void
Creates the default root editpart.protected org.eclipse.draw2d.LightweightSystem
Creates the lightweight system used to host figures.findHandleAt
(org.eclipse.draw2d.geometry.Point p) Returns theHandle
at the specified Point.findObjectAtExcluding
(org.eclipse.draw2d.geometry.Point pt, Collection exclude, EditPartViewer.Conditional condition) Returnsnull
or theEditPart
at the specified location, using the given exclusion set and conditional.void
flush()
Flushes and pending layouts and paints in the lightweight system.protected DomainEventDispatcher
Deprecated.This method should not be called by subclassesprotected LayerManager
Convenience method for finding the layer manager.protected org.eclipse.draw2d.LightweightSystem
Returns the lightweight system.protected org.eclipse.draw2d.IFigure
Deprecated.There is no reason to call this method $TODO delete this methodprotected void
Called if and when theControl
is disposed.protected void
This method is invoked when this viewer's control gains focus.protected void
This method is invoked when this viewer's control loses focus.protected void
Extended to tell the lightweight system what its control is.protected void
Extended to flush paints during drop callbacks.protected void
Hook the root figure into this viewer'sLightweightSystem
.void
Registers the accessible editpart with the event dispatcher.void
Reveals the specified editpart by usingExposeHelper
s.void
setContextMenu
(MenuManager contextMenu) Extended implementation to flush the viewer as the context menu is shown.void
Sets the cursor for the viewer'sControl
.protected void
setDragSource
(DragSource source) Extends the drag source to handle figures which handle MouseDown events, thereby aborting any DragDetect callbacks.void
setEditDomain
(EditDomain domain) Sets theEditDomain
for this viewer.void
setRootEditPart
(RootEditPart editpart) Sets the root of this viewer.protected void
setRootFigure
(org.eclipse.draw2d.IFigure figure) Deprecated.This method should no longer be used.void
setRouteEventsToEditDomain
(boolean value) Turns on/off the routing of events directly to the Editor.protected void
Called when the control is being set tonull
, but before it is null.void
Does nothing by default.Methods inherited from class org.eclipse.gef.ui.parts.AbstractEditPartViewer
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, addSelectionChangedListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, fireSelectionChanged, getContents, getContextMenu, getControl, getDelegatingDragAdapter, getDelegatingDropAdapter, getDragSource, getDropTarget, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, hookDragSource, init, primGetSelectedEditParts, refreshDragSourceAdapter, refreshDropTargetAdapter, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, removeSelectionChangedListener, select, setContents, setContents, setControl, setDropTarget, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelection, setSelectionManager
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.eclipse.gef.EditPartViewer
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, select, setContents, setContents, setControl, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelectionManager
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, removeSelectionChangedListener, setSelection
-
Constructor Details
-
GraphicalViewerImpl
public GraphicalViewerImpl()Constructs a GraphicalViewerImpl with the default root editpart.
-
-
Method Details
-
createControl
Description copied from interface:EditPartViewer
Optionally creates the defaultControl
using the default style. The Control can also be created externally and then set into the Viewer.- Specified by:
createControl
in interfaceEditPartViewer
- Specified by:
createControl
in classAbstractEditPartViewer
- Parameters:
composite
- the parent in which create the SWTControl
- Returns:
- the created Control for convenience
- See Also:
-
createDefaultRoot
protected void createDefaultRoot()Creates the default root editpart. Called during construction. -
createLightweightSystem
protected org.eclipse.draw2d.LightweightSystem createLightweightSystem()Creates the lightweight system used to host figures. Subclasses should not need to override this method.- Returns:
- the lightweight system
-
handleDispose
Description copied from class:AbstractEditPartViewer
Called if and when theControl
is disposed. Subclasses may extend this method to perform additional cleanup.- Overrides:
handleDispose
in classAbstractEditPartViewer
- Parameters:
e
- the disposeevent- See Also:
-
handleFocusGained
This method is invoked when this viewer's control gains focus. It gives focus to thefocusPart
, if there is one.- Parameters:
fe
- the focusEvent received by this viewer's control
-
handleFocusLost
This method is invoked when this viewer's control loses focus. It removes focus from thefocusPart
, if there is one.- Parameters:
fe
- the focusEvent received by this viewer's control
-
findHandleAt
Description copied from interface:GraphicalViewer
Returns theHandle
at the specified Point. Returnsnull
if no handle exists at the given Point. The specified point should be relative to theclient area
for this Viewer'sControl
.- Specified by:
findHandleAt
in interfaceGraphicalViewer
- Parameters:
p
- the location relative to the Control's client area- Returns:
- Handle
null
or a Handle - See Also:
-
findObjectAtExcluding
public EditPart findObjectAtExcluding(org.eclipse.draw2d.geometry.Point pt, Collection exclude, EditPartViewer.Conditional condition) Description copied from interface:EditPartViewer
Returnsnull
or theEditPart
at the specified location, using the given exclusion set and conditional. This method behaves similarly toEditPartViewer.findObjectAt(Point)
.- Specified by:
findObjectAtExcluding
in interfaceEditPartViewer
- Parameters:
pt
- The mouse locationexclude
- The set of EditParts to be excludedcondition
- the Conditional used to evaluate a potential hit- Returns:
null
or an EditPart- See Also:
-
flush
public void flush()Flushes and pending layouts and paints in the lightweight system.- Specified by:
flush
in interfaceEditPartViewer
- Overrides:
flush
in classAbstractEditPartViewer
- See Also:
-
getEventDispatcher
Deprecated.This method should not be called by subclassesReturns the event dispatcher- Returns:
- the event dispatcher
-
getLayerManager
Convenience method for finding the layer manager.- Returns:
- the LayerManager
-
getLightweightSystem
protected org.eclipse.draw2d.LightweightSystem getLightweightSystem()Returns the lightweight system.- Returns:
- the system
-
getRootFigure
protected org.eclipse.draw2d.IFigure getRootFigure()Deprecated.There is no reason to call this method $TODO delete this methodReturns the root figure- Returns:
- the root figure
-
hookDropTarget
protected void hookDropTarget()Extended to flush paints during drop callbacks.- Overrides:
hookDropTarget
in classAbstractEditPartViewer
- See Also:
-
hookControl
protected void hookControl()Extended to tell the lightweight system what its control is.- Overrides:
hookControl
in classAbstractEditPartViewer
- See Also:
-
registerAccessibleEditPart
Registers the accessible editpart with the event dispatcher.- Specified by:
registerAccessibleEditPart
in interfaceEditPartViewer
- Overrides:
registerAccessibleEditPart
in classAbstractEditPartViewer
- Parameters:
acc
- the accessible- See Also:
-
reveal
Reveals the specified editpart by usingExposeHelper
s. A bottom-up scan through the parent-chain is performed, looking for expose helpers along the way, and asking them to expose the given editpart.- Specified by:
reveal
in interfaceEditPartViewer
- Overrides:
reveal
in classAbstractEditPartViewer
- Parameters:
part
- the EditPart to reveal- See Also:
-
setContextMenu
Extended implementation to flush the viewer as the context menu is shown.- Specified by:
setContextMenu
in interfaceEditPartViewer
- Overrides:
setContextMenu
in classAbstractEditPartViewer
- Parameters:
contextMenu
- theContextMenuProvider
- See Also:
-
setCursor
Description copied from interface:EditPartViewer
Sets the cursor for the viewer'sControl
. This method should only be called byTools
.null
can be used to indicate that the default cursor should be restored.- Specified by:
setCursor
in interfaceEditPartViewer
- Overrides:
setCursor
in classAbstractEditPartViewer
- Parameters:
newCursor
-null
or a Cursor- See Also:
-
setDragSource
Extends the drag source to handle figures which handle MouseDown events, thereby aborting any DragDetect callbacks.- Overrides:
setDragSource
in classAbstractEditPartViewer
- Parameters:
source
-null
or a drag source- See Also:
-
setEditDomain
Description copied from interface:EditPartViewer
Sets theEditDomain
for this viewer. The Viewer will route all mouse and keyboard events to the EditDomain.- Specified by:
setEditDomain
in interfaceEditPartViewer
- Overrides:
setEditDomain
in classAbstractEditPartViewer
- Parameters:
domain
- The EditDomain- See Also:
-
setRootEditPart
Description copied from interface:EditPartViewer
Sets the root of this viewer. The root should not be confused with the contents.- Specified by:
setRootEditPart
in interfaceEditPartViewer
- Overrides:
setRootEditPart
in classAbstractEditPartViewer
- Parameters:
editpart
- the RootEditPart- See Also:
-
setRootFigure
protected void setRootFigure(org.eclipse.draw2d.IFigure figure) Deprecated.This method should no longer be used.Sets the lightweight system's root figure.- Parameters:
figure
- the root figure
-
hookRootFigure
protected void hookRootFigure()Hook the root figure into this viewer'sLightweightSystem
.- Since:
- 3.8
-
setRouteEventsToEditDomain
public void setRouteEventsToEditDomain(boolean value) Description copied from interface:EditPartViewer
Turns on/off the routing of events directly to the Editor. If supported by the viewer implementation, all Events should be routed to theEditDomain
rather than handled in the default way.- Specified by:
setRouteEventsToEditDomain
in interfaceEditPartViewer
- Overrides:
setRouteEventsToEditDomain
in classAbstractEditPartViewer
- Parameters:
value
- true if the viewer should route events to the EditDomain- See Also:
-
unhookControl
protected void unhookControl()Description copied from class:AbstractEditPartViewer
Called when the control is being set tonull
, but before it is null.- Overrides:
unhookControl
in classAbstractEditPartViewer
- See Also:
-
unregisterAccessibleEditPart
Description copied from class:AbstractEditPartViewer
Does nothing by default. Subclasses needing to add accessibility support should override this method.- Specified by:
unregisterAccessibleEditPart
in interfaceEditPartViewer
- Overrides:
unregisterAccessibleEditPart
in classAbstractEditPartViewer
- Parameters:
acc
- the accessible part- See Also:
-