Package org.eclipse.gef.editparts
Class RootTreeEditPart
- java.lang.Object
-
- org.eclipse.gef.editparts.AbstractEditPart
-
- org.eclipse.gef.editparts.RootTreeEditPart
-
- All Implemented Interfaces:
IAdaptable
,EditPart
,RequestConstants
,RootEditPart
,TreeEditPart
public class RootTreeEditPart extends AbstractEditPart implements RootEditPart, TreeEditPart
The root editpart for aTreeViewer
. There is limited control of a Tree, so this root implementation should work for all purposes. This implementation does little more than hold onto the viewer, and pass theTree
to the contents as its widget.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator
-
-
Field Summary
-
Fields inherited from class org.eclipse.gef.editparts.AbstractEditPart
children, FLAG_ACTIVE, FLAG_FOCUS, MAX_FLAG
-
Fields inherited from interface org.eclipse.gef.EditPart
SELECTED, SELECTED_NONE, SELECTED_PRIMARY
-
Fields inherited from interface org.eclipse.gef.RequestConstants
REQ_ADD, REQ_ALIGN, REQ_ALIGN_CHILDREN, REQ_CLONE, REQ_CONNECTION_END, REQ_CONNECTION_START, REQ_CREATE, REQ_CREATE_BENDPOINT, REQ_DELETE, REQ_DELETE_DEPENDANT, REQ_DIRECT_EDIT, REQ_MOVE, REQ_MOVE_BENDPOINT, REQ_MOVE_CHILDREN, REQ_OPEN, REQ_ORPHAN, REQ_ORPHAN_CHILDREN, REQ_RECONNECT_SOURCE, REQ_RECONNECT_TARGET, REQ_RESIZE, REQ_RESIZE_CHILDREN, REQ_SELECTION, REQ_SELECTION_HOVER
-
-
Constructor Summary
Constructors Constructor Description RootTreeEditPart()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addChildVisual(EditPart childEditPart, int index)
This is where the child gets added.protected void
createEditPolicies()
Creates the initial EditPolicies and/or reserves slots for dynamic ones.Command
getCommand(Request request)
Subclasses should rarely extend this method.EditPart
getContents()
Returns the contents EditPart.DragTracker
getDragTracker(Request request)
This method will never be called on a tree root.RootEditPart
getRoot()
Returnsthis
.EditPartViewer
getViewer()
Convenience method for returning theEditPartViewer
for this part.Widget
getWidget()
The editpart holds onto the SWT Tree, which is also the contents' widget.protected void
refreshChildren()
Overridden to do nothing since the child is explicitly set.protected void
removeChildVisual(EditPart childEditPart)
This is where the child gets removed.void
setContents(EditPart editpart)
Sets the contents EditPart.void
setViewer(EditPartViewer epviewer)
Sets the root's EditPartViewer.void
setWidget(Widget w)
Called byTreeViewer
to set theTree
into the root.-
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activate, activateEditPolicies, addChild, addEditPartListener, addNotify, createChild, deactivate, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getAdapter, getChildren, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getModelChildren, getParent, getSelected, getTargetEditPart, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, refreshVisuals, register, registerAccessibility, registerModel, registerVisuals, removeChild, removeEditPartListener, removeEditPolicy, removeNotify, reorderChild, setFlag, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, toString, understandsRequest, unregister, unregisterAccessibility, unregisterModel, unregisterVisuals
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.gef.EditPart
activate, addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getEditPolicy, getModel, getParent, getSelected, getTargetEditPart, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
-
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
-
-
-
-
Method Detail
-
addChildVisual
protected void addChildVisual(EditPart childEditPart, int index)
This is where the child gets added. No TreeItem is needed here because the contents is actually represented by the Tree iteself.- Specified by:
addChildVisual
in classAbstractEditPart
- Parameters:
childEditPart
- EditPart of child to be added.index
- Position where it is to be added.- See Also:
AbstractEditPart.addChild(EditPart, int)
,AbstractGraphicalEditPart.removeChildVisual(EditPart)
-
createEditPolicies
protected void createEditPolicies()
Description copied from class:AbstractEditPart
Creates the initial EditPolicies and/or reserves slots for dynamic ones. Should be implemented to install the inital EditPolicies based on the model's initial state.null
can be used to reserve a "slot", should there be some desire to guarantee the ordering of EditPolcies.- Specified by:
createEditPolicies
in classAbstractEditPart
- See Also:
AbstractEditPart.createEditPolicies()
-
getCommand
public Command getCommand(Request request)
Description copied from class:AbstractEditPart
Subclasses should rarely extend this method. The default implementation combines the contributions from each installedEditPolicy
. This method is implemented indirectly using EditPolicies.It is recommended that Command creation be handled by EditPolicies, and not directly by the EditPart. - Specified by:
getCommand
in interfaceEditPart
- Overrides:
getCommand
in classAbstractEditPart
- Parameters:
request
- the Request- Returns:
- a Command
- See Also:
EditPart.getCommand(org.eclipse.gef.Request)
-
getContents
public EditPart getContents()
Description copied from interface:RootEditPart
Returns the contents EditPart. A RootEditPart only has a single child, called its contents.- Specified by:
getContents
in interfaceRootEditPart
- Returns:
- the contents.
- See Also:
RootEditPart.getContents()
-
getDragTracker
public DragTracker getDragTracker(Request request)
This method will never be called on a tree root.- Specified by:
getDragTracker
in interfaceEditPart
- Parameters:
request
- aRequest
indicating the context of the drag- Returns:
null
or a DragTracker- See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)
-
getRoot
public RootEditPart getRoot()
Returnsthis
.- Specified by:
getRoot
in interfaceEditPart
- Overrides:
getRoot
in classAbstractEditPart
- Returns:
null
or theRootEditPart
- See Also:
EditPart.getRoot()
-
getViewer
public EditPartViewer getViewer()
Description copied from interface:EditPart
Convenience method for returning theEditPartViewer
for this part.- Specified by:
getViewer
in interfaceEditPart
- Specified by:
getViewer
in interfaceRootEditPart
- Overrides:
getViewer
in classAbstractEditPart
- Returns:
- the
EditPartViewer
ornull
- See Also:
RootEditPart.getViewer()
-
getWidget
public Widget getWidget()
The editpart holds onto the SWT Tree, which is also the contents' widget.- Specified by:
getWidget
in interfaceTreeEditPart
- Returns:
- the Widget
- See Also:
TreeEditPart.getWidget()
-
refreshChildren
protected void refreshChildren()
Overridden to do nothing since the child is explicitly set.- Overrides:
refreshChildren
in classAbstractEditPart
- See Also:
AbstractEditPart.refreshChildren()
-
removeChildVisual
protected void removeChildVisual(EditPart childEditPart)
This is where the child gets removed. This method is overridden here so that the AbstractTreeEditPart does not dispose the widget, which is the Tree in this case. The tree is owned by the viewer, not the child.- Specified by:
removeChildVisual
in classAbstractEditPart
- Parameters:
childEditPart
- EditPart of child to be removed.
-
setContents
public void setContents(EditPart editpart)
Description copied from interface:RootEditPart
Sets the contents EditPart. A RootEditPart only has a single child, called its contents.- Specified by:
setContents
in interfaceRootEditPart
- Parameters:
editpart
- the contents- See Also:
RootEditPart.setContents(org.eclipse.gef.EditPart)
-
setViewer
public void setViewer(EditPartViewer epviewer)
Description copied from interface:RootEditPart
Sets the root's EditPartViewer.- Specified by:
setViewer
in interfaceRootEditPart
- Parameters:
epviewer
- the EditPartViewer- See Also:
RootEditPart.setViewer(org.eclipse.gef.EditPartViewer)
-
setWidget
public void setWidget(Widget w)
Called byTreeViewer
to set theTree
into the root. The root simply holds onto this widget and passes it to the contents when the contents is added.- Specified by:
setWidget
in interfaceTreeEditPart
- Parameters:
w
- the Widget- See Also:
TreeEditPart.setWidget(org.eclipse.swt.widgets.Widget)
-
-