Runtime

org.eclipse.gmf.runtime.diagram.ui.editparts
Class GraphicalEditPart

java.lang.Object
  extended byorg.eclipse.gef.editparts.AbstractEditPart
      extended byorg.eclipse.gef.editparts.AbstractGraphicalEditPart
          extended byorg.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
All Implemented Interfaces:
EditPart, GraphicalEditPart, IAdaptable, IAdaptableSelection, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart, IGraphicalEditPart, NotificationListener, RequestConstants
Direct Known Subclasses:
CompartmentEditPart, DiagramEditPart, TopGraphicEditPart

public abstract class GraphicalEditPart
extends AbstractGraphicalEditPart
implements IGraphicalEditPart, IAdaptableSelection, NotificationListener


Nested Class Summary
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
AbstractGraphicalEditPart.AccessibleGraphicalEditPart, AbstractGraphicalEditPart.DefaultAccessibleAnchorProvider
 
Nested classes inherited from class org.eclipse.gef.editparts.AbstractEditPart
AbstractEditPart.EditPolicyIterator
 
Field Summary
protected  AccessibleEditPart accessibleEP
          Used for accessibility.
protected  java.lang.String elementGuid
          Used for registering and unregistering the edit part
 
Fields inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
figure, sourceConnections, targetConnections
 
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
GraphicalEditPart(EObject model)
          Create an instance.
 
Method Summary
 void activate()
          Registers this editpart to recieve notation and semantic events.
protected  void addChild(EditPart child, int index)
           
protected  void addListenerFilter(java.lang.String filterId, NotificationListener listener, EObject element)
          Adds a listener filter by adding the given listener to a passed notifier
protected  void addListenerFilter(java.lang.String filterId, NotificationListener listener, EObject element, EStructuralFeature feature)
          Adds a listener filter by adding the given listener to a passed notifier
protected  void addNotationalListeners()
          This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy
protected  void addSemanticListeners()
          This method adds all listeners to the semantic element behind this EditPart Override this method to add more semantic listeners down the hierarchy This method is called only if the semantic element is resolvable
protected  java.lang.Object basicGetModel()
          Access the model member variable
protected  ConnectionEditPart createConnection(java.lang.Object connectionView)
          Creates a connection editpart.
protected  void createDefaultEditPolicies()
          Should be overridden to install editpolicies programmatically.
protected  void createEditPolicies()
          Overridden to support editpolicies installed programmatically and via the EditPolicyService.
protected  IFigure createFigure()
           
 void deactivate()
           
 void disableEditMode()
          Disables edit mode of the EditPart.
 void enableEditMode()
          Enables edit mode of the EditPart.
 void eraseSourceFeedback(Request request)
           
 void eraseTargetFeedback(Request request)
           
protected  void executeCommand(Command command)
          executes the passed Command
 EditPart findEditPart(EditPart epBegin, EObject theElement)
          Finds an editpart given a starting editpart and an EObject
protected  AccessibleEditPart getAccessibleEditPart()
           
 java.lang.Object getAdapter(java.lang.Class key)
          Adds the ability to adapt to the edit part's view class.
 IGraphicalEditPart getChildBySemanticHint(java.lang.String semanticHint)
          Method getChildBySemanticHint.
 IGraphicalEditPart getChildBySemanticHintOnPrimaryView(java.lang.String semanticHint)
          Utility method to get the primary view and then query for a child based on the semantic hint
 View getChildViewBySemanticHint(java.lang.String semanticHint)
          Method getChildViewBySemanticHint.
 Command getCommand(Request _request)
          Return a command for the supplied request.
protected  IFigure getContentPaneFor(IGraphicalEditPart editPart)
          gets the content pane for the supplied editpart.
 IDiagramEditDomain getDiagramEditDomain()
          Return the editpart's diagram edit domain.
 PreferencesHint getDiagramPreferencesHint()
          Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values.
protected  Diagram getDiagramView()
          Convenience method returning the editpart's parimary view.
 DragTracker getDragTracker(Request request)
           
protected  EditDomain getEditDomain()
          gets this editpart's edit domain.
 org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
          Derives my editing domain from my model or my diagram element.
protected  org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode()
           
 java.lang.Object getModel()
          Returns tis edit part's model; the returned values is not granteed to be View, the return value could be null or any Object depending on the edit part implementation
protected  java.util.List getModelChildren()
          Return this editpart's view (model) children.
 View getNotationView()
          Return the editpart's associated Notation View.
 java.lang.Object getPreferredValue(EStructuralFeature feature)
          Retrieves the preferred value for the supplied feature.
 EditPart getPrimaryChildEditPart()
          this method will return the primary child EditPart inside this edit part
 View getPrimaryView()
          Convenience method returning the editpart's parimary view.
protected  ResourceManager getResourceManager()
          Gets the resource manager to remember the resources allocated for this graphical viewer.
 RootEditPart getRoot()
           
 java.lang.Object getStructuralFeatureValue(EStructuralFeature feature)
          Convenience method to retreive the value for the supplied value from the editpart's associated view element.
 TopGraphicEditPart getTopGraphicEditPart()
          Walks up the editpart hierarchy to find and return the TopGraphicEditPart instance.
protected  void handleMajorSemanticChange()
          Handles the case where the semantic reference has changed.
protected  void handleNotificationEvent(Notification event)
          Handles the property changed event.
 boolean hasNotationView()
          indicates if this edit part's model is a view or not
 boolean isCanonical()
           
 boolean isEditModeEnabled()
          Returns true if the EditPart is editable.
 boolean isSelectable()
          Return true if the editpart's figure is visible; false otherwise.
 void notifyChanged(Notification notification)
          Will be called when a Notification event gets sent from the DiagramEventBroker after the transaction has been closed.
protected  void performDirectEditRequest(Request request)
          Performs a direct edit request (usually by showing some type of editor)
 void performRequest(Request request)
          Perform a request by executing a command from the target editpart of the request For the Direct_Edit request, we need to show up an editor first
protected  void reactivateSemanticModel()
          Method reactivateSemanticModel.
 void refresh()
          Invoke the editpart's refresh mechanism.
protected  void refreshBackgroundColor()
          Refresh the editpart's figure background colour.
protected  void refreshChild(GraphicalEditPart child)
          Refreshes a child editpart by removing it and refreshing children
protected  void refreshFont()
          Refresh the editpart's figure font.
protected  void refreshFontColor()
          Refresh the editpart's figure font colour.
protected  void refreshForegroundColor()
          Refresh the editpart's figure foreground colour.
protected  void refreshSourceConnection(ConnectionEditPart conn)
          Refreshes a source connection editpart by removing it and refreshing source connections
protected  void refreshTargetConnection(ConnectionEditPart conn)
          Refreshes a target connection editpart by removing it and refreshing target connections
protected  void refreshVisibility()
          Refresh the editpart's figure visibility.
protected  void refreshVisuals()
          Refresh the editpart's figure visual properties.
protected  void registerModel()
          Adds a [ref, editpart] mapping to the EditPartForElement map.
protected  void removeListenerFilter(java.lang.String filterId)
          Removes a listener previously added with the given id
protected  void removeNotationalListeners()
          This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy
 void removeNotify()
           
protected  void removeSemanticListeners()
          This method removes all listeners to the semantic element behind this EditPart Override this method to remove semantic listeners down the hierarchy
 EObject resolveSemanticElement()
          gets the semantic element associated to this editpart.
protected  void setBackgroundColor(Color color)
          sets the back ground color of this edit part
protected  void setFont(FontData fontData)
          Sets the font to the label.
protected  void setFontColor(Color color)
          sets the font color
protected  void setForegroundColor(Color color)
          sets the fore ground color of this edit part's figure
 void setModel(java.lang.Object model)
           
 void setStructuralFeatureValue(EStructuralFeature feature, java.lang.Object value)
          Sets the passed feature if possible on this editpart's view to the passed value.
protected  void setVisibility(boolean vis)
          sets the visibility of this edit part
 void showSourceFeedback(Request request)
           
 void showTargetFeedback(Request request)
           
 Command transactionAboutToCommit(Notification notification)
           
protected  void unregisterModel()
          Remove this editpart from the EditPartForElement map.
 
Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, getContentPane, getFigure, getLayer, getModelSourceConnections, getModelTargetConnections, getSourceConnections, getTargetConnections, primAddSourceConnection, primAddTargetConnection, primRemoveSourceConnection, primRemoveTargetConnection, refreshSourceConnections, refreshTargetConnections, registerVisuals, removeChildVisual, removeNodeListener, removeSourceConnection, removeTargetConnection, reorderChild, reorderSourceConnection, reorderTargetConnection, setFigure, setLayoutConstraint, unregisterVisuals
 
Methods inherited from class org.eclipse.gef.editparts.AbstractEditPart
activateEditPolicies, addEditPartListener, createChild, deactivateEditPolicies, debug, debugFeedback, fireActivated, fireChildAdded, fireDeactivated, fireRemovingChild, fireSelectionChanged, getChildren, getEditPolicy, getEditPolicyIterator, getEventListeners, getFlag, getParent, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, refreshChildren, register, registerAccessibility, removeChild, removeEditPartListener, removeEditPolicy, setFlag, setFocus, setParent, setSelected, toString, understandsRequest, unregister, unregisterAccessibility
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.gef.GraphicalEditPart
addNodeListener, getContentPane, getFigure, getSourceConnections, getTargetConnections, removeNodeListener, setLayoutConstraint
 
Methods inherited from interface org.eclipse.gef.EditPart
addEditPartListener, addNotify, getChildren, getEditPolicy, getParent, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, removeEditPartListener, removeEditPolicy, setFocus, setParent, setSelected, understandsRequest
 

Field Detail

accessibleEP

protected AccessibleEditPart accessibleEP
Used for accessibility.


elementGuid

protected java.lang.String elementGuid
Used for registering and unregistering the edit part

Constructor Detail

GraphicalEditPart

public GraphicalEditPart(EObject model)
Create an instance.

Parameters:
model - the underlying model.
Method Detail

activate

public void activate()
Registers this editpart to recieve notation and semantic events.

Specified by:
activate in interface EditPart

addListenerFilter

protected void addListenerFilter(java.lang.String filterId,
                                 NotificationListener listener,
                                 EObject element)
Adds a listener filter by adding the given listener to a passed notifier

Parameters:
filterId - A unique filter id (within the same editpart instance)
listener - A listener instance
element - An element to add the listener to

addListenerFilter

protected void addListenerFilter(java.lang.String filterId,
                                 NotificationListener listener,
                                 EObject element,
                                 EStructuralFeature feature)
Adds a listener filter by adding the given listener to a passed notifier

Parameters:
filterId - A unique filter id (within the same editpart instance)
listener - A listener instance
element - An element to add the listener to

createConnection

protected final ConnectionEditPart createConnection(java.lang.Object connectionView)
Creates a connection editpart.


createEditPolicies

protected final void createEditPolicies()
Overridden to support editpolicies installed programmatically and via the EditPolicyService. Subclasses should override createDefaultEditPolicies().

See Also:
AbstractEditPart.createEditPolicies()

createDefaultEditPolicies

protected void createDefaultEditPolicies()
Should be overridden to install editpolicies programmatically.

See Also:
AbstractEditPart.createEditPolicies()

deactivate

public void deactivate()
Specified by:
deactivate in interface EditPart

removeNotify

public void removeNotify()
Specified by:
removeNotify in interface EditPart

executeCommand

protected void executeCommand(Command command)
executes the passed Command

Parameters:
command - the command to exectue

basicGetModel

protected final java.lang.Object basicGetModel()
Access the model member variable

Returns:

getAdapter

public java.lang.Object getAdapter(java.lang.Class key)
Adds the ability to adapt to the edit part's view class.

Specified by:
getAdapter in interface IAdaptable

getChildBySemanticHintOnPrimaryView

public IGraphicalEditPart getChildBySemanticHintOnPrimaryView(java.lang.String semanticHint)
Utility method to get the primary view and then query for a child based on the semantic hint

Parameters:
semanticHint - String that is the hint that can retrieved on the getType method of View
Returns:
IGraphicalEditPart that matches with the given semanticHint

getChildBySemanticHint

public IGraphicalEditPart getChildBySemanticHint(java.lang.String semanticHint)
Method getChildBySemanticHint.

Specified by:
getChildBySemanticHint in interface IGraphicalEditPart
Parameters:
semanticHint -
Returns:
IGraphicalEditPart

getChildViewBySemanticHint

public View getChildViewBySemanticHint(java.lang.String semanticHint)
Method getChildViewBySemanticHint.

Parameters:
semanticHint -
Returns:
IGraphicalEditPart

getCommand

public Command getCommand(Request _request)
Return a command for the supplied request.

Specified by:
getCommand in interface EditPart

getContentPaneFor

protected IFigure getContentPaneFor(IGraphicalEditPart editPart)
gets the content pane for the supplied editpart.

Parameters:
editPart - the edit part to use to get the contents pane
Returns:
IFigure

getDiagramView

protected Diagram getDiagramView()
Convenience method returning the editpart's parimary view.

Returns:
the diagram

getPrimaryView

public final View getPrimaryView()
Convenience method returning the editpart's parimary view. Same as calling getView().getPrimaryView()

Specified by:
getPrimaryView in interface IGraphicalEditPart
Returns:
the primary view

getEditDomain

protected EditDomain getEditDomain()
gets this editpart's edit domain.

Returns:
the edit domain

getDiagramEditDomain

public IDiagramEditDomain getDiagramEditDomain()
Return the editpart's diagram edit domain.

Specified by:
getDiagramEditDomain in interface IGraphicalEditPart
Returns:
IDiagramEditDomain

getModelChildren

protected java.util.List getModelChildren()
Return this editpart's view (model) children.

Returns:
list of views.

getStructuralFeatureValue

public java.lang.Object getStructuralFeatureValue(EStructuralFeature feature)
Convenience method to retreive the value for the supplied value from the editpart's associated view element. Same as calling ViewUtil.getStructuralFeatureValue(getNotationView(),feature).

Specified by:
getStructuralFeatureValue in interface IGraphicalEditPart
Returns:
Object the value

resolveSemanticElement

public EObject resolveSemanticElement()
gets the semantic element associated to this editpart.

Specified by:
resolveSemanticElement in interface IGraphicalEditPart
Returns:
the semantic element or null if the semantic element was null or unresolvable

getTopGraphicEditPart

public TopGraphicEditPart getTopGraphicEditPart()
Walks up the editpart hierarchy to find and return the TopGraphicEditPart instance.

Specified by:
getTopGraphicEditPart in interface IGraphicalEditPart
Returns:
TopGraphicEditPart

getNotationView

public View getNotationView()
Return the editpart's associated Notation View.

Specified by:
getNotationView in interface IGraphicalEditPart
Returns:
View, the associated view or null if there is no associated Notation View

reactivateSemanticModel

protected void reactivateSemanticModel()
Method reactivateSemanticModel. This method reactivates the edit part's emantic model by: 1- removing semantic listeners 2- adding semantic listeners if the semantic reference is resolvable 3- Refreshing it This method is called in response to IView's Properties.ID_SEMANTICREF property change event However, it will only work under the following assumptions: 1- The old and new semantic models are compatible in their kind 2- The deltas between old and new semantic models do not affect notation 3- Connections are not refereshed since they are maintained by the diagram


findEditPart

public EditPart findEditPart(EditPart epBegin,
                             EObject theElement)
Finds an editpart given a starting editpart and an EObject

Specified by:
findEditPart in interface IGraphicalEditPart
Parameters:
epBegin - starting edit part
theElement - eObject to use
Returns:
the found edit part if there is any

refresh

public void refresh()
Invoke the editpart's refresh mechanism.

Specified by:
refresh in interface EditPart

refreshBackgroundColor

protected void refreshBackgroundColor()
Refresh the editpart's figure background colour.


refreshFont

protected void refreshFont()
Refresh the editpart's figure font.


refreshFontColor

protected void refreshFontColor()
Refresh the editpart's figure font colour.


refreshForegroundColor

protected void refreshForegroundColor()
Refresh the editpart's figure foreground colour.


refreshVisibility

protected void refreshVisibility()
Refresh the editpart's figure visibility.


refreshVisuals

protected void refreshVisuals()
Refresh the editpart's figure visual properties.


removeListenerFilter

protected void removeListenerFilter(java.lang.String filterId)
Removes a listener previously added with the given id

Parameters:
filterId - the filter ID

setBackgroundColor

protected void setBackgroundColor(Color color)
sets the back ground color of this edit part

Parameters:
color - the new value of the back ground color

setFont

protected void setFont(FontData fontData)
Sets the font to the label. This method could be overriden to change the font data of the font overrides typically look like this: super.setFont( new FontData( fontData.getName(), fontData.getHeight(), fontData.getStyle() <| &> SWT.????));

Parameters:
fontData - the font data

setFontColor

protected void setFontColor(Color color)
sets the font color

Parameters:
color - the new value of the font color

setForegroundColor

protected void setForegroundColor(Color color)
sets the fore ground color of this edit part's figure

Parameters:
color - the new value of the foregroundcolor

setStructuralFeatureValue

public void setStructuralFeatureValue(EStructuralFeature feature,
                                      java.lang.Object value)
Sets the passed feature if possible on this editpart's view to the passed value.

Specified by:
setStructuralFeatureValue in interface IGraphicalEditPart
Parameters:
feature - the feature to use
value - the value of the property being set

setVisibility

protected void setVisibility(boolean vis)
sets the visibility of this edit part

Parameters:
vis - the new value of the visibility

addNotationalListeners

protected void addNotationalListeners()
This method adds all listeners to the notational world (views, figures, editpart...etc) Override this method to add more notational listeners down the hierarchy


addSemanticListeners

protected void addSemanticListeners()
This method adds all listeners to the semantic element behind this EditPart Override this method to add more semantic listeners down the hierarchy This method is called only if the semantic element is resolvable


removeNotationalListeners

protected void removeNotationalListeners()
This method removes all listeners to the notational world (views, figures, editpart...etc) Override this method to remove notational listeners down the hierarchy


removeSemanticListeners

protected void removeSemanticListeners()
This method removes all listeners to the semantic element behind this EditPart Override this method to remove semantic listeners down the hierarchy


performRequest

public void performRequest(Request request)
Perform a request by executing a command from the target editpart of the request For the Direct_Edit request, we need to show up an editor first

Specified by:
performRequest in interface EditPart
See Also:
EditPart.performRequest(org.eclipse.gef.Request)

performDirectEditRequest

protected void performDirectEditRequest(Request request)
Performs a direct edit request (usually by showing some type of editor)

Parameters:
request - the direct edit request

getAccessibleEditPart

protected AccessibleEditPart getAccessibleEditPart()
See Also:
AbstractEditPart.getAccessibleEditPart()

registerModel

protected void registerModel()
Adds a [ref, editpart] mapping to the EditPartForElement map.


unregisterModel

protected void unregisterModel()
Remove this editpart from the EditPartForElement map.


refreshChild

protected final void refreshChild(GraphicalEditPart child)
Refreshes a child editpart by removing it and refreshing children

Parameters:
child - the child to refresh

refreshSourceConnection

protected final void refreshSourceConnection(ConnectionEditPart conn)
Refreshes a source connection editpart by removing it and refreshing source connections

Parameters:
conn - the connection to refresh

refreshTargetConnection

protected final void refreshTargetConnection(ConnectionEditPart conn)
Refreshes a target connection editpart by removing it and refreshing target connections

Parameters:
conn - the connection to refresh

handleMajorSemanticChange

protected final void handleMajorSemanticChange()
Handles the case where the semantic reference has changed.


getDragTracker

public DragTracker getDragTracker(Request request)
Specified by:
getDragTracker in interface EditPart
See Also:
EditPart.getDragTracker(org.eclipse.gef.Request)

isCanonical

public boolean isCanonical()
Returns:
true a canonical editpolicy has been installed on this editpart and it is active; otherwise false.

isSelectable

public boolean isSelectable()
Return true if the editpart's figure is visible; false otherwise.

Specified by:
isSelectable in interface EditPart

disableEditMode

public void disableEditMode()
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart
Disables edit mode of the EditPart. EditParts that are not editable do not provide commands to any requests.

Specified by:
disableEditMode in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart

addChild

protected void addChild(EditPart child,
                        int index)

enableEditMode

public void enableEditMode()
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart
Enables edit mode of the EditPart. EditParts that are editable provide commands to requests.

Specified by:
enableEditMode in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart

isEditModeEnabled

public boolean isEditModeEnabled()
Description copied from interface: org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart
Returns true if the EditPart is editable. Editparts are editable after IEditableEditPart.enableEditMode()is called, and until IEditableEditPart.disableEditMode()is called.

Specified by:
isEditModeEnabled in interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart
Returns:
true when editable

showSourceFeedback

public void showSourceFeedback(Request request)
Specified by:
showSourceFeedback in interface EditPart

showTargetFeedback

public void showTargetFeedback(Request request)
Specified by:
showTargetFeedback in interface EditPart

eraseSourceFeedback

public void eraseSourceFeedback(Request request)
Specified by:
eraseSourceFeedback in interface EditPart

eraseTargetFeedback

public void eraseTargetFeedback(Request request)
Specified by:
eraseTargetFeedback in interface EditPart

getPrimaryChildEditPart

public EditPart getPrimaryChildEditPart()
this method will return the primary child EditPart inside this edit part

Specified by:
getPrimaryChildEditPart in interface IGraphicalEditPart
Returns:
the primary child view inside this edit part

getDiagramPreferencesHint

public PreferencesHint getDiagramPreferencesHint()
Description copied from interface: IGraphicalEditPart
Gets the preferences hint that is to be used to find the appropriate preference store from which to retrieve diagram preference values. The preference hint is mapped to a preference store in the preference registry <@link DiagramPreferencesRegistry>.

Specified by:
getDiagramPreferencesHint in interface IGraphicalEditPart
Returns:
the preferences hint

notifyChanged

public void notifyChanged(Notification notification)
Description copied from interface: NotificationListener
Will be called when a Notification event gets sent from the DiagramEventBroker after the transaction has been closed.

Specified by:
notifyChanged in interface NotificationListener
Parameters:
notification - the notification object

transactionAboutToCommit

public Command transactionAboutToCommit(Notification notification)

handleNotificationEvent

protected void handleNotificationEvent(Notification event)
Handles the property changed event. Clients should override to respond to the specific notification events they are interested. Note: This method may get called on a non-UI thread. Clients should either ensure that their code is thread safe and/or doesn't make unsupported calls (i.e. Display.getCurrent() ) assuming they are on the main thread. Alternatively if this is not possible, then the client can wrap their handler within the Display.synchExec runnable to ensure synchronization and subsequent execution on the main thread.

Parameters:
event - the Notification object that is the property changed event

getMapMode

protected org.eclipse.gmf.runtime.draw2d.ui.mapmode.IMapMode getMapMode()
Returns:
IMapMode that allows for the coordinate mapping from device to logical units.

hasNotationView

public boolean hasNotationView()
indicates if this edit part's model is a view or not

Returns:
true or false

getModel

public java.lang.Object getModel()
Returns tis edit part's model; the returned values is not granteed to be View, the return value could be null or any Object depending on the edit part implementation

Specified by:
getModel in interface EditPart

getEditingDomain

public org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
Derives my editing domain from my model or my diagram element. Subclasses may override.

Specified by:
getEditingDomain in interface IGraphicalEditPart
Returns:
my transactional EMF editing domain

createFigure

protected IFigure createFigure()

setModel

public void setModel(java.lang.Object model)
Specified by:
setModel in interface EditPart

getRoot

public RootEditPart getRoot()
Specified by:
getRoot in interface EditPart

getPreferredValue

public java.lang.Object getPreferredValue(EStructuralFeature feature)
Description copied from interface: IGraphicalEditPart
Retrieves the preferred value for the supplied feature. This value could be the current value set in the preference store. Clients may override this to supply their own preferred values. The type of the return value will vary depending on the feature.

Specified by:
getPreferredValue in interface IGraphicalEditPart
Parameters:
feature - the feature to use
Returns:
Object The preferred value for the supplied feature. The object is of the same type as if the value of the feature were retrieved directly from the view.

getResourceManager

protected ResourceManager getResourceManager()
Gets the resource manager to remember the resources allocated for this graphical viewer. All resources will be disposed when the graphical viewer is closed if they have not already been disposed.

Returns:
the resource manager

Runtime

Guidelines for using Eclipse APIs.

Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.