org.eclipse.gmf.runtime.diagram.ui.editparts
Class SemanticListCompartmentEditPart
java.lang.Object
org.eclipse.gef.editparts.AbstractEditPart
org.eclipse.gef.editparts.AbstractGraphicalEditPart
org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart
org.eclipse.gmf.runtime.diagram.ui.editparts.CompartmentEditPart
org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart
org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart
org.eclipse.gmf.runtime.diagram.ui.editparts.SemanticListCompartmentEditPart
- All Implemented Interfaces:
- EditPart, GraphicalEditPart, IAdaptable, IAdaptableSelection, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IContainedEditPart, org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart, IGraphicalEditPart, IResizableCompartmentEditPart, NotificationListener, RequestConstants
- public abstract class SemanticListCompartmentEditPart
- extends ListCompartmentEditPart
A List compartment Edit part that contains semantic edit parts. A semantic
edit part is an edit part that controls a semantic element, it does not
control a Notation View.
This list compartment is canonical by default, to turn off the canonical
support just override the isCanonicalEnabled and return false
To convert your List compartment Edit Part to a semantic List compartment, make the Edit Part
extends SemanticListCompartmentEditPart then implement the abstrtact methods:
semanticChildAdded(EObject child,int index)
Which will be called when a semantic child is added
And, getSemanticChildrenList()
Which returns a list of all semantic children inside this editpart's model
Then on the EditPart's you add to this list make sure thathasNotationView
returns false
| 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 |
| Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.ListCompartmentEditPart |
addSemanticChildrenListeners, addSemanticListeners, createDefaultEditPolicies, createFigure, getBaseModelChildren, getChildrenFilteredBy, getComparator, getCompartmentName, getModelChildByID, getModelChildren, hasModelChildrenChanged, isAffectingSortingFiltering, modeAutomatic, removeSemanticChildrenListeners, removeSemanticListeners |
| Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.ResizableCompartmentEditPart |
addNotationalListeners, getAdapter, getCompartmentFigure, getContentPane, isSelectable, refreshCollapsed, refreshRatio, refreshShowCompartmentTitle, refreshVisuals, removeNotationalListeners, setCollapsed, setFont, setFontColor, setRatio, setShowCompartmentTitle |
| Methods inherited from class org.eclipse.gmf.runtime.diagram.ui.editparts.GraphicalEditPart |
addChild, addListenerFilter, addListenerFilter, basicGetModel, createConnection, createEditPolicies, deactivate, disableEditMode, enableEditMode, eraseSourceFeedback, eraseTargetFeedback, executeCommand, findEditPart, getAccessibleEditPart, getChildBySemanticHint, getChildBySemanticHintOnPrimaryView, getChildViewBySemanticHint, getCommand, getContentPaneFor, getDiagramEditDomain, getDiagramPreferencesHint, getDiagramView, getEditDomain, getEditingDomain, getMapMode, getModel, getNotationView, getPreferredValue, getPrimaryChildEditPart, getPrimaryView, getResourceManager, getRoot, getStructuralFeatureValue, getTopGraphicEditPart, handleMajorSemanticChange, hasNotationView, isEditModeEnabled, notifyChanged, performDirectEditRequest, performRequest, reactivateSemanticModel, refresh, refreshBackgroundColor, refreshChild, refreshFont, refreshFontColor, refreshForegroundColor, refreshSourceConnection, refreshTargetConnection, refreshVisibility, registerModel, removeListenerFilter, removeNotify, resolveSemanticElement, setBackgroundColor, setForegroundColor, setModel, setStructuralFeatureValue, setVisibility, showSourceFeedback, showTargetFeedback, transactionAboutToCommit, unregisterModel |
| Methods inherited from class org.eclipse.gef.editparts.AbstractGraphicalEditPart |
addChildVisual, addNodeListener, addNotify, addSourceConnection, addTargetConnection, createOrFindConnection, fireRemovingSourceConnection, fireRemovingTargetConnection, fireSourceConnectionAdded, fireTargetConnectionAdded, 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, 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.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart |
findEditPart, getChildBySemanticHint, getDiagramEditDomain, getDiagramPreferencesHint, getEditingDomain, getNotationView, getPreferredValue, getPrimaryChildEditPart, getPrimaryView, getStructuralFeatureValue, getTopGraphicEditPart, resolveSemanticElement, setStructuralFeatureValue |
| Methods inherited from interface org.eclipse.gef.EditPart |
addEditPartListener, addNotify, deactivate, eraseSourceFeedback, eraseTargetFeedback, getChildren, getCommand, getDragTracker, getEditPolicy, getModel, getParent, getRoot, getSelected, getTargetEditPart, getViewer, hasFocus, installEditPolicy, isActive, performRequest, refresh, removeEditPartListener, removeEditPolicy, removeNotify, setFocus, setModel, setParent, setSelected, showSourceFeedback, showTargetFeedback, understandsRequest |
| Methods inherited from interface org.eclipse.gmf.runtime.diagram.ui.internal.editparts.IEditableEditPart |
disableEditMode, enableEditMode, isEditModeEnabled |
SemanticListCompartmentEditPart
public SemanticListCompartmentEditPart(EObject model)
- constructor
- Parameters:
model - the mdoel controlled by this edit part
refreshChildren
protected void refreshChildren()
semanticChildRemoved
protected void semanticChildRemoved(EObject child)
- Parameters:
child -
refreshSemanticChildren
protected void refreshSemanticChildren()
- Updates the set of children views so that it
is in sync with the semantic children. This method is called
in response to notification from the model.
The update is performed by comparing the exising views with the set of
semantic children returned from #getViewChildren(). Views whose
semantic element no longer exists are removed.
New semantic children have their View created. Subclasses must override getSemanticChildren().
Unlike AbstractEditPart#refreshChildren(), this refresh will not
reorder the view list to ensure both it and the semantic children are
in the same order since it is possible that this edit policy will handle
a specifc subset of the host's views.
The host is refreshed if a view has created or deleted as a result of this
refresh.
activate
public void activate()
- Description copied from class:
GraphicalEditPart
- Registers this editpart to recieve notation and semantic events.
- Specified by:
activate in interface EditPart- Overrides:
activate in class GraphicalEditPart
semanticChildAdded
protected abstract void semanticChildAdded(EObject child,
int index)
- This method will be called when a child is added to the
EditPart's model id Canonical is enabled
- Parameters:
child - the child being added, the index where its edit part should be createdindex -
getSemanticChildrenList
protected abstract java.util.List getSemanticChildrenList()
- Returns a list of all semantic children inside this editpart's model
- Returns:
handleNotificationEvent
protected void handleNotificationEvent(Notification event)
- Description copied from class:
ResizableCompartmentEditPart
- Handles the following properties:
semanticChildrenListChanged
protected void semanticChildrenListChanged(Notification event)
- called by the
handlePropertyChangeEvent when the semantic children list
is changed, then this method will check if the change was add or delete of an element
and calls either semanticChildAdded or semanticChildDeleted
this could be used to implement a canonical list without a canonical edit policy
isCanonicalEnabled
protected boolean isCanonicalEnabled()
- indicated if canonical is enabled or not Canonical is disabled if the
edit part's view is collapsed or hidden
- Returns:
isCanonicalOn
public boolean isCanonicalOn()
- indicated if canonical is enabled or not Canonical is disabled if the
edit part's view is collapsed or hidden
- Returns:
getSortedChildren
protected java.util.List getSortedChildren()
- Description copied from class:
ListCompartmentEditPart
- Returns a
List of model children corresponding appearance order of the list
compartment items.
- Overrides:
getSortedChildren in class ListCompartmentEditPart
- Returns:
- a
List of Ids
getChildrenSortedBy
protected java.util.List getChildrenSortedBy(java.util.Map sortingKeys)
- Returns the model children sorted by the order specified by Properties.ID_SORTING_KEYS.
This is used to support dynamic list compartment sorting.
- Overrides:
getChildrenSortedBy in class ListCompartmentEditPart
- Parameters:
sortingKeys -
- Returns:
- the model children sorted
getFilteredChildren
protected java.util.List getFilteredChildren()
- Description copied from class:
ListCompartmentEditPart
- Returns a
List of View s corresponding
to the unique id of the semantic elements which are filtered.
- Overrides:
getFilteredChildren in class ListCompartmentEditPart
- Returns:
- list of filtered model children
isCanonical
public boolean isCanonical()
- Overrides:
isCanonical in class GraphicalEditPart
- Returns:
- true a canonical editpolicy has been installed on this editpart
and it is active; otherwise false.
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp., Borland Software Corp., and others 2005,2006. All rights reserved.