private bool PasteShapes()
        {
            // Get prototypes from clipboard, if they exist
            IDataObject           dataObject            = Clipboard.GetDataObject();
            ElementGroupPrototype elementGroupPrototype = ElementOperations.GetElementGroupPrototype(ServiceProvider, dataObject);

            // if we're not pasting on the diagram (i.e., the ModelRoot), we're pasting the prototype
            if (TargetElement is ModelRoot &&
                CurrentModelingDocView is EFModelDocView efModelDocView &&
                efModelDocView.Diagram is EFModelDiagram currentDiagram &&
                currentDiagram?.Store != null &&
                elementGroupPrototype != null)
            {
                Store store = efModelDocView.Diagram.Store;

                // get matching elements from the store
                List <ModelElement> modelElements = elementGroupPrototype.ProtoElements
                                                    .Select(p => store.ElementDirectory.FindElement(p.ElementId))
                                                    .Where(e => e != null)
                                                    .ToList();

                if (modelElements.Any())
                {
                    List <ModelClass>   modelClasses   = modelElements.OfType <ModelClass>().ToList();
                    List <Comment>      comments       = modelElements.OfType <Comment>().ToList();
                    List <ModelElement> everythingElse = modelElements.Except(modelClasses).Except(comments).ToList();
                    List <ShapeElement> newShapes      = new List <ShapeElement>();

                    using (Transaction t = store.TransactionManager.BeginTransaction())
                    {
                        // paste classes and comments first to ensure that any possible connector end is present before the connectors arrive
                        newShapes.AddRange(modelClasses.Select(e => EFModelDiagram.AddExistingModelElement(currentDiagram, e)));
                        newShapes.AddRange(comments.Select(e => EFModelDiagram.AddExistingModelElement(currentDiagram, e)));
                        newShapes.AddRange(everythingElse.Select(e => EFModelDiagram.AddExistingModelElement(currentDiagram, e)));
                        newShapes = newShapes.Where(s => s != null).ToList();

                        // if nothing got pasted (because it's already there), we succeeded in our paste but didn't really change
                        // the display, so nothing further needs done
                        if (!newShapes.Any())
                        {
                            return(true);
                        }

                        t.Commit();
                    }

                    using (Transaction t = store.TransactionManager.BeginTransaction())
                    {
                        Commands.LayoutDiagram(currentDiagram, newShapes);
                        t.Commit();
                    }

                    currentDiagram.Invalidate();

                    return(true);
                }
            }

            return(false);
        }
        /// <summary>
        /// Returns a value indicating whether the source element represented by the
        /// specified root ProtoElement can be added to this element.
        /// </summary>
        /// <param name="rootElement">The root ProtoElement representing a source element.  This can be null,
        /// in which case the ElementGroupPrototype does not contain an ProtoElements
        /// and the code should inspect the ElementGroupPrototype context information.</param>
        /// <param name="elementGroupPrototype">The ElementGroupPrototype that contains the root ProtoElement.</param>
        /// <returns>
        /// True if the source element represented by the ProtoElement can be added to this target element.
        /// </returns>
        protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            Guard.NotNull(() => rootElement, rootElement);
            Guard.NotNull(() => elementGroupPrototype, elementGroupPrototype);

            return false;
        }
Exemple #3
0
        private ModelingToolboxItem CreateToolboxItem(Store store, GadgeteerPart moduleDefinition, string description,
                                                      string tabName, ElementGroupPrototype prototype, string itemId)
        {
            //Add a filter attribute for each of the .NETMF versions supported by this module. The DocData adds a corresponding
            //filter depending on the version of the project
            var filters = moduleDefinition.SupportedMicroframeworkVersions.Select(v => new ToolboxItemFilterAttribute(GadgeteerDSLToolboxHelperBase.ToolboxFilterString + v,
                                                                                                                      ToolboxItemFilterType.Require)).ToArray();

            var result = new ModelingToolboxItem(
                itemId,                                                // Unique identifier (non-localized) for the toolbox item.
                2,                                                     // Position relative to other items in the same toolbox tab.
                moduleDefinition.Name,
                moduleToolboxIcon,                                     // Image displayed next to the toolbox item.
                "Microsoft.Gadgeteer.Designer.GadgeteerDSLToolboxTab", // Unique identifier (non-localized) for the toolbox item tab.
                tabName,                                               // Localized display name for the toolbox tab.
                moduleDefinition.Name,                                 // F1 help keyword for the toolbox item.
                description,                                           // Localized tooltip text for the toolbox item.
                prototype,
                filters
                );

            //Imporant to make this transient. Otherwise the toolbox items remain even if modules are uninstalled
            result.IsTransient = true;

            return(result);
        }
        private static T CreateChildElement <T>(ModelElement parent, bool raiseInstantiateEvents) where T : ModelElement
        {
            var childClass = parent.Partition.DomainDataDirectory.DomainClasses
                             .FirstOrDefault(dci => typeof(T).IsAssignableFrom(dci.ImplementationClass) && !dci.ImplementationClass.IsAbstract);
            var elementOperations = new ElementOperations(parent.Store, parent.Partition);

            if (elementOperations != null)
            {
                var elementGroupPrototype = new ElementGroupPrototype(parent.Partition, childClass.Id);

                var partition    = elementOperations.ChooseMergeTarget(parent, elementGroupPrototype).Partition;
                var element      = (T)partition.ElementFactory.CreateElement(childClass);
                var elementGroup = new ElementGroup(partition);
                elementGroup.Add(element);
                elementGroup.MarkAsRoot(element);
                elementOperations.MergeElementGroup(parent, elementGroup);

                // Flag the element in the state so that the ProductStore class sees it and doesn't
                // raise the instantiation event.
                if (!raiseInstantiateEvents)
                {
                    element.Store.PropertyBag.Add(element, null);
                }

                return(element);
            }

            return(default(T));
        }
Exemple #5
0
        /// <summary>
        /// Returns a value indicating whether the source element represented by the
        /// specified root ProtoElement can be added to this element.
        /// </summary>
        /// <param name="rootElement">The root ProtoElement representing a source element.  This can be null,
        /// in which case the ElementGroupPrototype does not contain an ProtoElements
        /// and the code should inspect the ElementGroupPrototype context information.</param>
        /// <param name="elementGroupPrototype">The ElementGroupPrototype that contains the root ProtoElement.</param>
        /// <returns>
        /// True if the source element represented by the ProtoElement can be added to this target element.
        /// </returns>
        protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            Guard.NotNull(() => rootElement, rootElement);
            Guard.NotNull(() => elementGroupPrototype, elementGroupPrototype);

            return(false);
        }
Exemple #6
0
 /// <summary>
 /// Determines whether this instance [can merge interface layer] the specified root element.
 /// </summary>
 /// <param name="rootElement">The root element.</param>
 /// <param name="elementGroupPrototype">The element group prototype.</param>
 /// <returns>
 ///     <c>true</c> if this instance [can merge interface layer] the specified root element; otherwise, <c>false</c>.
 /// </returns>
 private bool CanMergeInterfaceLayer(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
 {
     if (elementGroupPrototype == null)
     {
         throw new ArgumentNullException("elementGroupPrototype");
     }
     return(InterfaceLayer == null);
 }
 protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
 {
     if (this.Parent != null)
     {
         // forward to parent
         return(this.Parent.internalCanMerge(this, rootElement, elementGroupPrototype));
     }
     return(base.CanMerge(rootElement, elementGroupPrototype));
 }
 protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
 {
     if (this.Parent != null)
     {
         // forward to parent
         return this.Parent.internalCanMerge(this, rootElement, elementGroupPrototype);
     }
     return base.CanMerge(rootElement, elementGroupPrototype);
 }
Exemple #9
0
        protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            if (rootElement != null &&
                rootElement.ElementId == Guid.Empty)
            {
                var rootElementDomainInfo = Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);

                if (rootElementDomainInfo.IsDerivedFrom(NavigationProperty.DomainClassId))
                {
                    return(false);
                }
            }
            return(base.CanMerge(rootElement, elementGroupPrototype));
        }
        /* There are two versions of CreateElementToolPrototype here.
         * One deals with each Component subtype separately: if you add a new subtype, you need to add more here.
         * The other automatically deals with eacn Component subtype, using DSL reflection info.
         *
         * See http://msdn.microsoft.com/library/bb126279.aspx#groups
         */

        /*
         * /// <summary>
         * /// Toolbox initialization, called for each element tool on the toolbox.
         * /// This version deals with each Component subtype separately.
         * /// </summary>
         * /// <param name="store"></param>
         * /// <param name="domainClassId">Identifies the domain class this tool should instantiate.</param>
         * /// <returns>prototype of the object or group of objects to be created by tool</returns>
         * protected override ElementGroupPrototype CreateElementToolPrototype(Store store, Guid domainClassId)
         * {
         *
         *  if (domainClassId == Resistor.DomainClassId)
         *  {
         *      Resistor resistor = new Resistor(store);
         *
         *      // Must initialize these in order of initialization:
         *      // DSLT v1 bug affecting derived relationships.
         *      resistor.T1 = new ComponentTerminal(store);
         *      resistor.T2 = new ComponentTerminal(store);
         *
         *      resistor.T1.Name = "t1";
         *      resistor.T2.Name = "t2";
         *
         *      ElementGroup elementGroup = new ElementGroup(store.DefaultPartition);
         *      elementGroup.AddGraph(resistor, true);
         *      // AddGraph includes the embedded parts.
         *
         *      return elementGroup.CreatePrototype();
         *  }
         *  else if (domainClassId == Capacitor.DomainClassId)
         *  {
         *      Capacitor capacitor = new Capacitor(store);
         *
         *      // Must initialize these in order of initialization:
         *      // DSLT v1 bug affecting derived relationships.
         *      capacitor.T1 = new ComponentTerminal(store);
         *      capacitor.T2 = new ComponentTerminal(store);
         *
         *      capacitor.T1.Name = "t1";
         *      capacitor.T2.Name = "t2";
         *
         *      ElementGroup elementGroup = new ElementGroup(store.DefaultPartition);
         *      elementGroup.AddGraph(capacitor, true);
         *      // AddGraph includes the embedded parts.
         *
         *      return elementGroup.CreatePrototype();
         *  }
         *
         *  else if (domainClassId == Transistor.DomainClassId)
         *  {
         *      Transistor transistor = new Transistor(store);
         *
         *      // Must initialize these in order of initialization:
         *      // DSLT v1 bug affecting derived relationships.
         *      transistor.Base = new ComponentTerminal(store);
         *      transistor.Collector = new ComponentTerminal(store);
         *      transistor.Emitter = new ComponentTerminal(store);
         *
         *      transistor.Base.Name = "base";
         *      transistor.Collector.Name = "collector";
         *      transistor.Emitter.Name = "emitter";
         *
         *      // Create an ElementGroup for the Toolbox.
         *      ElementGroup elementGroup = new ElementGroup(store.DefaultPartition);
         *      elementGroup.AddGraph(transistor, true);
         *      // AddGraph includes the embedded parts
         *
         *      return elementGroup.CreatePrototype();
         *  }
         *
         *  else
         *  {
         *      return base.CreateElementToolPrototype(store, domainClassId);
         *  }
         *
         *
         * }
         *
         */

        /// <summary>
        /// Toolbox initialization for components with fixed embedded parts.
        /// This deals with all the subclasses of Component, adding an instance for each relationship derived from ComponentHasTerminals.
        /// The benefit of this approach is that it does not need to be adjusted for each new Component subclass.
        /// Called for each element tool on the toolbox.
        /// </summary>
        /// <param name="store"></param>
        /// <param name="domainClassId">Identifies the domain class this tool should instantiate.</param>
        /// <returns>prototype of the object or group of objects to be created by tool</returns>
        protected override ElementGroupPrototype CreateElementToolPrototype(Store store, Guid domainClassId)
        {
            // Called for each element tool on the toolbox.
            // Get the class meta info for this class.
            DomainClassInfo thisClassInfo = store.DomainDataDirectory.FindDomainClass(domainClassId);

            if (!thisClassInfo.IsDerivedFrom(Component.DomainClassId))
            {
                // Not one of those we're interested in: defer to base method.
                return(base.CreateElementToolPrototype(store, domainClassId));
            }
            else
            {
                // Construct an instance of this type. Use the constructor that takes a store and a variable number of property bindings.
                Component component = (Component)thisClassInfo.ImplementationClass. // get the actual class from the meta info
                                      InvokeMember(                                 // method in System.Reflection.Type
                    "",
                    System.Reflection.BindingFlags.CreateInstance                   // invoke the constructor
                    | System.Reflection.BindingFlags.OptionalParamBinding,          // which has a params binding
                    null,                                                           // no special binder
                    null,                                                           //no target object since we want the constructor
                    new object[] { store });                                        // Called like "new Resistor(store)"

                // Now add whatever ComponentTerminals it has.
                // Each Component subtype sources several subrelationships of ComponentHasComponentTerminal.
                // Go through the metainfo about each role the class plays in relationships.
                foreach (DomainRoleInfo role in thisClassInfo.LocalDomainRolesPlayed)
                {
                    // Pick out the roles that are one end of a relationship to a Terminal.
                    if (role.DomainRelationship.IsDerivedFrom(ComponentHasComponentTerminal.DomainClassId) &&
                        !role.DomainRelationship.ImplementationClass.IsAbstract)
                    {
                        ComponentTerminal terminal = new ComponentTerminal(store);
                        // Fill in the instance name with the name of the role - just a convenience.
                        // The role at the Terminal end of the relationship is the one called "T1" or "collector" or some such.
                        terminal.Name = role.OppositeDomainRole.Name.ToLowerInvariant();
                        // Instantiate the relationship with the constructor that takes the component and terminal.
                        role.DomainRelationship.ImplementationClass.InvokeMember("", System.Reflection.BindingFlags.CreateInstance,
                                                                                 null, null,
                                                                                 new object[] { component, terminal });
                    }
                }
                // Create an Element Group Prototype containing this tree.
                ElementGroup elementGroup = new ElementGroup(store.DefaultPartition);
                elementGroup.AddGraph(component, true, true); // AddGraph includes the embedded elements.
                elementGroup.AddRange(component.ComponentTerminals, true);
                ElementGroupPrototype egp = elementGroup.CreatePrototype();
                return(egp);
            }
        }
        protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            if (rootElement != null
                && rootElement.ElementId == Guid.Empty)
            {
                var rootElementDomainInfo = Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);

                if (rootElementDomainInfo.IsDerivedFrom(NavigationProperty.DomainClassId))
                {
                    return false;
                }
            }
            return base.CanMerge(rootElement, elementGroupPrototype);
        }
Exemple #12
0
        /// <summary>
        /// Check whether this model class is an acceptor for the content of a prototype
        /// </summary>
        /// <param name="elementGroupPrototype"></param>
        /// <param name="protoElement"></param>
        /// <returns></returns>
        protected override bool CanAddChildElement(ElementGroupPrototype elementGroupPrototype, ProtoElementBase protoElement)
        {
            if (protoElement != null)
            {
                bool          canAdd        = false;
                MetaClassInfo metaClassInfo = this.Store.MetaDataDirectory.FindMetaClass(protoElement.MetaClassId);

                if (typeof(ISpySoft.SFSchemaLanguage.DomainModel.SchemaModelItem).IsAssignableFrom(metaClassInfo.ImplementationClass))
                {
                    canAdd = true;
                }

                return(canAdd);
            }
            return(false);
        }
Exemple #13
0
        /// <summary>
        /// Create a serialized prototype for Activity to attach to the toolbox.
        /// </summary>
        /// <param name="toolboxItem"></param>
        /// <returns>The prototype</returns>
        public override ElementGroupPrototype InitializeToolboxItem(ModelingToolboxItem toolboxItem)
        {
            ElementGroup          elementGroup = new ElementGroup(this.Store);
            ElementGroupPrototype proto        = null;

            Debug.Assert(this.Store.TransactionManager.InTransaction, "Must be in transaction");

            ISpySoft.SFSchemaLanguage.DomainModel.Activity instance = ISpySoft.SFSchemaLanguage.DomainModel.Activity.CreateActivity(this.Store);

            if (instance != null)
            {
                elementGroup.AddGraph(instance);

                proto = elementGroup.CreatePrototype(instance);
            }
            return(proto);
        }
        /// <summary>
        /// Returns a value indicating whether the source element represented by the
        /// specified root ProtoElement can be added to this element.
        /// </summary>
        /// <param name="rootElement">The root ProtoElement representing a source element.  This can be null,
        /// in which case the ElementGroupPrototype does not contain an ProtoElements
        /// and the code should inspect the ElementGroupPrototype context information.</param>
        /// <param name="elementGroupPrototype">The ElementGroupPrototype that contains the root ProtoElement.</param>
        /// <returns>
        /// True if the source element represented by the ProtoElement can be added to this target element.
        /// </returns>
        protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            Guard.NotNull(() => rootElement, rootElement);
            Guard.NotNull(() => elementGroupPrototype, elementGroupPrototype);

            if (rootElement != null)
            {
                var rootElementDomainInfo = this.Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);

                if (rootElementDomainInfo.IsDerivedFrom(ElementSchema.DomainClassId) ||
                    rootElementDomainInfo.IsDerivedFrom(CollectionSchema.DomainClassId) ||
                    rootElementDomainInfo.IsDerivedFrom(ExtensionPointSchema.DomainClassId))
                {
                    return(true);
                }
            }

            return(base.CanMerge(rootElement, elementGroupPrototype));
        }
Exemple #15
0
        /// <summary>
        /// Determines whether this instance [can merge layer] the specified root element.
        /// </summary>
        /// <param name="rootElement">The root element.</param>
        /// <param name="elementGroupPrototype">The element group prototype.</param>
        /// <returns>
        ///     <c>true</c> if this instance [can merge layer] the specified root element; otherwise, <c>false</c>.
        /// </returns>
        private bool CanMergeLayer(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
        {
            if (elementGroupPrototype == null)
            {
                throw new ArgumentNullException("elementGroupPrototype");
            }

            if (rootElement != null)
            {
                DomainClassInfo rootElementDomainInfo =
                    Partition.DomainDataDirectory.GetDomainClass(rootElement.DomainClassId);

                if (rootElementDomainInfo.IsDerivedFrom(Layer.DomainClassId))
                {
                    return(Component.GetLayerLevel(rootElement.DomainClassId) == Level);
                }
            }
            return(false);
        }
 private IEnumerable <ModelElement> ExtractElements(IDataObject data)
 {
     if (data != null)
     {
         if (data.GetDataPresent(typeof(ElementGroupPrototype)))
         {
             ElementGroupPrototype groupPrototype = (ElementGroupPrototype)data.GetData(typeof(ElementGroupPrototype));
             if (groupPrototype != null)
             {
                 IElementDirectory elementDir = Store.ElementDirectory;
                 foreach (ProtoElement proto in groupPrototype.RootProtoElements)
                 {
                     ModelElement element;
                     if (null != (element = elementDir.FindElement(proto.ElementId)))
                     {
                         yield return(element);
                     }
                 }
             }
         }
         else
         {
             Store store = Store;
             DomainDataDirectory dataDirectory = store.DomainDataDirectory;
             foreach (string possibleClassName in data.GetFormats(false))
             {
                 DomainClassInfo classInfo;
                 DomainClassInfo elementClassInfo;
                 ModelElement    element;
                 if (null != (classInfo = dataDirectory.FindDomainClass(possibleClassName)) &&
                     null != (element = data.GetData(possibleClassName) as ModelElement) &&
                     element.Store == store &&
                     ((elementClassInfo = element.GetDomainClass()) == classInfo ||
                      elementClassInfo.IsDerivedFrom(classInfo)))
                 {
                     yield return(element);
                 }
             }
         }
     }
 }
        protected override ModelElement ChooseMergeTarget(ElementGroupPrototype elementGroupPrototype)
        {
            return base.ChooseMergeTarget(elementGroupPrototype);

        }
Exemple #18
0
 /// <summary>
 /// Construct a new model note action for a specific diagram. The
 /// same action can be reused multiple times by activating and
 /// deactivating it.
 /// </summary>
 /// <param name="diagram">The owning diagram</param>
 /// <param name="prototype">The prototype of the current toolbox item.</param>
 public ModelNoteAction(Diagram diagram, ElementGroupPrototype prototype)
     : base(diagram, prototype)
 {
     Reset();
 }
 /// <summary>
 /// Construct a new constraint action for a specific diagram. The
 /// same connect action can be reused multiple times by activating and
 /// deactivating it.
 /// </summary>
 /// <param name="diagram">The owning diagram</param>
 /// <param name="prototype">The prototype of the current toolbox item.</param>
 public InternalUniquenessConstraintAction(Diagram diagram, ElementGroupPrototype prototype)
     : base(diagram, prototype)
 {
     Reset();
 }
Exemple #20
0
        public override void MergeElementGroupPrototype(ModelElement targetElement, ElementGroupPrototype elementGroupPrototype)
        {
            int i = 5;

            base.MergeElementGroupPrototype(targetElement, elementGroupPrototype);
        }
Exemple #21
0
 /// <summary>
 /// Create a new toolbox action. One instance of this class
 /// should be created per distinct toolbox item for each
 /// diagram instance.
 /// </summary>
 /// <param name="diagram">The current diagram.</param>
 /// <param name="prototype">The group prototype, retrieved from the
 /// <see cref="ModelingToolboxItem.Prototype"/> property.</param>
 public ElementPrototypeToolboxAction(Diagram diagram, ElementGroupPrototype prototype)
     : base(diagram)
 {
     myCursor    = Cursors.No;
     myPrototype = prototype;
 }
Exemple #22
0
		/// <summary>
		/// Create a new toolbox action. One instance of this class
		/// should be created per distinct toolbox item for each
		/// diagram instance.
		/// </summary>
		/// <param name="diagram">The current diagram.</param>
		/// <param name="prototype">The group prototype, retrieved from the
		/// <see cref="ModelingToolboxItem.Prototype"/> property.</param>
		public ElementPrototypeToolboxAction(Diagram diagram, ElementGroupPrototype prototype)
			: base(diagram)
		{
			myCursor = Cursors.No;
			myPrototype = prototype;
		}
Exemple #23
0
 //Prevent pasting of sockets
 protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
 {
     return(false);
 }
Exemple #24
0
        internal virtual bool internalCanMerge(VDWidget origianlTargetWidget, ProtoElementBase sourceRootElement, ElementGroupPrototype elementGroupPrototype)
        {
            if (elementGroupPrototype == null)
            {
                throw new ArgumentNullException("elementGroupPrototype");
            }

            if (sourceRootElement != null)
            {
                DomainClassInfo rootElementDomainInfo = this.Partition.DomainDataDirectory.GetDomainClass(sourceRootElement.DomainClassId);
                if (rootElementDomainInfo.IsDerivedFrom(VDWidget.DomainClassId))
                {
                    return(MergeManager.Instance.CanMerge(rootElementDomainInfo.Id, this.GetDomainClass().Id));
                }
            }

            return(base.CanMerge(sourceRootElement, elementGroupPrototype));
        }
		/// <summary>
		/// Construct a new constraint action for a specific diagram. The
		/// same connect action can be reused multiple times by activating and
		/// deactivating it.
		/// </summary>
		/// <param name="diagram">The owning diagram</param>
		/// <param name="prototype">The prototype of the current toolbox item.</param>
		public ExternalConstraintAction(Diagram diagram, ElementGroupPrototype prototype)
			: base(diagram, prototype)
		{
			Reset();
		}
Exemple #26
0
 protected override ModelElement ChooseMergeTarget(ElementGroupPrototype elementGroupPrototype)
 {
     return(base.ChooseMergeTarget(elementGroupPrototype));
 }
Exemple #27
0
 /// <summary>
 /// Returns a value indicating whether the source element represented by the
 /// specified root ProtoElement can be added to this element.
 /// </summary>
 /// <param name="rootElement">
 /// The root ProtoElement representing a source element.  This can be null,
 /// in which case the ElementGroupPrototype does not contain an ProtoElements
 /// and the code should inspect the ElementGroupPrototype context information.
 /// </param>
 /// <param name="elementGroupPrototype">The ElementGroupPrototype that contains the root ProtoElement.</param>
 /// <returns>true if the source element represented by the ProtoElement can be added to this target element.</returns>
 protected override bool CanMerge(ProtoElementBase rootElement, ElementGroupPrototype elementGroupPrototype)
 {
     return(internalCanMerge(this, rootElement, elementGroupPrototype));
 }
		/// <summary>
		/// Construct a new constraint action for a specific diagram. The
		/// same connect action can be reused multiple times by activating and
		/// deactivating it.
		/// </summary>
		/// <param name="diagram">The owning diagram</param>
		/// <param name="prototype">The prototype of the current toolbox item.</param>
		public InternalUniquenessConstraintAction(Diagram diagram, ElementGroupPrototype prototype)
			: base(diagram, prototype)
		{
			Reset();
		}