ElementOperations Class

 

Provides common operations that act upon a collection of model elements.

Namespace:   Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)


public ref class ElementOperations 

NameDescription
System_CAPS_protmethodElementOperations(IServiceProvider^)

Initializes a new instance of the ElementOperations class.

System_CAPS_pubmethodElementOperations(IServiceProvider^, Partition^)

Initializes a new instance of the ElementOperations class.

System_CAPS_pubmethodElementOperations(IServiceProvider^, Store^)

Obsolete.Initializes a new instance of the ElementOperations class.

NameDescription
System_CAPS_protmethodAddCustomFormat(IDataObject^, ICollection<ModelElement^>^, ClosureType, PointF)

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

System_CAPS_protmethodAddElementGroupFormat(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.

System_CAPS_protmethodAddElementGroupFormat(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.

System_CAPS_protmethodCanAddCustomFormat(ICollection<ModelElement^>^, ClosureType)

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

System_CAPS_protmethodCanAddElementGroupFormat(ICollection<ModelElement^>^, ClosureType)

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

System_CAPS_pubmethodCanCopy(ICollection<ModelElement^>^)

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

System_CAPS_pubmethodCanCopy(ICollection<ModelElement^>^, ClosureType)

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

System_CAPS_protmethodCanCopyCore(ICollection<ModelElement^>^, ClosureType)

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

System_CAPS_pubmethodCanDelete(IEnumerable<ModelElement^>^, array<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.

System_CAPS_pubmethodCanDelete(ModelElement^, array<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.

System_CAPS_pubmethodCanMerge(ModelElement^, IDataObject^)

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

System_CAPS_pubmethodCanMergeElementGroupPrototype(ModelElement^, ElementGroupPrototype^)

Returns a value indicating whether MergeElementGroupPrototype can be performed.

System_CAPS_protmethodCanMergeElementGroupPrototype(ModelElement^, ProtoElementBase^, ElementGroupPrototype^)

Gets a value indicating whether MergeElementGroupPrototype can be performed given the particular hoist and element group prototype.

System_CAPS_pubmethodCanMove(ICollection<ModelElement^>^)

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

System_CAPS_pubmethodChooseMergeTarget(ModelElement^, ElementGroup^)

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

System_CAPS_pubmethodChooseMergeTarget(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.

System_CAPS_pubmethodCopy(IDataObject^, ICollection<ModelElement^>^)

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

System_CAPS_pubmethodCopy(IDataObject^, ICollection<ModelElement^>^, ClosureType)

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

System_CAPS_pubmethodCopy(IDataObject^, ICollection<ModelElement^>^, ClosureType, PointF)

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

System_CAPS_pubmethodCopy(IDataObject^, ICollection<ModelElement^>^, PointF)

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

System_CAPS_protmethodCreateElementGroup(ICollection<ModelElement^>^, ClosureType)

Creates a ClosureElementGroup

System_CAPS_protmethodCreateElementGroupPrototype(ElementGroup^, ICollection<ModelElement^>^, ClosureType)

System_CAPS_pubmethodEquals(Object^)

(Inherited from Object.)

System_CAPS_protmethodFinalize()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticGetClipboardDataObject()

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

System_CAPS_pubmethodSystem_CAPS_staticGetElementGroupPrototype(IServiceProvider^, IDataObject^)

Gets the ElementGroupPrototype from the DataObject if it exists.

System_CAPS_pubmethodGetHashCode()

(Inherited from Object.)

System_CAPS_protmethodSystem_CAPS_staticGetModelingToolboxItemDisplayName(IServiceProvider^, IDataObject^)

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

System_CAPS_pubmethodGetType()

(Inherited from Object.)

System_CAPS_pubmethodSystem_CAPS_staticIsElementGroupPrototypeFormatAvailable()

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

System_CAPS_protmethodMarkRootElements(ElementGroup^, ICollection<ModelElement^>^, ClosureType)

Mark RootElements in the elementGroup parameter.

System_CAPS_protmethodMemberwiseClone()

(Inherited from Object.)

System_CAPS_pubmethodMerge(ModelElement^, IDataObject^)

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

System_CAPS_pubmethodMergeElementGroup(ModelElement^, ElementGroup^)

Merges the source ElementGroup with the specified target ModelElement.

System_CAPS_pubmethodMergeElementGroupPrototype(ModelElement^, ElementGroupPrototype^)

Merges the source ElementGroupPrototype with the specified target ModelElement.

System_CAPS_protmethodOnElementsReconstituted(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.

System_CAPS_protmethodOnMerged(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.

System_CAPS_protmethodOnMerging(MergeElementGroupEventArgs^)

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

System_CAPS_protmethodPropagateElementGroupContextToTransaction(ModelElement^, ElementGroup^, Transaction^)

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

System_CAPS_pubmethodToString()

(Inherited from Object.)

NameDescription
System_CAPS_pubeventElementsReconstituted

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

System_CAPS_pubeventMerged

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.

System_CAPS_pubeventMerging

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

Derive from this class to create custom data formats for copy and paste operations. In your diagram class, override ElementOperations to return an instance of your ElementOperations subclass. You should return the same instance at every call.

For more information, see How to: Program Copy and Paste Behavior - redirect.


using Microsoft.VisualStudio.Modeling;
using Microsoft.VisualStudio.Modeling.Diagrams;
using Microsoft.VisualStudio.Modeling.Diagrams.ExtensionEnablement;

  public partial class MyDslDiagram
  {
    public override DesignSurfaceElementOperations ElementOperations
    {
      get
      {
        if (this.elementOperations == null)
        {
          this.elementOperations = new MyElementOperations(this.Store as IServiceProvider, this);
        }
        return this.elementOperations;
      }
    }
    private MyElementOperations elementOperations = null;
  }

  public class MyElementOperations : DesignSurfaceElementOperations
  {
    public MyElementOperations(IServiceProvider serviceProvider, MyDslDiagram diagram)
      : base(serviceProvider, diagram)
    { }
    // Overridden methods follow
  }

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Return to top
Show: