src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignCommandSet.cs
/// <summary>
///     Return the parent to which the currently selected Clipboard contents should be added
///     by a Paste Command based on the currently selected Explorer item
/// </summary>
Return the parent to which the currently selected Clipboard contents should be added
by a Paste Command based on the currently selected Explorer item
Return the parent to which the currently selected Clipboard contents should be added by a Paste Command based on the currently selected Explorer item
[SuppressMessage("Microsoft.Performance", "CA1800:DoNotCastUnnecessarily")]
        private static ExplorerEFElement GetExplorerPasteTarget()
        {
            var selectedExplorerItem = SelectedExplorerItem;
            if (selectedExplorerItem != null)
            {
                if (CopyPasteUtils.GetComplexTypeFromClipboard() != null)
                {
                    if (selectedExplorerItem is ExplorerComplexTypes)
                    {
                        return selectedExplorerItem;
                    }
                    else if (selectedExplorerItem is ExplorerComplexType)
                    {
                        var complexTypesExplorerElement = selectedExplorerItem.Parent as ExplorerComplexTypes;
                        Debug.Assert(
                            complexTypesExplorerElement != null,
                            "Parent of ComplexType node is of type " + selectedExplorerItem.Parent.GetType().FullName
                            + ". Should be ExplorerComplexTypes");
                        return complexTypesExplorerElement;
                    }
                }
                else if (CopyPasteUtils.GetEnumTypeFromClipboard() != null)
                {
                    if (selectedExplorerItem is ExplorerEnumTypes)
                    {
                        return selectedExplorerItem;
                    }
                    else if (selectedExplorerItem is ExplorerEnumType)
                    {
                        var enumTypesExplorerElement = selectedExplorerItem.Parent as ExplorerEnumTypes;
                        Debug.Assert(
                            enumTypesExplorerElement != null,
                            "Parent of EnumType node is of type " + selectedExplorerItem.Parent.GetType().FullName
                            + ". Should be ExplorerEnumTypes");
                        return enumTypesExplorerElement;
                    }
                }
                else if (CopyPasteUtils.GetPropertiesFromClipboard() != null)
                {
                    if (selectedExplorerItem is ExplorerComplexType)
                    {
                        return selectedExplorerItem;
                    }
                    var explorerProperty = selectedExplorerItem as ExplorerConceptualProperty;
                    if (explorerProperty != null
                        && explorerProperty.Parent is ExplorerComplexType)
                    {
                        return explorerProperty.Parent;
                    }
                }
            }
            return null;
        }
[ SuppressMessage ( " " , " " ) ] private static ExplorerEFElement GetExplorerPasteTarget ( ) { var selectedExplorerItem = SelectedExplorerItem ; if ( selectedExplorerItem != null ) { if ( CopyPasteUtils . GetComplexTypeFromClipboard ( ) != null ) { if ( selectedExplorerItem is ExplorerComplexTypes ) { return selectedExplorerItem ; } else if ( selectedExplorerItem is ExplorerComplexType ) { var complexTypesExplorerElement = selectedExplorerItem . Parent as ExplorerComplexTypes ; Debug . Assert ( complexTypesExplorerElement != null , " " + selectedExplorerItem . Parent . GetType ( ) . FullName + " " ) ; return complexTypesExplorerElement ; } } else if ( CopyPasteUtils . GetEnumTypeFromClipboard ( ) != null ) { if ( selectedExplorerItem is ExplorerEnumTypes ) { return selectedExplorerItem ; } else if ( selectedExplorerItem is ExplorerEnumType ) { var enumTypesExplorerElement = selectedExplorerItem . Parent as ExplorerEnumTypes ; Debug . Assert ( enumTypesExplorerElement != null , " " + selectedExplorerItem . Parent . GetType ( ) . FullName + " " ) ; return enumTypesExplorerElement ; } } else if ( CopyPasteUtils . GetPropertiesFromClipboard ( ) != null ) { if ( selectedExplorerItem is ExplorerComplexType ) { return selectedExplorerItem ; } var explorerProperty = selectedExplorerItem as ExplorerConceptualProperty ; if ( explorerProperty != null && explorerProperty . Parent is ExplorerComplexType ) { return explorerProperty . Parent ; } } } return null ; }
Return the parent to which the currently selected Clipboard contents should be added
by a Paste Command based on the currently selected Explorer item
Return the parent to which the currently selected Clipboard contents should be added by a Paste Command based on the currently selected Explorer item
// Clipboard contains a ComplexType // user has selected the EnumTypes dummy node // in this case the dummy node itself is the target // user has selected another ComplexType node in the Explorer // in this case the pasted ComplexType will be a sibling of the selected // ComplexType and the target node is the parent ComplexTypes dummy node // Clipboard contains an EnumType // user has selected the ComplexTypes dummy node // in this case the dummy node itself is the target // user has selected another EnumType node in the Explorer // in this case the pasted ComplexType will be a sibling of the selected // EnumType and the target node is the parent EnumTypes dummy node // Clipboard contains a set of Property objects // user has selected the ComplexType node into which they would // like to Paste - in this case the ComplexType node itself is the target // user has selected a ComplexType Property node in the Explorer // in this case the pasted ComplexType Properties will be siblings // of the selected ComplexType Property so the target is the parent // ComplexType // clipboard contains objects which cannot be pasted on the Explorer // or the user has selected a target node which does not allow pasting