de.tu_berlin.cs.tfs.muvitorkit.gef.editparts
Class AdapterTreeEditPart<T extends EObject>

java.lang.Object
  extended by org.eclipse.gef.editparts.AbstractEditPart
      extended by org.eclipse.gef.editparts.AbstractTreeEditPart
          extended by de.tu_berlin.cs.tfs.muvitorkit.gef.editparts.AdapterTreeEditPart<T>
All Implemented Interfaces:
IAdaptable, EditPart, RequestConstants, TreeEditPart

public abstract class AdapterTreeEditPart<T extends EObject>
extends AbstractTreeEditPart

This edit part is a convenience implementation with the following frequently used features for EObjects:

Rating red

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.AbstractTreeEditPart
widget
 
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
AdapterTreeEditPart(T model)
          By default, an Adapter will be installed on the model, passing the notifications to notifyChanged(Notification) and to the MuvitorNotifierService.
 
Method Summary
protected  IPropertySource createPropertySource()
          Creates a default EObjectPropertySource showing all model features for this edit part.
 void deactivate()
          Removes this edit part's adapters from the model.
 Object getAdapter(Class key)
          Subclasses may override but must call super implementation!
 T getCastedModel()
          Convenience method that casts the model to the appropriate type.
 DragTracker getDragTracker(Request req)
           
protected  String getText()
          By default, if the model is an ENamedElement, the text of this tree edit part will be its name.
protected  void notifyChanged(Notification notification)
          By default, an Adapter will be registered with this editpart's model that passes notifications to this method, which subclasses are expected to override.
protected  void performDirectEdit()
          Creates and opens a MuvitorTreeDirectEditManager by default, handling direct editing, if this edit part implements IDirectEditPart.
protected  void performOpen()
          Calls MuvitorTreeEditor.showView(getCastedModel) by default.
 void performRequest(Request request)
          Handles the standard GEF requests "direct edit" and "open" on this edit part.
 void registerAdapter(Adapter adapter)
          Convenience method to register a custom Adapter on this editpart's model.
 void registerAdapter(Adapter adapter, EObject model)
          Via this method subclasses can install custom Adapters in AbstractEditPart.activate() listening to changes on a specific EObject.
 void registerAdapter(EObject model)
          Convenience method to let notifyChanged(Notification) receive notifications from additional EObjects.
 void setWidget(Widget widget)
          This forces the top element to be shown as a tree element.
 
Methods inherited from class org.eclipse.gef.editparts.AbstractTreeEditPart
addChildVisual, checkTreeItem, createEditPolicies, getImage, getWidget, refreshVisuals, removeChildVisual, reorderChild, setWidgetImage, setWidgetText
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activate, activateEditPolicies, addChild, addEditPartListener, addNotify, createChild, deactivateEditPolicies, debug, debugFeedback, eraseSourceFeedback, eraseTargetFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getAccessibleEditPart, getChildren, getCommand, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getModel, getModelChildren, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, 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, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, isSelectable, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest
 

Constructor Detail

AdapterTreeEditPart

public AdapterTreeEditPart(T model)
By default, an Adapter will be installed on the model, passing the notifications to notifyChanged(Notification) and to the MuvitorNotifierService.

Parameters:
model - the model of this editpart
Method Detail

setWidget

public final void setWidget(Widget widget)
This forces the top element to be shown as a tree element.

Specified by:
setWidget in interface TreeEditPart
Overrides:
setWidget in class AbstractTreeEditPart
See Also:
AbstractTreeEditPart.setWidget(org.eclipse.swt.widgets.Widget)

registerAdapter

public final void registerAdapter(Adapter adapter,
                                  EObject model)
Via this method subclasses can install custom Adapters in AbstractEditPart.activate() listening to changes on a specific EObject. All registered adapters will be deregistered by default in deactivate().

Parameters:
adapter - an Adapter to register on the model
model - an EObject to observe with the passed adapter

registerAdapter

public final void registerAdapter(Adapter adapter)
Convenience method to register a custom Adapter on this editpart's model.

Parameters:
adapter - an Adapter to register on this editpart's model
See Also:
registerAdapter(Adapter, EObject)

registerAdapter

public final void registerAdapter(EObject model)
Convenience method to let notifyChanged(Notification) receive notifications from additional EObjects. This method registers an Adapter on some EObject that just forwards its notifications.

Parameters:
adapter - an Adapter to register on this editpart's model
See Also:
registerAdapter(Adapter, EObject)

getCastedModel

public final T getCastedModel()
Convenience method that casts the model to the appropriate type.

Returns:
The model of this EditPart appropriately casted.

deactivate

public void deactivate()
Removes this edit part's adapters from the model. Subclasses may override but must call super implementation!

Specified by:
deactivate in interface EditPart
Overrides:
deactivate in class AbstractEditPart
See Also:
AbstractGraphicalEditPart.deactivate()

getText

protected String getText()
By default, if the model is an ENamedElement, the text of this tree edit part will be its name.

Overrides:
getText in class AbstractTreeEditPart

performRequest

public void performRequest(Request request)
Handles the standard GEF requests "direct edit" and "open" on this edit part.

Specified by:
performRequest in interface EditPart
Overrides:
performRequest in class AbstractEditPart
See Also:
performDirectEdit(), performOpen(), AbstractEditPart.performRequest(org.eclipse.gef.Request)

performOpen

protected void performOpen()
Calls MuvitorTreeEditor.showView(getCastedModel) by default. Subclasses may override to perform some other action here.


performDirectEdit

protected void performDirectEdit()
Creates and opens a MuvitorTreeDirectEditManager by default, handling direct editing, if this edit part implements IDirectEditPart. Subclasses may override to perform some other action here.


notifyChanged

protected void notifyChanged(Notification notification)
By default, an Adapter will be registered with this editpart's model that passes notifications to this method, which subclasses are expected to override. This can be extended to receive notifications from other EObjects as well with registerAdapter(EObject).


getAdapter

public Object getAdapter(Class key)
Subclasses may override but must call super implementation!

Specified by:
getAdapter in interface IAdaptable
Overrides:
getAdapter in class AbstractEditPart
See Also:
IAdaptable.getAdapter(java.lang.Class)

createPropertySource

protected IPropertySource createPropertySource()
Creates a default EObjectPropertySource showing all model features for this edit part. Subclasses may override.

Returns:
the property source for this edit part

getDragTracker

public DragTracker getDragTracker(Request req)
Specified by:
getDragTracker in interface EditPart
Overrides:
getDragTracker in class AbstractTreeEditPart