Package org.eclipse.gef.editparts
Class AbstractTreeEditPart
- java.lang.Object
-
- org.eclipse.gef.editparts.AbstractEditPart
-
- org.eclipse.gef.editparts.AbstractTreeEditPart
-
- All Implemented Interfaces:
IAdaptable
,EditPart
,RequestConstants
,TreeEditPart
public abstract class AbstractTreeEditPart extends AbstractEditPart implements TreeEditPart
Default implementation forTreeEditPart
s used in GEFTreeViewer
s.This is an implementation class, and the documentation here is targeted at subclassing this class. Callers of public API should refer to the interface's documentation.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator
-
-
Field Summary
Fields Modifier and Type Field Description protected Widget
widget
Either a Tree or TreeItem-
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 AbstractTreeEditPart()
Default constructorAbstractTreeEditPart(java.lang.Object model)
Constructs a new EditPart with the specified model.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addChildVisual(EditPart childEditPart, int index)
Implemented to assign the child itswidget
.protected boolean
checkTreeItem()
Convenience method that returnstrue
if the widget is a TreeItem and is safe to use.protected void
createEditPolicies()
Override this method to install the EditPolicies for your EditPart.DragTracker
getDragTracker(Request req)
Returns aDragTracker
for dragging this EditPart.protected Image
getImage()
Override this method to return theImage
for this EditPart'swidget
.protected java.lang.String
getText()
Override this method to return the String to be used in this EditPart'swidget
.Widget
getWidget()
protected void
refreshVisuals()
By default, this method will apply anImage
andString
to the widget if it is aTreeItem
.protected void
removeChildVisual(EditPart childEditPart)
Disposes the child'swidget
and sets it tonull
.protected void
reorderChild(EditPart editpart, int index)
Moves a childEditPart
into a lower index than it currently occupies.void
setWidget(Widget widget)
Sets thewidget
.protected void
setWidgetImage(Image image)
Sets a specifiedImage
into the widget iff it is aTreeItem
.protected void
setWidgetText(java.lang.String text)
Sets a specifiedString
into the widget iff it is aTreeItem
.-
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, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, performRequest, refresh, refreshChildren, register, registerAccessibility, registerModel, registerVisuals, removeChild, removeEditPartListener, removeEditPolicy, removeNotify, 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, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, 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
-
-
-
-
Field Detail
-
widget
protected Widget widget
Either a Tree or TreeItem
-
-
Method Detail
-
addChildVisual
protected void addChildVisual(EditPart childEditPart, int index)
Implemented to assign the child itswidget
. Subclasses should not call or override this method.- Specified by:
addChildVisual
in classAbstractEditPart
- Parameters:
childEditPart
- The EditPart being addedindex
- The child's position- See Also:
AbstractEditPart.addChildVisual(EditPart, int)
-
checkTreeItem
protected final boolean checkTreeItem()
Convenience method that returnstrue
if the widget is a TreeItem and is safe to use.- Returns:
true
if the widget is aTreeItem
and is not disposed
-
createEditPolicies
protected void createEditPolicies()
Override this method to install the EditPolicies for your EditPart.- Specified by:
createEditPolicies
in classAbstractEditPart
- See Also:
AbstractEditPart.createEditPolicies()
-
getDragTracker
public DragTracker getDragTracker(Request req)
Description copied from interface:EditPart
Returns aDragTracker
for dragging this EditPart. TheSelectionTool
is the only Tool by default that calls this method. The SelectionTool will use aSelectionRequest
to provide information such as which mouse button is down, and what modifier keys are pressed.- Specified by:
getDragTracker
in interfaceEditPart
- Parameters:
req
- aRequest
indicating the context of the drag- Returns:
null
or a DragTracker- See Also:
EditPart.getDragTracker(Request)
-
getImage
protected Image getImage()
Override this method to return theImage
for this EditPart'swidget
. This method is called fromrefreshVisuals()
.- Returns:
- the Image to be displayed in the TreeItem
-
getText
protected java.lang.String getText()
Override this method to return the String to be used in this EditPart'swidget
. This method is called fromrefreshVisuals()
.- Returns:
- the String to be displayed by the TreeItem
-
getWidget
public Widget getWidget()
Description copied from interface:TreeEditPart
- Specified by:
getWidget
in interfaceTreeEditPart
- Returns:
- the Widget
- See Also:
TreeEditPart.getWidget()
-
refreshVisuals
protected void refreshVisuals()
By default, this method will apply anImage
andString
to the widget if it is aTreeItem
. Subclasses should overridegetImage()
andgetText()
to provide theImage
andString
used.Subclasses might extend this method if they also want to change the TreeItem's foreground or background color.
- Overrides:
refreshVisuals
in classAbstractEditPart
- See Also:
AbstractEditPart.refreshVisuals()
-
removeChildVisual
protected void removeChildVisual(EditPart childEditPart)
Disposes the child'swidget
and sets it tonull
.- Specified by:
removeChildVisual
in classAbstractEditPart
- Parameters:
childEditPart
- the child EditPart- See Also:
AbstractEditPart.removeChildVisual(EditPart)
-
reorderChild
protected void reorderChild(EditPart editpart, int index)
Description copied from class:AbstractEditPart
Moves a childEditPart
into a lower index than it currently occupies. This method is called fromAbstractEditPart.refreshChildren()
.- Overrides:
reorderChild
in classAbstractEditPart
- Parameters:
editpart
- the child being reorderedindex
- new index for the child- See Also:
AbstractEditPart.reorderChild(EditPart, int)
-
setWidget
public void setWidget(Widget widget)
Sets thewidget
.- Specified by:
setWidget
in interfaceTreeEditPart
- Parameters:
widget
- the Widget- See Also:
TreeEditPart.setWidget(Widget)
-
setWidgetImage
protected final void setWidgetImage(Image image)
Sets a specifiedImage
into the widget iff it is aTreeItem
.- Parameters:
image
- the Image
-
setWidgetText
protected final void setWidgetText(java.lang.String text)
Sets a specifiedString
into the widget iff it is aTreeItem
.- Parameters:
text
- the String
-
-