ElementOperations Class
Provides common operations that act upon a collection of model elements.
Inheritance Hierarchy
System.Object
Microsoft.VisualStudio.Modeling.ElementOperations
Microsoft.VisualStudio.Modeling.Diagrams.DesignSurfaceElementOperations
Namespace: Microsoft.VisualStudio.Modeling
Assembly: Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)
Syntax
'Declaration
Public Class ElementOperations
public class ElementOperations
public ref class ElementOperations
type ElementOperations = class end
public class ElementOperations
The ElementOperations type exposes the following members.
Constructors
Name | Description | |
---|---|---|
ElementOperations(IServiceProvider) | Initializes a new instance of the ElementOperations class. | |
ElementOperations(IServiceProvider, Partition) | Initializes a new instance of the ElementOperations class. | |
ElementOperations(IServiceProvider, Store) | Obsolete. Initializes a new instance of the ElementOperations class. |
Top
Properties
Name | Description | |
---|---|---|
Partition | ||
ServiceProvider | ||
Store |
Top
Methods
Name | Description | |
---|---|---|
AddCustomFormat | Adds one or more custom data formats to the specified IDataObject using the specified collection of ModelElements. | |
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. | |
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. | |
CanAddCustomFormat | Returns a value indicating whether the ModelElement collection can be used to create a custom format. | |
CanAddElementGroupFormat | Returns a value indicating whether the ModelElement collection can be used to create an ElementGroupPrototype format. | |
CanCopy(ICollection<ModelElement>) | Gets a value indicating whether the collection of ModelElements can be copied to an IDataObject. | |
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. | |
CanCopyCore | Gets a value indicating whether the collection of ModelElements can be copied to an IDataObject. | |
CanDelete(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. | |
CanDelete(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. | |
CanMerge | 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. | |
CanMove | 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. 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>) | 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>, ClosureType, PointF) | Copies the collection of ModelElements to the specified IDataObject in one or more data formats. | |
CreateElementGroup | Creates a ClosureElementGroup | |
CreateElementGroupPrototype | ||
Equals | Determines whether the specified Object is equal to the current Object. (Inherited from Object.) | |
Finalize | Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection. (Inherited from Object.) | |
GetClipboardDataObject | Returns an IDataObject from the Clipboard if it contains our ElementGroupPrototype format, otherwise null. | |
GetElementGroupPrototype | Gets the ElementGroupPrototype from the DataObject if it exists. | |
GetHashCode | Serves as a hash function for a particular type. (Inherited from Object.) | |
GetModelingToolboxItemDisplayName | If the IDataObject contains a ModelingToolboxItem, this returns its DisplayName, otherwise null. | |
GetType | Gets the Type of the current instance. (Inherited from Object.) | |
IsElementGroupPrototypeFormatAvailable | Returns true if the ElementGroupPrototype clipboard format is available on the clipboard, otherwise false. | |
MarkRootElements | Mark RootElements in the elementGroup parameter. | |
MemberwiseClone | Creates a shallow copy of the current Object. (Inherited from Object.) | |
Merge | Merges (i.e., pastes or drops) the ElementGroupPrototype from the IDataObject to the target ModelElement. | |
MergeElementGroup | Merges the source ElementGroup with the specified target ModelElement. | |
MergeElementGroupPrototype | Merges the source ElementGroupPrototype with the specified target ModelElement. | |
OnElementsReconstituted | 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 | 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 | Called by MergeElementGroupPrototype immediately after the target element has been chosen, but before the elements from the ElementGroupPrototype have been reconstituted. | |
PropagateElementGroupContextToTransaction | Propagates the context present in the element group to the currently active top-level transaction. | |
ToString | Returns a string that represents the current object. (Inherited from Object.) |
Top
Events
Name | Description | |
---|---|---|
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. |
Top
Remarks
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.
Examples
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
}
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.