Rational Developer for Power Systems Software
V7.6

com.ibm.etools.systems.application.visual.editor.srcinfo.editpolicies
Class SourceContainerCompartmentCanonicalEditPolicy

java.lang.Object
  extended by CanonicalConnectionEditPolicy
      extended by com.ibm.etools.systems.application.visual.editor.editpolicies.AggregateCanonicalConnectionEditPolicy
          extended by com.ibm.etools.systems.application.visual.editor.srcinfo.editpolicies.SourceContainerCompartmentCanonicalEditPolicy

public class SourceContainerCompartmentCanonicalEditPolicy
extends AggregateCanonicalConnectionEditPolicy

CanonicalConnectionEditPolicy for SourceContainerCompartment.


Field Summary
static String copyright
           
 
Constructor Summary
SourceContainerCompartmentCanonicalEditPolicy()
          Constructor.
SourceContainerCompartmentCanonicalEditPolicy(boolean readOnly)
          Constructor.
 
Method Summary
protected  boolean applyTo(Object modelElement)
          Return true if given modelElement should be presentated.
 void deactivate()
          Clean up
protected  Collection getConnectionViews()
          Return the list of connections between elements contained within the host.
protected  Collection<Edge> getExistingConnections()
          Get existing edges related with the host, including: a.
protected  ICollapsableEditPart getOwningCollapsableEditPart(EditPart ep)
          Gets the collapsable edipart ancestor for a given editpart.
protected  List getSemanticChildrenList()
           
protected  List getSemanticConnectionsList()
          Return a list of semantic relationships contained inside this compartment.
protected  EObject getSourceElement(EObject relationship)
           
protected  EObject getTargetElement(EObject relationship)
           
 boolean isEnabled()
          Return true if the editpolicy is enabled and its host is visible; otherwise false.
protected  boolean isFirstTimeToExpand()
          Return true if the host is in the first time to be expanded.
 boolean isReadOnly()
          Return true if this edit policy uses read only snapshot from model.
protected  boolean isRelatedConnection(Edge edge, EditPart host, Map editPartRegistry)
          Check if an edge is related with the host.
protected  boolean isRelatedSemanticRelationship(Relationship relation)
          Check if the given Relationship semantic element is related with the host.
protected  void refreshAggregateConnectionAttachments(ConnectionEditPart editPart, boolean isVisible)
          Refresh the visibility of edges attached on aggregate connection.
protected  void refreshAggregateConnections()
          Refresh aggregate connections owned by the host.
protected  void refreshConnections(Collection existingLinks)
          Refresh connections.
protected  void refreshSemantic()
          Refresh semantic children.
protected  boolean registerSemanticElementToViewMappings(View view)
          Register semantic element to view mappings for all semantic children elements from the element of given view.
protected  void setFirstTimeToExpand(boolean firstTime)
          Return true if the host is in the first time to be expanded.
 void setReadOnly(boolean readOnly)
          Setter for read only attribute.
protected  boolean shouldCheckForConnections(View view, Collection viewChildren)
          Determines if a given view should be checked to see if any attached connections should be considered by the canonical synchronization routine.
protected  boolean shouldDeleteView(View view)
          Return true if view can be deleted, false otherwise.
protected  boolean shouldHandleNotificationEvent(Notification event)
          Return true if the canonical edit policy should handle the notification, false otherwise.
protected  boolean shouldShowAggregateConnection(ConnectionEditPart connEP)
          Check if the given editpart should be displayed.
protected  void syncUpConnections(Collection relatedSemanticRelations, Collection existingLinks)
          Sync up the semantic relation list and the connections already displayed in the diagram.
 
Methods inherited from class com.ibm.etools.systems.application.visual.editor.editpolicies.AggregateCanonicalConnectionEditPolicy
computeLinksFromSemanticModel, createAggregatedConnection, createAggregatedConnectionCommand, createConnections, createDirectConnection, findViewForSemanticElement, getAggregatedSemanticElement, getAncestor, getApplicationModel, getCollapsedChecker, getConnectionView, getDiagram, getEditPartFor, getEditPartFor, getExistDirectConnection, getExistingAggregateConnection, getExistingDirectConnection, getHighestCollapsedContainer, getHostSemanticElement, getSemanticElementToViewRegistry, isCollapsedEditPart, isConnectionReady, isInternalRelation, setSemanticElementToViewRegistry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

copyright

public static String copyright
Constructor Detail

SourceContainerCompartmentCanonicalEditPolicy

public SourceContainerCompartmentCanonicalEditPolicy()
Constructor.


SourceContainerCompartmentCanonicalEditPolicy

public SourceContainerCompartmentCanonicalEditPolicy(boolean readOnly)
Constructor.

Parameters:
readOnly: - flag for using read only model.
Method Detail

getSemanticChildrenList

protected List getSemanticChildrenList()

applyTo

protected boolean applyTo(Object modelElement)
Return true if given modelElement should be presentated.

Parameters:
modelElement -

shouldHandleNotificationEvent

protected boolean shouldHandleNotificationEvent(Notification event)
Return true if the canonical edit policy should handle the notification, false otherwise.


refreshSemantic

protected void refreshSemantic()
Refresh semantic children. Also refresh connections.


registerSemanticElementToViewMappings

protected boolean registerSemanticElementToViewMappings(View view)
Register semantic element to view mappings for all semantic children elements from the element of given view.

Overrides:
registerSemanticElementToViewMappings in class AggregateCanonicalConnectionEditPolicy
Parameters:
view - the view whose semantic elements to be mapped.
Returns:
true if the view is successfully registered. False otherwise.

getExistingConnections

protected Collection<Edge> getExistingConnections()
Get existing edges related with the host, including: a. connection totally contained b. connection whose one end is starting from inside of the host's direct children c. connection whose one end is starting from the host itself

Returns:

isRelatedSemanticRelationship

protected boolean isRelatedSemanticRelationship(Relationship relation)
Check if the given Relationship semantic element is related with the host.

Overrides:
isRelatedSemanticRelationship in class AggregateCanonicalConnectionEditPolicy

isRelatedConnection

protected boolean isRelatedConnection(Edge edge,
                                      EditPart host,
                                      Map editPartRegistry)
Check if an edge is related with the host.

Parameters:
edge - the edge to be checked
host - the host for this editpolicy
editPartRegistry - edit part registry
Returns:
true if it is related, false otherwise

refreshAggregateConnections

protected void refreshAggregateConnections()
Refresh aggregate connections owned by the host.


shouldShowAggregateConnection

protected boolean shouldShowAggregateConnection(ConnectionEditPart connEP)
Check if the given editpart should be displayed.

Parameters:
connEP -
Returns:
true if the aggregate connection should be displayed, false otherwise.

getOwningCollapsableEditPart

protected ICollapsableEditPart getOwningCollapsableEditPart(EditPart ep)
Gets the collapsable edipart ancestor for a given editpart.

Overrides:
getOwningCollapsableEditPart in class AggregateCanonicalConnectionEditPolicy
Parameters:
ep - edit part
Returns:
ShapeCompartmentEditPart

refreshAggregateConnectionAttachments

protected void refreshAggregateConnectionAttachments(ConnectionEditPart editPart,
                                                     boolean isVisible)
Refresh the visibility of edges attached on aggregate connection.

Parameters:
isVisible: - true for visible, false for invisible.

getConnectionViews

protected Collection getConnectionViews()
Return the list of connections between elements contained within the host. Override in order to handle SourceContainer.

Returns:
list of Edges.
See Also:
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy#getConnectionViews()

shouldCheckForConnections

protected boolean shouldCheckForConnections(View view,
                                            Collection viewChildren)
Determines if a given view should be checked to see if any attached connections should be considered by the canonical synchronization routine. By default it will consider views that are 2 levels deep from the container in order to allow for connections that are attached to border items on children views in the container.

Parameters:
view - a View to check to see if attached connections should be considered.
viewChildren - a Collection of view children of the host notation view, that can be used as a context to determine if the given view's attached connections should be considered.
Returns:
a boolean true if connections on the view are used as part of the canonical synchronization. false if the view's attached connections are to be ignored.
See Also:
org.eclipse.gmf.runtime.diagram.ui.editpolicies.CanonicalConnectionEditPolicy#shouldCheckForConnections(View, Collection)

isFirstTimeToExpand

protected boolean isFirstTimeToExpand()
Return true if the host is in the first time to be expanded. False otherwise.

Returns:

setFirstTimeToExpand

protected void setFirstTimeToExpand(boolean firstTime)
Return true if the host is in the first time to be expanded. False otherwise.


refreshConnections

protected void refreshConnections(Collection existingLinks)
Refresh connections.


syncUpConnections

protected void syncUpConnections(Collection relatedSemanticRelations,
                                 Collection existingLinks)
Sync up the semantic relation list and the connections already displayed in the diagram. The process includes: a. remove entries from semantic relation list if the corresponding relationship is already displayed in the diagram. b. remove entries from existing connection list if the corresponding semantic element is not in the semantic relation list anymore.

Parameters:
relatedSemanticRelations - relation list computed from ApplicationModel
existingLinks - connections already displayed in the diagram.

shouldDeleteView

protected boolean shouldDeleteView(View view)
Return true if view can be deleted, false otherwise.


isEnabled

public boolean isEnabled()
Return true if the editpolicy is enabled and its host is visible; otherwise false.

Returns:
true

getSemanticConnectionsList

protected List getSemanticConnectionsList()
Return a list of semantic relationships contained inside this compartment.

Overrides:
getSemanticConnectionsList in class AggregateCanonicalConnectionEditPolicy
Returns:
EObject list

isReadOnly

public boolean isReadOnly()
Return true if this edit policy uses read only snapshot from model. False otherwise. Refresh semantic and relationship model elements are expensive. Turn on this if the underline model is read-only to improve performance.


setReadOnly

public void setReadOnly(boolean readOnly)
Setter for read only attribute.


getSourceElement

protected EObject getSourceElement(EObject relationship)
Overrides:
getSourceElement in class AggregateCanonicalConnectionEditPolicy

getTargetElement

protected EObject getTargetElement(EObject relationship)
Overrides:
getTargetElement in class AggregateCanonicalConnectionEditPolicy

deactivate

public void deactivate()
Clean up

Overrides:
deactivate in class AggregateCanonicalConnectionEditPolicy
See Also:
org.eclipse.gef.EditPolicy#deactivate()

Rational Developer for Power Systems Software
V7.6

Copyright 2011 IBM Corp. All Rights Reserved.

Note: This documentation is for part of an interim API that is still under development and expected to change significantly before reaching stability. It is being made available at this early stage to solicit feedback from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken (repeatedly) as the API evolves.