Beispiel #1
0
        /// <summary>
        /// Includes all files in the Excluded folder in the project
        /// </summary>
        /// <param name="node">Excluded Node representing the folder</param>
        /// <returns></returns>
        internal int IncludeFolderItem(ItemNode node)
        {
            var files = new List <string>();

            foreach (var child in node)
            {
                switch (child.Type)
                {
                case Constants.ItemNodeType.ExcludedFile:
                    files.Add(child.Path);
                    break;

                case Constants.ItemNodeType.ExcludedFolder:
                    IncludeFolderItem(child);
                    break;

                default:
                    break;
                }
            }
            node.Delete();
            uint parent = Project.ProjectProxy.AddFolderItem(node.Path);

            foreach (var file in files)
            {
                ErrorHandler.ThrowOnFailure(Project.ProjectProxy.AddFileItem(parent, file));
            }
            Project.RefreshSolutionExplorer(new ItemNode[] { node });
            return(VSConstants.S_OK);
        }
        /// <summary>
        /// Includes the file represented by the Excluded Node into the project
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        internal int IncludeFileItem(ItemNode node)
        {
            node.Delete();
            int result = Project.ProjectProxy.AddFileItem(node.Parent.ItemId, node.Path);

            return(result);
        }
        /// <summary>
        /// Includes all files in the Excluded folder in the project
        /// </summary>
        /// <param name="node">Excluded Node representing the folder</param>
        /// <returns></returns>
        internal int IncludeFolderItem(ItemNode node)
        {
            var path = node.Path;

            ensure_included(node);

            // It is necessary to re-acquire the node, because the ensure_included recreated it
            var folder_node = this[path];

            foreach (var child in new List <ItemNode>(folder_node))
            {
                switch (child.Type)
                {
                case Constants.ItemNodeType.ExcludedFile:
                    child.Delete();
                    ErrorHandler.ThrowOnFailure(Project.ProjectProxy.AddFileItem(folder_node.ItemId, child.Path));
                    break;

                case Constants.ItemNodeType.ExcludedFolder:
                    IncludeFolderItem(child);
                    break;

                default:
                    break;
                }
            }

            return(VSConstants.S_OK);
        }
Beispiel #4
0
        /// <summary>
        /// Includes the file represented by the Excluded Node into the project
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        internal int IncludeFileItem(ItemNode node)
        {
            node.Delete();
            int result = Project.ProjectProxy.AddFileItem(node.Parent.ItemId, node.Path);

            Project.RefreshSolutionExplorer(new ItemNode[] { node });
            return(result);
        }
Beispiel #5
0
 /// <summary>
 /// Registers the itemNode in the ItemList internal lists/dictionaries
 /// </summary>
 /// <param name="itemNode"></param>
 internal void Register(ItemNode itemNode)
 {
     itemMap.Add(itemNode.ItemId, itemNode);
     // from the standpoint of IVsHierarchy rename is handled by the F# project
     // as remove/add, therefore item path is never changed during item lifetime
     // and can considered to be immutable
     itemKeyMap.Add(itemNode.Path, itemNode);
 }
        /// <summary>
        /// Includes the file represented by the Excluded Node into the project
        /// </summary>
        /// <param name="node"></param>
        /// <returns></returns>
        internal int IncludeFileItem(ItemNode node)
        {
            var path   = node.Path;
            var parent = ensure_included(node.Parent);

            // It is necessary to re-acquire the node, because the ensure_included might'of recreated it
            this[path].Delete();
            return(Project.ProjectProxy.AddFileItem(parent, path));
        }
 public ShadowFileNode(ItemList items, ItemNode parent, uint itemId, string path)
     : base(items, parent, itemId, Constants.ItemNodeType.PhysicalFile, path)
 {
     //buildItem.Include for linked files OnAddFile is different from the one after save,
     //so it is better to keep canonical names too and associate 'Include' value with unique canonical name
     buildItem = Items.Project.ProjectProxy.GetBuildItem(this);
     //Admit 'Include' values for files with the same name in different folders are different-there will be no override
     Items.Project.ProjectProxy.IncludeToCanonical[buildItem.Include] = path;
 }
Beispiel #8
0
        protected ShadowFolderNode(ItemList items, ItemNode parent, uint itemId, Constants.ItemNodeType type, string path)
            : base(items, parent, itemId, type, path)
        {
            uint child = items.Project.GetNodeChild(itemId);

            while (child != VSConstants.VSITEMID_NIL)
            {
                CreateChildNode(child);
                child = items.Project.GetNodeSibling(child);
            }
            MapChildren();
        }
 private uint ensure_included(ItemNode node)
 {
     if (node.Type == Constants.ItemNodeType.ExcludedFolder)
     {
         // 1. save the path for future use after the node is deleted. The node will still be around
         //      even though it is deleted, so I could've accessed it as node.Path when I would have needed it
         //      but it feels weird - accessing object fields after it has been deleted
         var path = node.Path;
         // 2. make sure the parent is ok
         ensure_included(node.Parent);
         // 3. delete the node with all its children. It is necessary to re-acquire the node, because
         //      the ensure_included might'of recreated it
         this[path].Delete();
         // 4. re-add the node as the 'real' one
         var result = Project.ProjectProxy.AddFolderItem(path);
         // 5. re-add children nodes
         this[path].SetShowAll(true);
         return(result);
     }
     else
     {
         return(node.ItemId);
     }
 }
Beispiel #10
0
 public PhysicalFolderNode(ItemList items, ItemNode parent, uint itemId, string path)
     : base(items, parent, itemId, Constants.ItemNodeType.PhysicalFolder, path)
 {
 }
Beispiel #11
0
 public SubprojectNode(ItemList items, ItemNode parent, uint itemId, string path)
     : base(items, parent, itemId, Constants.ItemNodeType.SubProject, path)
 {
 }
Beispiel #12
0
 public ShadowFileNode(ItemList items, ItemNode parent, uint itemId, string path)
     : base(items, parent, itemId, Constants.ItemNodeType.PhysicalFile, path)
 {
 }
Beispiel #13
0
 /// <summary>
 /// Initalizes a new instance of the itemlist
 /// </summary>
 /// <param name="project"></param>
 public ItemList(ProjectManager project)
 {
     this.Project   = project;
     root_hierarchy = (IVsHierarchy)project;
     root           = CreateNode(VSConstants.VSITEMID_ROOT);
 }
 public ShadowFileNode(ItemList items, ItemNode parent, uint itemId, string path)
     : base(items, parent, itemId, Constants.ItemNodeType.PhysicalFile, path)
 {
     buildItem = Items.Project.ProjectProxy.GetBuildItem(this);
 }
Beispiel #15
0
 public void AddChild(ItemNode itemNode)
 {
     itemNode.Parent.AddChildNode(itemNode);
 }