GEF v2.0

org.eclipse.gef
Interface EditPartViewer

All Superinterfaces:
ISelectionProvider
All Known Subinterfaces:
GraphicalViewer, PaletteViewer
All Known Implementing Classes:
AbstractEditPartViewer

public interface EditPartViewer
extends ISelectionProvider

Displays EditParts, manages selection, and routes Input events to an EditDomain. The EditDomain typically sends these events to the Tool that is currently active. The output of an EditPartViewer is the set of selected EditParts. The last member of the selection is said to be "primary" selected. The Viewer tells EditParts of their membership to the viewer's selection by calling setSelection(int)


Method Summary
 void addDragSourceListener(TransferDragSourceListener listener)
          Adds the TransferDragSourceListener to the viewer to handle DragEvents.
 void addDropTargetListener(TransferDropTargetListener listener)
          Adds the TransferDropTargetListener to the viewer to handle DropEvents.
 void appendSelection(EditPart editpart)
          appends the EditPart to the Viewer's selection set.
 Control createControl(Composite composite)
          if called, will create the default Control with the default style bits.
 void deselect(EditPart editpart)
          Removes the EditPart from the selection, and sets the last member of the selection to be the "primary" selection.
 void deselectAll()
          deselects all EditParts.
 void dispose()
          Disposes the viewer.
 EditPart findObjectAt(Point p)
          Returns null or the EditPart at the given mouse location.
 EditPart findObjectAtExcluding(Point p, Collection c)
          Returns null or the EditPart at the given mouse location, excluding all EditParts in the Collection c.
 void flush()
           
 EditPart getContents()
          Returns the contents of this EditPartViewer.
 Control getControl()
          Returns the SWT Control for this viewer.
 EditDomain getEditDomain()
          Returns the EditDomain to which the viewer belongs
 EditPartFactory getEditPartFactory()
           
 Map getEditPartRegistry()
          Returns the map for registering EditParts by Keys.
 EditPart getFocusEditPart()
           
 KeyHandler getKeyHandler()
           
 RootEditPart getRootEditPart()
          Returns the RootEditPart.
 List getSelectedEditParts()
          Returns a list containing the currently selected editparts.
 Map getVisualPartMap()
          Returns the map for registering visual parts to the EditParts which created them.
 void registerAccessibleEditPart(AccessibleEditPart acc)
           
 void select(EditPart editpart)
          Replaces the current selection with the EditPart.
 void setContents(EditPart editpart)
          Sets the Contents for this Viewer.
 void setContents(Object contents)
          Creates an EditPart for the specified contents using this viewers Factory.
 void setContextMenuProvider(ContextMenuProvider menuProvider)
          sets the ContextMenuProvider that will be used when the user invokes the context menu on the Viewer's control.
 void setControl(Control control)
          Optionally sets the control that the viewer should use.
 void setCursor(Cursor c)
          Sets the cursor for the viewer's control.
 void setEditDomain(EditDomain domain)
          Sets the EditDomain for this viewer.
 void setEditPartFactory(EditPartFactory factory)
           
 void setFocus(EditPart part)
           
 void setKeyHandler(KeyHandler keyHandler)
           
 void setRootEditPart(RootEditPart root)
          Sets the root of this viewer.
 void setRouteEventsToEditor(boolean value)
          Turns on/off the routing of events directly to the Editor.
 void unregisterAccessibleEditPart(AccessibleEditPart acc)
           
 
Methods inherited from interface org.eclipse.jface.viewers.ISelectionProvider
addSelectionChangedListener, getSelection, removeSelectionChangedListener, setSelection
 

Method Detail

addDragSourceListener

public void addDragSourceListener(TransferDragSourceListener listener)
Adds the TransferDragSourceListener to the viewer to handle DragEvents.

addDropTargetListener

public void addDropTargetListener(TransferDropTargetListener listener)
Adds the TransferDropTargetListener to the viewer to handle DropEvents.

appendSelection

public void appendSelection(EditPart editpart)
appends the EditPart to the Viewer's selection set. The EditPart becomes the new Primary selection. Fires selection changed to ISelectionListeners.

createControl

public Control createControl(Composite composite)
if called, will create the default Control with the default style bits. The control can also be created externally and then set into the Viewer.
See Also:
setControl(Control)

deselect

public void deselect(EditPart editpart)
Removes the EditPart from the selection, and sets the last member of the selection to be the "primary" selection. Fires selection changed to ISelectionListeners.

deselectAll

public void deselectAll()
deselects all EditParts. Fires selection changed to ISelectionListeners.

dispose

public void dispose()
Disposes the viewer. Dispose should unhook all Listeners, and free any allocated resources. Dispose should also deactivate the root EditPart, which will deactivate all EditParts.
See Also:
EditPart.deactivate()

findObjectAt

public EditPart findObjectAt(Point p)
Returns null or the EditPart at the given mouse location.
Parameters:
point - The mouse location

findObjectAtExcluding

public EditPart findObjectAtExcluding(Point p,
                                      Collection c)
Returns null or the EditPart at the given mouse location, excluding all EditParts in the Collection c. If the editpart at the location is part of the exclusion set, the Viewer should try to search through other EditParts in z-order that also occupy that point.
Parameters:
point - The mouse location
c - The collection of editpart that should be excluded from the search

flush

public void flush()

getContents

public EditPart getContents()
Returns the contents of this EditPartViewer.

getControl

public Control getControl()
Returns the SWT Control for this viewer.

getEditDomain

public EditDomain getEditDomain()
Returns the EditDomain to which the viewer belongs

getEditPartFactory

public EditPartFactory getEditPartFactory()

getEditPartRegistry

public Map getEditPartRegistry()
Returns the map for registering EditParts by Keys. EditParts may register themselves using any method, and may register themselved multiple times. This registry is used to help EditParts find other EditParts.

getFocusEditPart

public EditPart getFocusEditPart()

getKeyHandler

public KeyHandler getKeyHandler()

getRootEditPart

public RootEditPart getRootEditPart()
Returns the RootEditPart. The root is typically not replaced, although it may be. Also, the root is generally a placeholder and has no corresponding view, not does it support editing of any kind. A RootEditPart has no parent, and knows its Viewer.
See Also:
setContents(EditPart), setRootEditPart(RootEditPart)

getSelectedEditParts

public List getSelectedEditParts()
Returns a list containing the currently selected editparts.

getVisualPartMap

public Map getVisualPartMap()
Returns the map for registering visual parts to the EditParts which created them. This map is used externally by EditParts to register one or more visual parts. It is used internally by the viewer during hit-testing to map a visual to its EditPart.

registerAccessibleEditPart

public void registerAccessibleEditPart(AccessibleEditPart acc)

select

public void select(EditPart editpart)
Replaces the current selection with the EditPart. Fires selectionChanged event to ISelectionListeners.

setContents

public void setContents(EditPart editpart)
Sets the Contents for this Viewer. The Contents EditPart is installed in the RootEditPart for this Viewer.
See Also:
getRootEditPart(), setRootEditPart(RootEditPart)

setContents

public void setContents(Object contents)
Creates an EditPart for the specified contents using this viewers Factory.
See Also:
setEditPartFactory(EditPartFactory)

setContextMenuProvider

public void setContextMenuProvider(ContextMenuProvider menuProvider)
sets the ContextMenuProvider that will be used when the user invokes the context menu on the Viewer's control.
See Also:
getControl()

setControl

public void setControl(Control control)
Optionally sets the control that the viewer should use.
See Also:
createControl(Composite)

setCursor

public void setCursor(Cursor c)
Sets the cursor for the viewer's control.
See Also:
getControl()

setEditDomain

public void setEditDomain(EditDomain domain)
Sets the EditDomain for this viewer. When this editor is set, it is the viewer's resposibility to route all of the mouse and keyboard events to the editor.
Parameters:
domain - The EditDomain

setEditPartFactory

public void setEditPartFactory(EditPartFactory factory)

setFocus

public void setFocus(EditPart part)

setKeyHandler

public void setKeyHandler(KeyHandler keyHandler)

setRootEditPart

public void setRootEditPart(RootEditPart root)
Sets the root of this viewer. It is uncommon to replace the default root. Instead, applications will typically call setContents(EditPart)

setRouteEventsToEditor

public void setRouteEventsToEditor(boolean value)
Turns on/off the routing of events directly to the Editor. If supported by the viewer, all events should be routed to the EditDomain rather than handled in the default way.

unregisterAccessibleEditPart

public void unregisterAccessibleEditPart(AccessibleEditPart acc)

GEF v2.0