Condividi tramite


ElementOperations Class

Definition

The class used to provide common operations that act upon a collection of ModelElements.

public ref class ElementOperations
public class ElementOperations
type ElementOperations = class
Public Class ElementOperations
Inheritance
ElementOperations
Derived

Remarks

Derive from this class to create custom data formats for copy and paste operations.

Constructors

ElementOperations(IServiceProvider, Partition)

Initializes a new instance of the ElementOperations class.

ElementOperations(IServiceProvider, Store)
Obsolete.

Initializes a new instance of the ElementOperations class.

ElementOperations(IServiceProvider)

Initializes a new instance of the ElementOperations class.

Properties

Partition

The partition that the ModelElements belong to.

ServiceProvider

Gets the IServiceProvider.

Store

Gets the store that the ModelElements belong to.

Methods

AddCustomFormat(IDataObject, ICollection<ModelElement>, ClosureType, PointF)

Adds one or more custom data formats to the specified IDataObject using the specified collection of ModelElements.

AddElementGroupFormat(IDataObject, ICollection<ModelElement>, ClosureType, Boolean)

Adds the ElementGroupPrototype format to the specified IDataObject using the specified collection of ModelElements. Can be called from derived classes to force demand load of element links in order to create the collection of model elements.

AddElementGroupFormat(IDataObject, ICollection<ModelElement>, ClosureType)

Adds the ElementGroupPrototype format to the specified IDataObject using the specified collection of ModelElements. This method calls the following 3 overridable methods(in order) a. CreateElementGroup b. MarkRootElements c. CreateElementGroupPrototype It then stashes the created ElementGroupPrototype in the data parameter.

CanAddCustomFormat(ICollection<ModelElement>, ClosureType)

Returns a value indicating whether the ModelElement collection can be used to create a custom format.

CanAddElementGroupFormat(ICollection<ModelElement>, ClosureType)

Returns a value indicating whether the ModelElement collection can be used to create an ElementGroupPrototype format.

CanCopy(ICollection<ModelElement>, ClosureType)

Gets a value indicating whether the collection of ModelElements can be copied to an IDataObject. Calls CanCopyCore to do the work.

CanCopy(ICollection<ModelElement>)

Gets a value indicating whether the collection of ModelElements can be copied to an IDataObject.

CanCopyCore(ICollection<ModelElement>, ClosureType)

Gets a value indicating whether the collection of ModelElements can be copied to an IDataObject. This is implemented outside of CanCopy, so that subclasses can override the public CanCopy and CanMove methods independently. If subclasses want to have the same behavior for both CanCopy and CanMove, they can just override this method. (Before this method existed, overriding only CanCopy led to the side effect of changing the CanMove behavior.)

CanDelete(IEnumerable<ModelElement>, Guid[])

Query whether a specified set of elements can be deleted, taking into account any IMS locks applicable to any of the elements in the complete delete closure of the elements. The elements cannot be deleted if any element in the closure is Delete locked, or if any element is the target of a link sourced on an element with the RolePlayer lock AND that element is outside the closure.

CanDelete(ModelElement, Guid[])

Query whether a specified element can be deleted, taking into account any IMS locks applicable to any of the elements in the delete closure of the element. An element cannot be deleted if any element in the closure is Delete locked, or if any element is the target of a link sourced on an element with the RolePlayer lock AND that element is outside the closure.

CanMerge(ModelElement, IDataObject)

Returns a value indicating whether the ElementGroupPrototype from the IDataObject can be merged (i.e., pasted or dropped) into the target ModelElement.

CanMergeElementGroupPrototype(ModelElement, ElementGroupPrototype)

Returns a value indicating whether MergeElementGroupPrototype can be performed.

CanMergeElementGroupPrototype(ModelElement, ProtoElementBase, ElementGroupPrototype)

Gets a value indicating whether MergeElementGroupPrototype can be performed given the particular hoist and element group prototype. The CanMergeElementGroupPrototype process calls this overload for each root ProtoElement in the ElementGroupPrototype to determine if either the target
element or the target's associated model element (if applicable) can serve as the target of the element represented by the ProtoElement.

CanMove(ICollection<ModelElement>)

Gets a value indicating whether the collection of ModelElements can be moved.

ChooseMergeTarget(ModelElement, ElementGroup)

Gets the target element for the merge, given the proposed targetElement. This gives the ElementOperations the chance to change the intended target for the merge. By default, this method will give the target element the chance to change the intended target.

ChooseMergeTarget(ModelElement, ElementGroupPrototype)

Gets the target element for the merge, given the proposed targetElement. This gives the ElementOperations the chance to change the intended target for the merge. By default, this method will give the target element the chance to change the intended target.

Copy(IDataObject, ICollection<ModelElement>, ClosureType, PointF)

Copies the collection of ModelElements to the specified IDataObject in one or more data formats.

Copy(IDataObject, ICollection<ModelElement>, ClosureType)

Copies the collection of ModelElements to the specified IDataObject in one or more data formats.

Copy(IDataObject, ICollection<ModelElement>, PointF)

Copies the collection of ModelElements to the specified IDataObject in one or more data formats.

Copy(IDataObject, ICollection<ModelElement>)

Copies the collection of ModelElements to the specified IDataObject in one or more data formats.

CreateElementGroup(ICollection<ModelElement>, ClosureType)

Creates a ClosureElementGroup

CreateElementGroupPrototype(ElementGroup, ICollection<ModelElement>, ClosureType)
GetClipboardDataObject()

Returns an IDataObject from the Clipboard if it contains our ElementGroupPrototype format, otherwise null.

GetElementGroupPrototype(IServiceProvider, IDataObject)

Gets the ElementGroupPrototype from the DataObject if it exists.

GetModelingToolboxItemDisplayName(IServiceProvider, IDataObject)

If the IDataObject contains a ModelingToolboxItem, this returns its DisplayName, otherwise null.

IsElementGroupPrototypeFormatAvailable()

Returns true if the ElementGroupPrototype clipboard format is available on the clipboard, otherwise false.

MarkRootElements(ElementGroup, ICollection<ModelElement>, ClosureType)

Mark RootElements in the elementGroup parameter This default implementation does not take the elements and closureType parameters into account. All groupElements in the elementGroup object, that are not the target of any group-contained, embedding relationship are marked as root.

Merge(ModelElement, IDataObject)

Merges (i.e., pastes or drops) the ElementGroupPrototype from the IDataObject to the target ModelElement.

MergeElementGroup(ModelElement, ElementGroup)

Merges the source ElementGroup with the specified target ModelElement. This method is intended for use when an ElementGroupPrototype is not available, that is, when a collection of actual ModelElements should be merged. If an ElementGroupPrototype is available (e.g., clipboard scenarios), call MergeElementGroupProtoype instead. This method performs the following: (1) calls the target element's MergeRelate virtual method for each root element in the group to provide the target with the opportunity to connect a root element to itself, (2) calls the virtual method MergeConfigure on the root element immediately after calling MergeRelate to provide the root element with an opportunity to configure itself, and (3) calls OnMerged to provide any ElementOperations-derived class the opportunity to plug in custom processing.

MergeElementGroupPrototype(ModelElement, ElementGroupPrototype)

Merges the source ElementGroupPrototype with the specified target ModelElement. This method performs the following: (1) reconstitutes the elements from the ElementGroupPrototype, (2) calls OnElementsReconstituted to provide any ElementOperations-derived class the opportunity to plug in custom processing, (3) calls the target element's MergeRelate virtual method for each reconstituted root element to provide the target with the opportunity to connect a root element to itself, (4) calls the virtual method MergeConfigure on the reconstituted root element immediately after calling MergeRelate to provide the root element with an opportunity to configure itself, and (5) calls OnMerged to provide any ElementOperations-derived class the opportunity to plug in custom processing.

OnElementsReconstituted(MergeElementGroupEventArgs)

Called by MergeElementGroupPrototype immediately after the elements from the ElementGroupPrototype have been reconstituted, but before they are connected to the rest of the model.

OnMerged(MergeElementGroupEventArgs)

Called by MergeElementGroupPrototype immediately before the local transaction is committed. The rules are queued during the local transaction and fired when the transaction commits. The local transaction wraps reconstituting and connecting elements.

OnMerging(MergeElementGroupEventArgs)

Called by MergeElementGroupPrototype immediately after the target element has been chosen, but before the elements from the ElementGroupPrototype have been reconstituted.

PropagateElementGroupContextToTransaction(ModelElement, ElementGroup, Transaction)

Propagates the context present in the element group to the currently active top-level transaction.

Events

ElementsReconstituted

Called by MergeElementGroupPrototype immediately after the elements from the ElementGroupPrototype have been reconstituted, but before they are connected to the rest of the model.

Merged

Called by MergeElementGroupPrototype immediately before the local transaction is committed. The rules are queued during the local transaction and fired when the transaction commits. The local transaction wraps reconstituting and connecting elements.

Merging

Called by MergeElementGroupPrototype immediately after the target element has been chosen, but before the elements from the ElementGroupPrototype have been reconstituted.

Applies to