/// <summary>
 /// Initializes a new instance of the <see cref="OAWowProjectProperties"/> class.
 /// </summary>
 /// <param name="nodeProperties">The node properties.</param>
 internal OAWowProjectProperties(NodeProperties nodeProperties)
     : base(nodeProperties)
 {
     this.AddProperties();
 }
Example #2
0
        public virtual void SetObjects(uint count, object[] punk)
        {
            if (count > 0)
            {
                if (punk[0] is ProjectConfig)
                {
                    ArrayList configs = new ArrayList();

                    for (int i = 0; i < count; i++)
                    {
                        ProjectConfig config = (ProjectConfig)punk[i];

                        if (this.project == null)
                        {
                            this.project = config.ProjectMgr;
                        }

                        configs.Add(config);
                    }

                    this.projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
                }
                else if (punk[0] is NodeProperties)
                {
                    if (this.project == null)
                    {
                        this.project = (punk[0] as NodeProperties).Node.ProjectMgr;
                    }

                    System.Collections.Generic.Dictionary <string, ProjectConfig> configsMap = new System.Collections.Generic.Dictionary <string, ProjectConfig>();

                    for (int i = 0; i < count; i++)
                    {
                        NodeProperties property = (NodeProperties)punk[i];
                        IVsCfgProvider provider;
                        ErrorHandler.ThrowOnFailure(property.Node.ProjectMgr.GetCfgProvider(out provider));
                        uint[] expected = new uint[1];
                        ErrorHandler.ThrowOnFailure(provider.GetCfgs(0, null, expected, null));
                        if (expected[0] > 0)
                        {
                            ProjectConfig[] configs = new ProjectConfig[expected[0]];
                            uint[]          actual  = new uint[1];
                            provider.GetCfgs(expected[0], configs, actual, null);

                            foreach (ProjectConfig config in configs)
                            {
                                if (!configsMap.ContainsKey(config.ConfigName))
                                {
                                    configsMap.Add(config.ConfigName, config);
                                }
                            }
                        }
                    }

                    if (configsMap.Count > 0)
                    {
                        if (this.projectConfigs == null)
                        {
                            this.projectConfigs = new ProjectConfig[configsMap.Keys.Count];
                        }
                        configsMap.Values.CopyTo(this.projectConfigs, 0);
                    }
                }
            }
            else
            {
                this.project = null;
            }

            if (this.active && this.project != null)
            {
                UpdateObjects();
            }
        }
Example #3
0
    public virtual object GetProperty(int propId) {
      __VSHPROPID id = (__VSHPROPID)propId;

      object result = null;
      switch (id) {
        case __VSHPROPID.VSHPROPID_Expandable:
          result = (this.firstChild != null);
          break;
        case __VSHPROPID.VSHPROPID_Caption:
          result = this.Caption;
          break;
        case __VSHPROPID.VSHPROPID_Name:
          result = this.Caption;          
          break;
        case __VSHPROPID.VSHPROPID_ExpandByDefault:
          result = false;
          break;
        case __VSHPROPID.VSHPROPID_IconHandle:
          result = GetIconHandle(false);
          break;
        case __VSHPROPID.VSHPROPID_OpenFolderIconHandle:
          result = GetIconHandle(true);
          break;
        case __VSHPROPID.VSHPROPID_NextVisibleSibling:
          goto case __VSHPROPID.VSHPROPID_NextSibling;
        case __VSHPROPID.VSHPROPID_NextSibling:
          result = (this.nextSibling != null) ? this.nextSibling.hierarchyId : VsConstants.VSITEMID_NIL;
          break;
        case __VSHPROPID.VSHPROPID_FirstChild:
          goto case __VSHPROPID.VSHPROPID_FirstVisibleChild;
        case __VSHPROPID.VSHPROPID_FirstVisibleChild:
          result = (this.firstChild != null) ? this.firstChild.hierarchyId : VsConstants.VSITEMID_NIL;
          break;
        case __VSHPROPID.VSHPROPID_Parent:
          if (this.parentNode != null) result = this.parentNode.hierarchyId;
          break;
        case __VSHPROPID.VSHPROPID_ParentHierarchyItemid:
          if (_parentHierarchy != null) result = _parentHierarchyItemId;
          break;
        case __VSHPROPID.VSHPROPID_ParentHierarchy:
          result = _parentHierarchy;
          break;
        case __VSHPROPID.VSHPROPID_Root:
          result = Marshal.GetIUnknownForObject(this.projectMgr);
          break;
        case __VSHPROPID.VSHPROPID_Expanded:
          result = this.isExpanded;  
          break;
        case __VSHPROPID.VSHPROPID_BrowseObject:
          result = new NodeProperties(this);
          break;
        case __VSHPROPID.VSHPROPID_EditLabel:
          result = GetEditLabel();
          break;
        case __VSHPROPID.VSHPROPID_SaveName:
          result = this.Url;
          break;
        case __VSHPROPID.VSHPROPID_ItemDocCookie:
          if (this.docCookie != 0) return this.docCookie;
          break;
      }
      if (propId != lastTracedProperty) {
        string trailer = (result == null) ? "null" : result.ToString();
        CCITracing.TraceCall(this.hierarchyId+","+id.ToString()+" = " + trailer);
        lastTracedProperty = propId; // some basic filtering here...
      }
      return result;
    }