Exemplo n.º 1
0
        /// <summary>
        /// Resets the Node properties for file node item.
        /// </summary>
        protected void ResetProperties()
        {
            bool changed = false;

            if (IsNonMemberItem)
            {
                if (!(_currentNodeProperties is NemerleFileNodeNonMemberProperties))
                {
                    _currentNodeProperties = new NemerleFileNodeNonMemberProperties(this);
                    changed = true;
                }
            }
            else
            {
                if (!(_currentNodeProperties is NemerleFileNodeProperties))
                {
                    _currentNodeProperties = new NemerleFileNodeProperties(this);
                    changed = true;
                }
            }

            if (changed)
            {
                OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_BrowseObject, 0);
            }
        }
Exemplo n.º 2
0
        private void FileAdded(object sender, HierarchyEventArgs ergs)
        {
            Debug.Assert(ergs.TextBuffer == null);

            IVsHierarchy hierarchy = (IVsHierarchy)sender;
            NemerleFileNodeProperties nodeProps = GetNodeProperties(hierarchy, ergs.ItemID);

            if (nodeProps.BuildAction != BuildAction.Compile)
            {
                return;
            }

            string path = ergs.FileName;

            AddSource(path);
        }
Exemplo n.º 3
0
        private static NemerleFileNodeProperties GetNodeProperties(IVsHierarchy hierarchy, uint itemID)
        {
            ErrorHelper.ThrowIsNull(hierarchy, "hierarchy");

            object propertyValue;
            int    hr = hierarchy.GetProperty(itemID, (int)__VSHPROPID.VSHPROPID_BrowseObject, out propertyValue);

            if (hr != VSConstants.S_OK)
            {
                throw new ArgumentException("Can't obtain VSHPROPID_BrowseObject for item with ID "
                                            + itemID, "itemID", new Win32Exception(hr));
            }

            NemerleFileNodeProperties properties = propertyValue as NemerleFileNodeProperties;

            if (properties == null)
            {
                return(new NemerleFileNodeProperties(((NodeProperties)propertyValue).Node));
            }
            else
            {
                return(properties);
            }
        }