예제 #1
0
        int IProjectSourceNode.IncludeInProject(bool recursive)
        {
            if (ProjectMgr == null || ProjectMgr.IsClosed)
            {
                return((int)OleConstants.OLECMDERR_E_NOTSUPPORTED);
            }

            if (!IsNonMemberItem)
            {
                return(VSConstants.S_OK);                // do nothing, just ignore it.
            }
            ((NemerlePackage)ProjectMgr.Package).SetWaitCursor();

            // Check out the project file.
            if (!ProjectMgr.QueryEditProjectFile(false))
            {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
            }

            // make sure that all parent folders are included in the project
            HierarchyHelpers.EnsureParentFolderIncluded(this);

            // now add this node to the project.
            AddToMSBuild(recursive);
            ReDraw(UIHierarchyElement.Icon);

            HierarchyHelpers.RefreshPropertyBrowser(this);

            return(VSConstants.S_OK);
        }
예제 #2
0
        int IProjectSourceNode.IncludeInProject()
        {
            NemerleProjectNode projectNode = ProjectMgr as NemerleProjectNode;

            if (projectNode == null || projectNode.IsClosed)
            {
                return((int)OleConstants.OLECMDERR_E_NOTSUPPORTED);
            }

            if (!IsNonMemberItem)
            {
                return(VSConstants.S_OK);
            }

            ((NemerlePackage)ProjectMgr.Package).SetWaitCursor();

            // Check out the project file.
            if (!projectNode.QueryEditProjectFile(false))
            {
                throw Marshal.GetExceptionForHR(VSConstants.OLE_E_PROMPTSAVECANCELLED);
            }

            HierarchyHelpers.EnsureParentFolderIncluded(this);

            SetProperty((int)__VSHPROPID.VSHPROPID_IsNonMemberItem, false);

            ItemNode = projectNode.CreateMsBuildFileProjectElement(Url);
            ProjectMgr.Tracker.OnItemAdded(Url, VSADDFILEFLAGS.VSADDFILEFLAGS_NoFlags);

            var proj = ProjectInfo.FindProject(ProjectMgr);

            if (proj != null)
            {
                proj.AddSource(this.Url);
            }

            //projectNode.OnItemAdded(Parent, this);

            ReDraw(UIHierarchyElement.Icon);             // We have to redraw the icon of the node as it is now a member of the project and should be drawn using a different icon.
            ReDraw(UIHierarchyElement.SccState);         // update the SCC state icon.

            ResetProperties();

            HierarchyHelpers.RefreshPropertyBrowser(this);

            return(VSConstants.S_OK);
        }