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 defaultControlusing the default style.protected voidCreates the default root editpart.protected LightweightSystemCreates the lightweight system used to host figures.Returns theHandleat the specified Point.findObjectAtExcluding(Point pt, Collection<IFigure> exclude, EditPartViewer.Conditional condition) Returnsnullor theEditPartat the specified location, using the given exclusion set and conditional.voidflush()Flushes and pending layouts and paints in the lightweight system.protected DomainEventDispatcherDeprecated.This method should not be called by subclassesprotected LayerManagerConvenience method for finding the layer manager.protected LightweightSystemReturns the lightweight system.protected IFigureDeprecated.There is no reason to call this method $TODO delete this methodprotected voidCalled if and when theControlis disposed.protected voidThis method is invoked when this viewer's control gains focus.protected voidThis method is invoked when this viewer's control loses focus.protected voidExtended to tell the lightweight system what its control is.protected voidExtended to flush paints during drop callbacks.protected voidHook the root figure into this viewer'sLightweightSystem.voidRegisters the accessible editpart with the event dispatcher.voidReveals the specified editpart by usingExposeHelpers.voidsetContextMenu(MenuManager contextMenu) Extended implementation to flush the viewer as the context menu is shown.voidSets the cursor for the viewer'sControl.protected voidsetDragSource(DragSource source) Extends the drag source to handle figures which handle MouseDown events, thereby aborting any DragDetect callbacks.voidsetEditDomain(EditDomain domain) Sets theEditDomainfor this viewer.voidsetRootEditPart(RootEditPart editpart) Sets the root of this viewer.protected voidsetRootFigure(IFigure figure) Deprecated.This method should no longer be used.voidsetRouteEventsToEditDomain(boolean value) Turns on/off the routing of events directly to the Editor.protected voidCalled when the control is being set tonull, but before it is null.voidDoes 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, getEditPartForModel, 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, setSelectionManagerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.gef.EditPartViewer
addDragSourceListener, addDragSourceListener, addDropTargetListener, addDropTargetListener, addPropertyChangeListener, appendSelection, deselect, deselectAll, findObjectAt, findObjectAtExcluding, getContents, getContextMenu, getControl, getEditDomain, getEditPartFactory, getEditPartForModel, getEditPartRegistry, getFocusEditPart, getKeyHandler, getProperty, getResourceManager, getRootEditPart, getSelectedEditParts, getSelection, getSelectionManager, getVisualPartMap, removeDragSourceListener, removeDragSourceListener, removeDropTargetListener, removeDropTargetListener, removePropertyChangeListener, select, setContents, setContents, setControl, setEditPartFactory, setFocus, setKeyHandler, setProperty, setSelectionManagerMethods 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:EditPartViewerOptionally creates the defaultControlusing the default style. The Control can also be created externally and then set into the Viewer.- Specified by:
createControlin interfaceEditPartViewer- Specified by:
createControlin 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
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:AbstractEditPartViewerCalled if and when theControlis disposed. Subclasses may extend this method to perform additional cleanup.- Overrides:
handleDisposein 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:GraphicalViewerReturns theHandleat the specified Point. Returnsnullif no handle exists at the given Point. The specified point should be relative to theclient areafor this Viewer'sControl.- Specified by:
findHandleAtin interfaceGraphicalViewer- Parameters:
p- the location relative to the Control's client area- Returns:
- Handle
nullor a Handle - See Also:
-
findObjectAtExcluding
public EditPart findObjectAtExcluding(Point pt, Collection<IFigure> exclude, EditPartViewer.Conditional condition) Description copied from interface:EditPartViewerReturnsnullor theEditPartat the specified location, using the given exclusion set and conditional. This method behaves similarly toEditPartViewer.findObjectAt(Point).- Specified by:
findObjectAtExcludingin interfaceEditPartViewer- Parameters:
pt- The mouse locationexclude- The set of IFigures to be excludedcondition- the Conditional used to evaluate a potential hit- Returns:
nullor an EditPart- See Also:
-
flush
public void flush()Flushes and pending layouts and paints in the lightweight system.- Specified by:
flushin interfaceEditPartViewer- Overrides:
flushin 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
Returns the lightweight system.- Returns:
- the system
-
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:
hookDropTargetin classAbstractEditPartViewer- See Also:
-
hookControl
protected void hookControl()Extended to tell the lightweight system what its control is.- Overrides:
hookControlin classAbstractEditPartViewer- See Also:
-
registerAccessibleEditPart
Registers the accessible editpart with the event dispatcher.- Specified by:
registerAccessibleEditPartin interfaceEditPartViewer- Overrides:
registerAccessibleEditPartin classAbstractEditPartViewer- Parameters:
acc- the accessible- See Also:
-
reveal
Reveals the specified editpart by usingExposeHelpers. 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:
revealin interfaceEditPartViewer- Overrides:
revealin classAbstractEditPartViewer- Parameters:
part- the EditPart to reveal- See Also:
-
setContextMenu
Extended implementation to flush the viewer as the context menu is shown.- Specified by:
setContextMenuin interfaceEditPartViewer- Overrides:
setContextMenuin classAbstractEditPartViewer- Parameters:
contextMenu- theContextMenuProvider- See Also:
-
setCursor
Description copied from interface:EditPartViewerSets the cursor for the viewer'sControl. This method should only be called byTools.nullcan be used to indicate that the default cursor should be restored.- Specified by:
setCursorin interfaceEditPartViewer- Overrides:
setCursorin classAbstractEditPartViewer- Parameters:
newCursor-nullor a Cursor- See Also:
-
setDragSource
Extends the drag source to handle figures which handle MouseDown events, thereby aborting any DragDetect callbacks.- Overrides:
setDragSourcein classAbstractEditPartViewer- Parameters:
source-nullor a drag source- See Also:
-
setEditDomain
Description copied from interface:EditPartViewerSets theEditDomainfor this viewer. The Viewer will route all mouse and keyboard events to the EditDomain.- Specified by:
setEditDomainin interfaceEditPartViewer- Overrides:
setEditDomainin classAbstractEditPartViewer- Parameters:
domain- The EditDomain- See Also:
-
setRootEditPart
Description copied from interface:EditPartViewerSets the root of this viewer. The root should not be confused with the contents.- Specified by:
setRootEditPartin interfaceEditPartViewer- Overrides:
setRootEditPartin classAbstractEditPartViewer- Parameters:
editpart- the RootEditPart- See Also:
-
setRootFigure
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:EditPartViewerTurns on/off the routing of events directly to the Editor. If supported by the viewer implementation, all Events should be routed to theEditDomainrather than handled in the default way.- Specified by:
setRouteEventsToEditDomainin interfaceEditPartViewer- Overrides:
setRouteEventsToEditDomainin classAbstractEditPartViewer- Parameters:
value- true if the viewer should route events to the EditDomain- See Also:
-
unhookControl
protected void unhookControl()Description copied from class:AbstractEditPartViewerCalled when the control is being set tonull, but before it is null.- Overrides:
unhookControlin classAbstractEditPartViewer- See Also:
-
unregisterAccessibleEditPart
Description copied from class:AbstractEditPartViewerDoes nothing by default. Subclasses needing to add accessibility support should override this method.- Specified by:
unregisterAccessibleEditPartin interfaceEditPartViewer- Overrides:
unregisterAccessibleEditPartin classAbstractEditPartViewer- Parameters:
acc- the accessible part- See Also:
-