GEF v2.0

org.eclipse.gef.ui.parts
Class AbstractEditPartViewer

java.lang.Object
  |
  +--org.eclipse.gef.ui.parts.AbstractEditPartViewer
All Implemented Interfaces:
EditPartViewer, IMenuListener, ISelectionProvider
Direct Known Subclasses:
GraphicalViewerImpl, TreeViewer

public abstract class AbstractEditPartViewer
extends Object
implements EditPartViewer, IMenuListener


Field Summary
protected  List constantSelection
           
protected  List selection
           
protected  List selectionListeners
           
 
Constructor Summary
AbstractEditPartViewer()
           
 
Method Summary
 void addDragSourceListener(TransferDragSourceListener listener)
          At the moment, there can only be one drag listener on the DelegatingDragAdapter.
 void addDropTargetListener(TransferDropTargetListener listener)
          Adds the TransferDropTargetListener to the viewer to handle DropEvents.
 void addSelectionChangedListener(ISelectionChangedListener listener)
           
 void appendSelection(EditPart editpart)
          appends the EditPart to the Viewer's selection set.
abstract  Control createControl(Composite parent)
          This assumes that the subclass has created the control and simply returns the current control.
 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.
protected  void expose(EditPart part)
           
protected  void fireSelectionChanged()
           
 void flush()
           
 EditPart getContents()
          Returns the contents of this EditPartViewer.
protected  ContextMenuProvider getContextMenuProvider()
           
 Control getControl()
          Returns the SWT Control for this viewer.
protected  DelegatingDragAdapter getDelegatingDragAdapter()
           
protected  DelegatingDropAdapter getDelegatingDropAdapter()
           
protected  DragSource getDragSource()
           
protected  DropTarget getDropTarget()
           
 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.
 ISelection getSelection()
           
 Map getVisualPartMap()
          Returns the map for registering visual parts to the EditParts which created them.
protected  void hookControl()
           
protected  void hookDragSource()
           
protected  void hookDropTarget()
           
protected  void init()
           
 void menuAboutToShow(IMenuManager menu)
          Called just before the context menu is shown.
protected  List primGetSelectedEditParts()
           
protected  void refreshDragSourceAdapter()
           
protected  void refreshDropTargetAdapter()
           
 void registerAccessibleEditPart(AccessibleEditPart acc)
           
 void removeDragSourceListener(TransferDragSourceListener listener)
           
 void removeDropTargetListener(TransferDropTargetListener listener)
           
 void removeSelectionChangedListener(ISelectionChangedListener l)
           
 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 provider)
          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 cursor)
          Sets the cursor for the viewer's control.
 void setDropTarget(DropTarget target)
          Sets the dropTarget.
 void setEditDomain(EditDomain editdomain)
          Sets the EditDomain for this viewer.
 void setEditPartFactory(EditPartFactory factory)
           
 void setFocus(EditPart part)
           
 void setKeyHandler(KeyHandler handler)
           
 void setRootEditPart(RootEditPart editpart)
          Sets the root of this viewer.
 void setRouteEventsToEditor(boolean value)
          Turns on/off the routing of events directly to the Editor.
 void setSelection(ISelection newSelection)
          This method will clear the current selection, and set the given ISelection as the current selection.
protected  void unhookControl()
           
 void unregisterAccessibleEditPart(AccessibleEditPart acc)
           
 
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
findObjectAt, findObjectAtExcluding
 

Field Detail

selection

protected final List selection

constantSelection

protected final List constantSelection

selectionListeners

protected List selectionListeners
Constructor Detail

AbstractEditPartViewer

public AbstractEditPartViewer()
Method Detail

addSelectionChangedListener

public void addSelectionChangedListener(ISelectionChangedListener listener)
Specified by:
addSelectionChangedListener in interface ISelectionProvider

addDragSourceListener

public void addDragSourceListener(TransferDragSourceListener listener)
At the moment, there can only be one drag listener on the DelegatingDragAdapter. So, adding a listener will remove the existing listener.
Specified by:
addDragSourceListener in interface EditPartViewer

addDropTargetListener

public void addDropTargetListener(TransferDropTargetListener listener)
Description copied from interface: EditPartViewer
Adds the TransferDropTargetListener to the viewer to handle DropEvents.
Specified by:
addDropTargetListener in interface EditPartViewer

appendSelection

public void appendSelection(EditPart editpart)
Description copied from interface: EditPartViewer
appends the EditPart to the Viewer's selection set. The EditPart becomes the new Primary selection. Fires selection changed to ISelectionListeners.
Specified by:
appendSelection in interface EditPartViewer

createControl

public abstract Control createControl(Composite parent)
This assumes that the subclass has created the control and simply returns the current control. When overriding this method, call setControl(Control) with the newly created control and then call super.createControl(Composite).
Specified by:
createControl in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.setControl(Control)

deselect

public void deselect(EditPart editpart)
Description copied from interface: EditPartViewer
Removes the EditPart from the selection, and sets the last member of the selection to be the "primary" selection. Fires selection changed to ISelectionListeners.
Specified by:
deselect in interface EditPartViewer

deselectAll

public void deselectAll()
Description copied from interface: EditPartViewer
deselects all EditParts. Fires selection changed to ISelectionListeners.
Specified by:
deselectAll in interface EditPartViewer

dispose

public void dispose()
Description copied from interface: EditPartViewer
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.
Specified by:
dispose in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPart.deactivate()

expose

protected void expose(EditPart part)

fireSelectionChanged

protected void fireSelectionChanged()

flush

public void flush()
Specified by:
flush in interface EditPartViewer

getContextMenuProvider

protected ContextMenuProvider getContextMenuProvider()

getContents

public EditPart getContents()
Description copied from interface: EditPartViewer
Returns the contents of this EditPartViewer.
Specified by:
getContents in interface EditPartViewer

getControl

public Control getControl()
Description copied from interface: EditPartViewer
Returns the SWT Control for this viewer.
Specified by:
getControl in interface EditPartViewer

getDelegatingDragAdapter

protected DelegatingDragAdapter getDelegatingDragAdapter()

getDelegatingDropAdapter

protected DelegatingDropAdapter getDelegatingDropAdapter()

getDragSource

protected DragSource getDragSource()

getDropTarget

protected DropTarget getDropTarget()

getEditDomain

public EditDomain getEditDomain()
Description copied from interface: EditPartViewer
Returns the EditDomain to which the viewer belongs
Specified by:
getEditDomain in interface EditPartViewer

getEditPartFactory

public EditPartFactory getEditPartFactory()
Specified by:
getEditPartFactory in interface EditPartViewer

getEditPartRegistry

public Map getEditPartRegistry()
Description copied from interface: EditPartViewer
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.
Specified by:
getEditPartRegistry in interface EditPartViewer

getFocusEditPart

public EditPart getFocusEditPart()
Specified by:
getFocusEditPart in interface EditPartViewer

getKeyHandler

public KeyHandler getKeyHandler()
Specified by:
getKeyHandler in interface EditPartViewer

getRootEditPart

public RootEditPart getRootEditPart()
Description copied from interface: EditPartViewer
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.
Specified by:
getRootEditPart in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.setContents(EditPart), EditPartViewer.setRootEditPart(RootEditPart)

getSelectedEditParts

public List getSelectedEditParts()
Description copied from interface: EditPartViewer
Returns a list containing the currently selected editparts.
Specified by:
getSelectedEditParts in interface EditPartViewer

getSelection

public ISelection getSelection()
Specified by:
getSelection in interface ISelectionProvider

getVisualPartMap

public Map getVisualPartMap()
Description copied from interface: EditPartViewer
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.
Specified by:
getVisualPartMap in interface EditPartViewer

hookControl

protected void hookControl()

hookDragSource

protected void hookDragSource()

hookDropTarget

protected void hookDropTarget()

init

protected void init()

menuAboutToShow

public void menuAboutToShow(IMenuManager menu)
Called just before the context menu is shown.
Specified by:
menuAboutToShow in interface IMenuListener

primGetSelectedEditParts

protected List primGetSelectedEditParts()

refreshDragSourceAdapter

protected void refreshDragSourceAdapter()

refreshDropTargetAdapter

protected void refreshDropTargetAdapter()

registerAccessibleEditPart

public void registerAccessibleEditPart(AccessibleEditPart acc)
Specified by:
registerAccessibleEditPart in interface EditPartViewer

removeDragSourceListener

public void removeDragSourceListener(TransferDragSourceListener listener)

removeDropTargetListener

public void removeDropTargetListener(TransferDropTargetListener listener)

removeSelectionChangedListener

public void removeSelectionChangedListener(ISelectionChangedListener l)
Specified by:
removeSelectionChangedListener in interface ISelectionProvider

select

public void select(EditPart editpart)
Description copied from interface: EditPartViewer
Replaces the current selection with the EditPart. Fires selectionChanged event to ISelectionListeners.
Specified by:
select in interface EditPartViewer

setContextMenuProvider

public void setContextMenuProvider(ContextMenuProvider provider)
Description copied from interface: EditPartViewer
sets the ContextMenuProvider that will be used when the user invokes the context menu on the Viewer's control.
Specified by:
setContextMenuProvider in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.getControl()

setContents

public void setContents(EditPart editpart)
Description copied from interface: EditPartViewer
Sets the Contents for this Viewer. The Contents EditPart is installed in the RootEditPart for this Viewer.
Specified by:
setContents in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.getRootEditPart(), EditPartViewer.setRootEditPart(RootEditPart)

setControl

public void setControl(Control control)
Description copied from interface: EditPartViewer
Optionally sets the control that the viewer should use.
Specified by:
setControl in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.createControl(Composite)

setCursor

public void setCursor(Cursor cursor)
Description copied from interface: EditPartViewer
Sets the cursor for the viewer's control.
Specified by:
setCursor in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.getControl()

setDropTarget

public void setDropTarget(DropTarget target)
Sets the dropTarget.
Parameters:
dropTarget - The dropTarget to set

setEditDomain

public void setEditDomain(EditDomain editdomain)
Description copied from interface: EditPartViewer
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.
Specified by:
setEditDomain in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
Parameters:
domain - The EditDomain

setEditPartFactory

public void setEditPartFactory(EditPartFactory factory)
Specified by:
setEditPartFactory in interface EditPartViewer

setFocus

public void setFocus(EditPart part)
Specified by:
setFocus in interface EditPartViewer

setContents

public void setContents(Object contents)
Description copied from interface: EditPartViewer
Creates an EditPart for the specified contents using this viewers Factory.
Specified by:
setContents in interface EditPartViewer
Following copied from interface: org.eclipse.gef.EditPartViewer
See Also:
EditPartViewer.setEditPartFactory(EditPartFactory)

setKeyHandler

public void setKeyHandler(KeyHandler handler)
Specified by:
setKeyHandler in interface EditPartViewer

setRootEditPart

public void setRootEditPart(RootEditPart editpart)
Description copied from interface: EditPartViewer
Sets the root of this viewer. It is uncommon to replace the default root. Instead, applications will typically call setContents(EditPart)
Specified by:
setRootEditPart in interface EditPartViewer

setRouteEventsToEditor

public void setRouteEventsToEditor(boolean value)
Description copied from interface: EditPartViewer
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.
Specified by:
setRouteEventsToEditor in interface EditPartViewer

setSelection

public void setSelection(ISelection newSelection)
This method will clear the current selection, and set the given ISelection as the current selection. It will do so without firing a selection-change event. NOTE: If the given argument is not an IStructuredSelection, this method will do nothing.
Specified by:
setSelection in interface ISelectionProvider

unhookControl

protected void unhookControl()

unregisterAccessibleEditPart

public void unregisterAccessibleEditPart(AccessibleEditPart acc)
Specified by:
unregisterAccessibleEditPart in interface EditPartViewer

GEF v2.0