private bool CheckLink(UseCaseDiagramNodeData fromData, UseCaseDiagramNodeData toData, UseCaseDiagramLinkData linkData, string category)
        {
            if (
                (category == Constants.UML_UCD_ANCHOR)
                &&
                (fromData.Category == Constants.UML_UCD_EDITABLE_NOTE || toData.Category == Constants.UML_UCD_EDITABLE_NOTE)
                &&
                (fromData.Category != toData.Category)
                &&
                (fromData.Category != Constants.UML_UCD_NOTE)
                &&
                (toData.Category != Constants.UML_UCD_NOTE)
                )
            {
                linkData.Category = category;
                linkData.Color    = Constants.VALID_COLOR;
                return(IsLinkUniqueBothWays(linkData, category));
            }
            else
            {
                string relationship = Uml4Upmm.CheckUCDRelationship(fromData.IRI, toData.IRI, UseCaseDiagramPage.IsValidatingWithModel, out string color, category);

                if (relationship == null)
                {
                    return(false);
                }
                else
                {
                    linkData.Category = category;
                    linkData.Text     = relationship == "" ? relationship : "<<" + relationship + ">>";
                    linkData.Color    = color;
                }
            }
            return(IsLinkUnique(linkData, category));
        }
        private void diagram_LinkRelinked(object sender, Northwoods.GoXam.DiagramEventArgs e)
        {
            Link link = (e.Part as Link);
            UseCaseDiagramLinkData linkData = link.Data as UseCaseDiagramLinkData;
            UseCaseDiagramNodeData fromData = link.FromData as UseCaseDiagramNodeData;
            UseCaseDiagramNodeData toData   = link.ToData as UseCaseDiagramNodeData;

            var isValid = CheckLink(fromData, toData, linkData, linkData.Category);

            if (!isValid)
            {
                (diagram.LinksSource as ObservableCollection <UseCaseDiagramLinkData>).Remove(linkData);
            }
        }
        // event handler pro vkládání uzlu
        private void diagram_ExternalObjectsDropped(object sender, Northwoods.GoXam.DiagramEventArgs e)
        {
            UseCaseDiagramNodeData data = null;

            if ((sender as Diagram).SelectedNode == null)
            {
                data = (sender as Diagram).SelectedGroup.Data as UseCaseDiagramNodeData;
            }
            else
            {
                data = (sender as Diagram).SelectedNode.Data as UseCaseDiagramNodeData;
            }
            string[] categories = { Constants.UML_UCD_ACTOR, Constants.UML_UCD_SYSTEM, Constants.UML_UCD_NOTE, Constants.UML_UCD_USE_CASE, Constants.UML_UCD_EDITABLE_NOTE };

            if (categories.Contains(data.Category) && !AllowDuplicateNodes)
            {
                if ((sender as Diagram).Nodes.Count(x => (x.Data as UseCaseDiagramNodeData).IRI == data.IRI && (x.Data as UseCaseDiagramNodeData).Category == data.Category) > 1)
                {
                    diagram.Model.RemoveNode(data);
                }
            }
        }