src/Misc/EFTools/EntityDesignPackage/CustomCode/MicrosoftDataEntityDesignDocView.cs
/// <summary>
///     The implementation of VsShell.ISelectionContainer.SelectObjects in
///     ModelingWindowPane calls DoSelectObjects()
///     - base calls to DiagramDocView : ModelingDocView : ModelingWindowPane
///     if (this.CurrentDesigner != null) -> sets selection in the current designer
///     else calls to ModelingWindowPane which is a no-op
///     This seems to only be called when the user chooses an item from the
///     drop down box at the top of the properties screen
/// </summary>
/// <returns></returns>
The implementation of VsShell.ISelectionContainer.SelectObjects in
ModelingWindowPane calls DoSelectObjects()
base calls to DiagramDocView : ModelingDocView : ModelingWindowPane
if (this.CurrentDesigner != null) -> sets selection in the current designer
else calls to ModelingWindowPane which is a no-op
This seems to only be called when the user chooses an item from the
drop down box at the top of the properties screen
The implementation of VsShell . ISelectionContainer . SelectObjects in ModelingWindowPane calls DoSelectObjects () base calls to DiagramDocView : ModelingDocView : ModelingWindowPane if ( this . CurrentDesigner ! = null ) - > sets selection in the current designer else calls to ModelingWindowPane which is a no - op This seems to only be called when the user chooses an item from the drop down box at the top of the properties screen
protected override void DoSelectObjects(uint count, object[] objects, uint flags)
        {
            var objectsSelected = new ArrayList();
            var selectedModelObjects = new List<EFObject>();
            uint nonPropertyObjectsCount = 0;
            if (count > 0)
            {
                foreach (var o in objects)
                {
                    var typeDesc = o as ObjectDescriptor;
                    Debug.Assert(typeDesc != null, "Something unexpected was selected");
                    if (typeDesc != null)
                    {
                        selectedModelObjects.Add(typeDesc.WrappedItem);
                        if (typeDesc.WrappedItem is PropertyBase)
                        {
                            DSLDesignerNavigationHelper.NavigateTo(typeDesc.WrappedItem);
                        }
                        else
                        {
                            nonPropertyObjectsCount++;
                            var dslElem = XRef.GetExisting(typeDesc.WrappedItem);
                            var presElem = dslElem as DslDiagrams.PresentationElement;
                            if (presElem == null)
                            {
                                var shapes =
                                    DslDiagrams.PresentationViewsSubject.GetPresentation(dslElem);
                                if (shapes != null
                                    && shapes.Count > 0)
                                {
                                    presElem = shapes[0];
                                }
                            }
                            Debug.Assert(presElem != null, "Why couldn't we find the shape for this ModelElement?");
                            if (presElem != null)
                            {
                                objectsSelected.Add(presElem);
                            }
                        }
                    }
                }
                Debug.Assert(
                    nonPropertyObjectsCount == objectsSelected.Count,
                    "nonPropertyObjectsCount(" + nonPropertyObjectsCount + ") != objectsSelected.Count (" + objectsSelected.Count + ")");
            }
            Context.Items.SetValue(new EntityDesignerSelection(selectedModelObjects));
            if (nonPropertyObjectsCount > 0
                && nonPropertyObjectsCount == objectsSelected.Count)
            {
                var objectsToSelect = new object[objectsSelected.Count];
                objectsSelected.CopyTo(objectsToSelect, 0);
                base.DoSelectObjects(nonPropertyObjectsCount, objectsToSelect, flags);
            }
            else if (nonPropertyObjectsCount != objectsSelected.Count)
            {
                base.DoSelectObjects(count, objects, flags);
            }
        }
protected override void DoSelectObjects ( uint count , object [ ] objects , uint flags ) { var objectsSelected = new ArrayList ( ) ; var selectedModelObjects = new List < EFObject > ( ) ; uint nonPropertyObjectsCount = 0 ; if ( count > 0 ) { foreach ( var o in objects ) { var typeDesc = o as ObjectDescriptor ; Debug . Assert ( typeDesc != null , " " ) ; if ( typeDesc != null ) { selectedModelObjects . Add ( typeDesc . WrappedItem ) ; if ( typeDesc . WrappedItem is PropertyBase ) { DSLDesignerNavigationHelper . NavigateTo ( typeDesc . WrappedItem ) ; } else { nonPropertyObjectsCount ++ ; var dslElem = XRef . GetExisting ( typeDesc . WrappedItem ) ; var presElem = dslElem as DslDiagrams . PresentationElement ; if ( presElem == null ) { var shapes = DslDiagrams . PresentationViewsSubject . GetPresentation ( dslElem ) ; if ( shapes != null && shapes . Count > 0 ) { presElem = shapes [ 0 ] ; } } Debug . Assert ( presElem != null , " " ) ; if ( presElem != null ) { objectsSelected . Add ( presElem ) ; } } } } Debug . Assert ( nonPropertyObjectsCount == objectsSelected . Count , " " + nonPropertyObjectsCount + " " + objectsSelected . Count + " " ) ; } Context . Items . SetValue ( new EntityDesignerSelection ( selectedModelObjects ) ) ; if ( nonPropertyObjectsCount > 0 && nonPropertyObjectsCount == objectsSelected . Count ) { var objectsToSelect = new object [ objectsSelected . Count ] ; objectsSelected . CopyTo ( objectsToSelect , 0 ) ; base . DoSelectObjects ( nonPropertyObjectsCount , objectsToSelect , flags ) ; } else if ( nonPropertyObjectsCount != objectsSelected . Count ) { base . DoSelectObjects ( count , objects , flags ) ; } }
The implementation of VsShell.ISelectionContainer.SelectObjects in
ModelingWindowPane calls DoSelectObjects()
 base calls to DiagramDocView : ModelingDocView : ModelingWindowPane
if (this.CurrentDesigner != null) -> sets selection in the current designer
else calls to ModelingWindowPane which is a no-op
This seems to only be called when the user chooses an item from the
drop down box at the top of the properties screen
The implementation of VsShell . ISelectionContainer . SelectObjects in ModelingWindowPane calls DoSelectObjects () base calls to DiagramDocView : ModelingDocView : ModelingWindowPane if ( this . CurrentDesigner ! = null ) - > sets selection in the current designer else calls to ModelingWindowPane which is a no - op This seems to only be called when the user chooses an item from the drop down box at the top of the properties screen
// We have to reverse the logic of the GetSelectX fn above; that is, convert the // array of our ItemDescriptors back into an array of Dsl ModelElements before  // calling the base impl; the base impl will then select the shape // Properties do not have a corresponding ShapeElement; the instance of the DomainClass is just an item // within the ElementListCompartment. Since this override only accepts a list of ShapeElements, we will // have to use the DSLDesignerNavigationHelper to create a DiagramItem that uniquely identifies the // list compartment item and select that. // For all other EFObjects, we can attempt to get a ShapeElement // just select the first shape for this item // update the selection for the Entity Designer in case anyone else is interested // If we didn't encounter any property descriptors and the number of those descriptors equals the objects selected, // then we can pass this on to the base implementation to perform the selection // We should have found objects to select from all the non-property descriptors. If for some reason we didn't, // then we pass this onto the base implementation
None
count
uint
objects
object[]
flags
uint