public object GetExtender(string ExtenderCATID, string ExtenderName, object ExtendeeObject, IExtenderSite ExtenderSite, int Cookie)
        {
            object extender = CreateExtender(ExtenderCATID, ExtenderName, ExtendeeObject, ExtenderSite, Cookie);
            if (extender != null)
            {
                try
                {
                    if (_extenderSite != null && _cookie != 0)
                    {
                        _extenderSite.NotifyDelete(_cookie);
                    }
                }
                catch (Exception ex)
                {
                    if (ex.IsCritical())
                        throw;
                }

                _extender = extender;
                _extenderSite = ExtenderSite;
                _cookie = Cookie;
            }

            return extender;
        }
        protected object CreateExtender(string ExtenderCATID, string ExtenderName, object ExtendeeObject, IExtenderSite ExtenderSite, int Cookie)
        {
            object extender = null;

            ExtendVersion extendVersion = GetExtendVersion(ExtenderCATID, ExtenderName, ExtendeeObject);
            if (extendVersion != ExtendVersion.None)
            {
                IVsBrowseObject browseObject = ExtendeeObject as IVsBrowseObject;
                if (browseObject == null)
                    return null;

                IVsHierarchy hierarchy;
                uint itemId;
                if (ErrorHandler.Failed(browseObject.GetProjectItem(out hierarchy, out itemId)))
                    return null;

                IVsBuildPropertyStorage buildPropertyStorage = hierarchy as IVsBuildPropertyStorage;
                if (buildPropertyStorage == null)
                    return null;

                if (extendVersion == ExtendVersion.Antlr3)
                    extender = new GrammarFileObjectExtenderProperties(buildPropertyStorage, itemId);
                else
                    extender = new GrammarFileObjectExtenderPropertiesV4(buildPropertyStorage, itemId);
            }

            return extender;
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Default ctor
 /// </summary>
 public ResourceExtender(Dot42Package pkg, EnvDTE.IExtenderSite extenderSite, int siteCookie, object extendedObject)
 {
     pkg.Log("Extender created");
     this.pkg = pkg;
     this.extenderSite = extenderSite;
     this.siteCookie = siteCookie;
     this.extendedObject = extendedObject;
     fileNameDescr = TypeDescriptor.GetProperties(extendedObject)["FileName"];
 }
Ejemplo n.º 4
0
 public NodejsUwpPropertyExtender(EnvDTE.IExtenderSite extenderSite, int cookie)
 {
     this.extenderSite = extenderSite;
     this.cookie = cookie;
 }