public object GetExtender(string ExtenderCATID,
                                  string ExtenderName,
                                  object ExtendeeObject,
                                  EnvDTE.IExtenderSite ExtenderSite,
                                  int Cookie)
        {
            NoneItemExtender extender = null;

            if (CanExtend(ExtenderCATID, ExtenderName, ExtendeeObject))
            {
                var browseObject = ExtendeeObject as IVsBrowseObject;
                if (browseObject != null)
                {
                    IVsHierarchy hierarchyItem;
                    uint         itemId;
                    browseObject.GetProjectItem(out hierarchyItem, out itemId);
                    extender = new NoneItemExtender(hierarchyItem, itemId, ExtenderSite, Cookie);
                }
            }
            return(extender);
        }
 public VsProjectConfigExtender(object ExtendeeObject, EnvDTE.IExtenderSite ExtenderSite, int Cookie)
 {
 }
Example #3
0
 /// <summary>
 /// Initializes the members of the SolnExtender class.
 /// </summary>
 /// <param name="sln">DTE.Solution object.</param>
 /// <param name="ExtenderCookie">Cookie value that identifies the Extender to its Site.</param>
 /// <param name="ExtenderSite">Site object for the Extender.</param>
 public void Init(EnvDTE.Solution sln, int ExtenderCookie, EnvDTE.IExtenderSite ExtenderSite)
 {
     Site   = ExtenderSite;
     Cookie = ExtenderCookie;
     Sol    = sln;
 }
Example #4
0
 /// <summary>
 /// Initializes the members of the SolnExtender class.
 /// </summary>
 /// <param name="ExtenderCookie">Cookie value that identifies the Extender to its Site.</param>
 /// <param name="ExtenderSite">Site object for the Extender.</param>
 public void Init(int ExtenderCookie, EnvDTE.IExtenderSite ExtenderSite)
 {
     mySite   = ExtenderSite;
     myCookie = ExtenderCookie;
 }
Example #5
0
        /// <summary>
        /// Implementation of IExtenderProvider::GetExtender.
        /// </summary>
        /// <param name="ExtenderCATID">CATID of the object being extended.</param>
        /// <param name="ExtenderName">Name of the Extension.</param>
        /// <param name="ExtendeeObject">Object being extended.</param>
        /// <param name="ExtenderSite">Site object for the Extender.</param>
        /// <param name="Cookie">Cookie value that identifies the Extender to its Site.</param>
        /// <returns>A newly created Extender object.</returns>
        public object GetExtender(string ExtenderCATID, string ExtenderName, object ExtendeeObject, EnvDTE.IExtenderSite ExtenderSite, int Cookie)
        {
            Extender retVal = new Extender();

            retVal.Init(Cookie, ExtenderSite);
            return(retVal);
        }
Example #6
0
        /// <summary>
        /// Implementation of IExtenderProvider::GetExtender.
        /// </summary>
        /// <param name="ExtenderCATID">CATID of the object being extended.</param>
        /// <param name="ExtenderName">Name of the Extension.</param>
        /// <param name="ExtendeeObject">Object being extended.</param>
        /// <param name="ExtenderSite">Site object for the Extender.</param>
        /// <param name="cookie">Cookie value that identifies the Extender to its Site.</param>
        /// <returns>A newly created Extender object.</returns>
        public object GetExtender(string ExtenderCATID, string ExtenderName, object ExtendeeObject, EnvDTE.IExtenderSite ExtenderSite, int Cookie)
        {
            object Extender = null;             //In case of failure.

            if (CanExtend(ExtenderCATID, ExtenderName, ExtendeeObject))
            {
                //Note: More complicated implementations can keep a map of Extendees and Extenders
                //they have given out, so that if asked for again for the same Extendee Extender
                //you don't have to recreate it again. In our case, the Extenders are very
                //light-weight objects and have little direct interaction with the Extendee, so
                //we don't bother.

                SolnExtender slnext = new SolnExtender();

                EnvDTE.Solution sln = null;

                //Get the solution automation object.
                //We don't need to interact with the Extendee object much since we go
                //directly to the Solution automation object for our needs, but most
                //implementations would talk directly to the Extendee object to extend/shadow
                //its properties.
                sln = ExtendeeObject as EnvDTE.Solution;
                if (sln == null)
                {
                    //Extending the Soltuion browse object (the object that's displayed
                    //in the property browser when the Solution Node is selected in
                    //the Solution Explorer). In this case, get the DTE.Solution object
                    //directly from the object model.
                    EnvDTE.DTE root = (EnvDTE.DTE)ExtenderSite.GetObject("");
                    sln = root.Solution;
                }

                if (sln != null)
                {
                    //Init our extender.
                    slnext.Init(sln, Cookie, ExtenderSite);
                    Extender = slnext;
                }
            }

            return(Extender);
        }