Esempio n. 1
0
        /// <summary>
        /// Rename Folder
        /// </summary>
        /// <param name="label">new Name of Folder</param>
        /// <returns>VSConstants.S_OK, if succeeded</returns>
        public override int SetEditLabel(string label)
        {
            if (String.Compare(Path.GetFileName(this.Url), label, StringComparison.Ordinal) == 0)
            {
                // Label matches current Name
                return(VSConstants.S_OK);
            }

            // Verify that No Directory/file already exists with the new name (both among current children and non-project items
            for (HierarchyNode n = Parent.FirstChild; n != null; n = n.NextSibling)
            {
                if (n != this && String.Compare(n.Caption, label, true) == 0)
                {
                    //A file or folder with the name '{0}' already exists on disk at this location. Please choose another name.
                    //If this file or folder does not appear in the Solution Explorer, then it is not currently part of your project. To view files which exist on disk, but are not in the project, select Show All Files from the Project menu.
                    throw new InvalidOperationException(SR.GetString(SR.FileOrFolderAlreadyExists, new string[] { label }));
                }
            }

            try
            {
                RenameFolder(label);
                IVsUIShell shell = this.ProjectMgr.GetService(typeof(SVsUIShell)) as IVsUIShell;
                Debug.Assert(shell != null, "Could not get the ui shell from the project");
                ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));
                // Notify the listeners that the name of this folder is changed. This will
                // also force a refresh of the SolutionExplorer's node.
                this.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.RenameFolder), e.Message));
            }
            return(VSConstants.S_OK);
        }
Esempio n. 2
0
        /// <summary>
        /// Renames the file node for a case only change.
        /// </summary>
        /// <param name="newFileName">The new file name.</param>
        private void RenameCaseOnlyChange(string oldName, string newName)
        {
            //Update the include for this item.
            string relName = CommonUtils.GetRelativeFilePath(this.ProjectMgr.ProjectHome, newName);

            Debug.Assert(String.Equals(this.ItemNode.GetMetadata(ProjectFileConstants.Include), relName, StringComparison.OrdinalIgnoreCase),
                         "Not just changing the filename case");

            this.ItemNode.Rename(relName);
            this.ItemNode.RefreshProperties();

            UpdateCaption();
            ProjectMgr.ReDrawNode(this, UIHierarchyElement.Caption);
            this.RenameChildNodes(this);

            // Refresh the property browser.
            IVsUIShell shell = this.ProjectMgr.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Utilities.CheckNotNull(shell, "Could not get the UI shell from the project");

            ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));

            //Select the new node in the hierarchy
            ExpandItem(EXPANDFLAGS.EXPF_SelectItem);
        }
Esempio n. 3
0
        /// <summary>
        /// Renames the file node for a case only change.
        /// </summary>
        /// <param name="newFileName">The new file name.</param>
        private void RenameCaseOnlyChange(string newFileName)
        {
            //Update the include for this item.
            string include = this.ItemNode.Item.UnevaluatedInclude;

            if (String.Compare(include, newFileName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                this.ItemNode.Item.Xml.Include = newFileName;
            }
            else
            {
                string includeDir = Path.GetDirectoryName(include);
                this.ItemNode.Item.Xml.Include = Path.Combine(includeDir, newFileName);
            }
            this.ItemNode.RefreshProperties();

            this.ReDraw(UIHierarchyElement.Caption);
            this.RenameChildNodes(this);

            // Refresh the property browser.
            IVsUIShell shell = this.ProjectMgr.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Debug.Assert(shell != null, "Could not get the ui shell from the project");
            if (shell == null)
            {
                throw new InvalidOperationException();
            }

            shell.RefreshPropertyBrowser(0);

            //Select the new node in the hierarchy
            IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ProjectMgr.Site, SolutionExplorer);

            uiWindow.ExpandItem(this.ProjectMgr.InteropSafeIVsUIHierarchy, this.ID, EXPANDFLAGS.EXPF_SelectItem);
        }
        /// <summary>Hit when the selected item changes in the treeview.</summary>
        /// <param name="sender">trvProject</param>
        /// <param name="e">RoutedPropertyChangedEventArgs</param>
        private void trvProject_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            try
            {
                this.btnNewTask.IsEnabled     = true;
                this.btnAutoRefresh.IsEnabled = true;
                e.Handled = true;
                //If it's a TreeViewArtifact item.
                if (this.trvProject.SelectedItem != null && this.trvProject.SelectedItem.GetType() == typeof(TreeViewArtifact))
                {
                    //Only if it's NOT not a folder.
                    TreeViewArtifact selItem = this.trvProject.SelectedItem as TreeViewArtifact;

                    //Also refresh the properties window
                    if (Pane != null && Pane is toolSpiraExplorer)
                    {
                        //https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.shell.interop.ivsuishell.refreshpropertybrowser(v=vs.120).aspx
                        IVsUIShell shell = ((toolSpiraExplorer)Pane).GetVSService(typeof(SVsUIShell)) as IVsUIShell;
                        if (shell != null)
                        {
                            shell.RefreshPropertyBrowser(-1);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.LogMessage(ex, "trvProject_SelectedItemChanged()");
                MessageBox.Show(StaticFuncs.getCultureResource.GetString("app_General_UnexpectedError"), StaticFuncs.getCultureResource.GetString("app_General_ApplicationShortName"), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Esempio n. 5
0
        /// <summary>
        /// Does the actual work of changing the caption after all of the verifications have been done
        /// that it's Ok to move the file.
        /// </summary>
        /// <param name="newCaption">The new caption.</param>
        /// <param name="newPath">The new absolute path.</param>
        public override void MoveNodeOnCaptionChange(string newCaption, string newPath)
        {
            string     oldPath   = this.AbsolutePath;
            IVsUIShell vsUIShell = (IVsUIShell)this.Hierarchy.ServiceProvider.GetServiceOrThrow(typeof(SVsUIShell), typeof(IVsUIShell), classType, "MoveNodeOnCaptionChange");

            // Tell the environment to stop listening to file change events on the old file.
            using (FileChangeNotificationSuspender notificationSuspender = new FileChangeNotificationSuspender(oldPath))
            {
                // Make sure the environment says we can start the rename.
                if (!this.Hierarchy.AttachedProject.Tracker.CanRenameProject(oldPath, newPath))
                {
                    // If the user chose to not check out the solution file, then we want to throw the
                    // save cancelled HRESULT.
                    throw new COMException("User cancelled the solution file check out.", NativeMethods.OLE_E_PROMPTSAVECANCELLED);
                }

                // Move the file on the file system to match the new name.
                if (File.Exists(oldPath) && !File.Exists(newPath))
                {
                    Tracer.WriteLineInformation(classType, "MoveNodeOnCaptionChange", "Renaming the project file '{0}' to '{1}'.", oldPath, newPath);
                    File.Move(oldPath, newPath);
                }

                // Tell the environment that we're done renaming the document.
                this.Hierarchy.AttachedProject.Tracker.OnProjectRenamed(oldPath, newPath);

                // Update the property browser.
                vsUIShell.RefreshPropertyBrowser(0);
            }
        }
Esempio n. 6
0
        public void RefreshPropertyBrowser()
        {
            IVsUIShell shell = this.GetService(typeof(SVsUIShell)) as IVsUIShell;

            if (shell != null)
            {
                shell.RefreshPropertyBrowser(0);
            }
        }
Esempio n. 7
0
 int IOleComponent.FDoIdle(uint grfidlef)
 {
     if (_vsDesignerControl != null)
     {
         if (_vsDesignerControl.DoIdle())
         {
             IVsUIShell uiShell = ((System.IServiceProvider)_thisPackage).GetService(typeof(SVsUIShell)) as IVsUIShell;
             uiShell.RefreshPropertyBrowser(Utility.OleAutomation.DISPID_UNKNOWN);
         }
     }
     return(VSConstants.S_OK);
 }
Esempio n. 8
0
        /// <summary>
        /// Rename Folder
        /// </summary>
        /// <param name="label">new Name of Folder</param>
        /// <returns>VSConstants.S_OK, if succeeded</returns>
        public override int SetEditLabel(string label)
        {
            if (String.Compare(Path.GetFileName(this.Url.TrimEnd('\\')), label, StringComparison.Ordinal) == 0)
            {
                // Label matches current Name
                return(VSConstants.S_OK);
            }

            string newPath = Path.Combine(new DirectoryInfo(this.Url).Parent.FullName, label);

            if (!NativeMethods.IsSamePath(this.Url.TrimEnd('\\'), newPath))
            {
                // Verify that No Directory/file already exists with the new name among current children
                for (HierarchyNode n = Parent.FirstChild; n != null; n = n.NextSibling)
                {
                    if (n != this && String.Compare(n.Caption, label, StringComparison.OrdinalIgnoreCase) == 0)
                    {
                        return(ShowFileOrFolderAlreadExistsErrorMessage(newPath));
                    }
                }

                // Verify that No Directory/file already exists with the new name on disk
                if (Directory.Exists(newPath) || File.Exists(newPath))
                {
                    return(ShowFileOrFolderAlreadExistsErrorMessage(newPath));
                }
            }

            try
            {
                ThreadHelper.ThrowIfNotOnUIThread();
                RenameFolder(label);

                //Refresh the properties in the properties window
                IVsUIShell shell = this.ProjectMgr.GetService(typeof(SVsUIShell)) as IVsUIShell;
                Debug.Assert(shell != null, "Could not get the ui shell from the project");
                ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));

                // Notify the listeners that the name of this folder is changed. This will
                // also force a refresh of the SolutionExplorer's node.
                this.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.RenameFolder, CultureInfo.CurrentUICulture), e.Message));
            }
            return(VSConstants.S_OK);
        }
Esempio n. 9
0
        /// <summary>
        /// Refreshes the data in the property browser
        /// </summary>
        internal static void RefreshPropertyBrowser()
        {
            IVsUIShell vsuiShell = WixPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

            if (vsuiShell == null)
            {
                string message = WixHelperMethods.SafeStringFormat(CultureInfo.CurrentUICulture, WixStrings.CannotGetService, typeof(IVsUIShell).Name);
                throw new InvalidOperationException(message);
            }
            else
            {
                int hr = vsuiShell.RefreshPropertyBrowser(0);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Refreshes the data in the property browser
        /// </summary>
        internal static void RefreshPropertyBrowser()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            IVsUIShell vsuiShell = AsyncProjectPackage.GetGlobalService(typeof(SVsUIShell)) as IVsUIShell;

            if (vsuiShell == null)
            {
                string message = XHelperMethods.SafeStringFormat(CultureInfo.CurrentUICulture, Resources.GetString(Resources.CannotGetService), typeof(IVsUIShell).Name);
                throw new InvalidOperationException(message);
            }
            else
            {
                int hr = vsuiShell.RefreshPropertyBrowser(0);
                if (hr != 0)
                {
                    Marshal.ThrowExceptionForHR(hr);
                }
            }
        }
Esempio n. 11
0
        /// <summary>
        /// Renames the file node for a case only change.
        /// </summary>
        /// <param name="newFileName">The new file name.</param>
        private void RenameCaseOnlyChange(string newFileName)
        {
            //Update the include for this item.
            string include = this.ItemNode.Item.EvaluatedInclude;

            if (String.Compare(include, newFileName, StringComparison.OrdinalIgnoreCase) == 0)
            {
                this.ItemNode.Item.Xml.Include = newFileName;
            }
            else
            {
                string includeDir = Path.GetDirectoryName(include);
                this.ItemNode.Item.Xml.Include = Path.Combine(includeDir, newFileName);
            }

            this.ItemNode.RefreshProperties();

            this.ReDraw(UIHierarchyElement.Caption);
            this.RenameChildNodes(this);

            // Refresh the property browser.
            IVsUIShell shell = this.ProjectMgr.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;

            Debug.Assert(shell != null, "Could not get the ui shell from the project");
            if (shell == null)
            {
                throw new InvalidOperationException();
            }

            ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));

            //Select the new node in the hierarchy
            IVsUIHierarchyWindow uiWindow = UIHierarchyUtilities.GetUIHierarchyWindow(this.ProjectMgr.Site, SolutionExplorer);

            // This happens in the context of renaming a file by case only (Table.sql -> table.sql)
            // Since we are already in solution explorer, it is extremely unlikely that we get a null return.
            if (uiWindow != null)
            {
                ErrorHandler.ThrowOnFailure(uiWindow.ExpandItem(this.ProjectMgr, this.ID, EXPANDFLAGS.EXPF_SelectItem));
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Implements deferred save support.  Enabled by unchecking Tools->Options->Solutions and Projects->Save New Projects Created.
        ///
        /// In this mode we save the project when the user selects Save All.  We need to move all the files in the project
        /// over to the new location.
        /// </summary>
        public virtual int SaveProjectToLocation(string pszProjectFilename)
        {
            string oldName  = Url;
            string basePath = Path.GetDirectoryName(this.FileName) + Path.DirectorySeparatorChar;
            string newName  = Path.GetDirectoryName(pszProjectFilename);

            // we don't use RenameProjectFile because it sends the OnAfterRenameProject event too soon
            // and causes VS to think the solution has changed on disk.  We need to send it after all
            // updates are complete.

            // save the new project to to disk
            SaveMSBuildProjectFileAs(pszProjectFilename);

            // remove all the children, saving any dirty files, and collecting the list of open files
            MoveFilesForDeferredSave(this, basePath, newName);

            _projectDir = newName;

            // save the project again w/ updated file info
            BuildProject.Save();

            SetProjectFileDirty(false);

            // update VS that we've changed the project
            this.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);

            IVsUIShell  shell      = this.Site.GetService(typeof(SVsUIShell)) as IVsUIShell;
            IVsSolution vsSolution = (IVsSolution)this.GetService(typeof(SVsSolution));

            // Update solution
            ErrorHandler.ThrowOnFailure(vsSolution.OnAfterRenameProject((IVsProject)this, oldName, pszProjectFilename, 0));

            ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));

            return(VSConstants.S_OK);
        }
Esempio n. 13
0
        /// <summary>
        /// Rename Folder
        /// </summary>
        /// <param name="label">new Name of Folder</param>
        /// <returns>VSConstants.S_OK, if succeeded</returns>
        public override int SetEditLabel(string label)
        {
            if (IsBeingCreated)
            {
                return(FinishFolderAdd(label, false));
            }
            else
            {
                if (String.Equals(Path.GetFileName(CommonUtils.TrimEndSeparator(this.Url)), label, StringComparison.Ordinal))
                {
                    // Label matches current Name
                    return(VSConstants.S_OK);
                }

                string newPath = CommonUtils.NormalizeDirectoryPath(Path.Combine(
                                                                        Path.GetDirectoryName(CommonUtils.TrimEndSeparator(this.Url)), label));

                // Verify that No Directory/file already exists with the new name among current children
                var existingChild = Parent.FindImmediateChildByName(label);
                if (existingChild != null && existingChild != this)
                {
                    return(ShowFileOrFolderAlreadyExistsErrorMessage(newPath));
                }

                // Verify that No Directory/file already exists with the new name on disk
                if (Directory.Exists(newPath) || File.Exists(newPath))
                {
                    return(ShowFileOrFolderAlreadyExistsErrorMessage(newPath));
                }

                if (!ProjectMgr.Tracker.CanRenameItem(Url, newPath, VSRENAMEFILEFLAGS.VSRENAMEFILEFLAGS_Directory))
                {
                    return(VSConstants.S_OK);
                }
            }

            try
            {
                var oldTriggerFlag = this.ProjectMgr.EventTriggeringFlag;
                ProjectMgr.EventTriggeringFlag |= ProjectNode.EventTriggering.DoNotTriggerTrackerQueryEvents;
                try
                {
                    RenameFolder(label);
                }
                finally
                {
                    ProjectMgr.EventTriggeringFlag = oldTriggerFlag;
                }


                //Refresh the properties in the properties window
                IVsUIShell shell = this.ProjectMgr.GetService(typeof(SVsUIShell)) as IVsUIShell;
                Utilities.CheckNotNull(shell, "Could not get the UI shell from the project");
                ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));

                // Notify the listeners that the name of this folder is changed. This will
                // also force a refresh of the SolutionExplorer's node.
                ProjectMgr.OnPropertyChanged(this, (int)__VSHPROPID.VSHPROPID_Caption, 0);
            }
            catch (Exception e)
            {
                throw new InvalidOperationException(String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.RenameFolder, CultureInfo.CurrentUICulture), e.Message));
            }
            return(VSConstants.S_OK);
        }
Esempio n. 14
0
        /// <summary>
        /// Does the actual work of changing the caption after all of the verifications have been done
        /// that it's Ok to move the file.
        /// </summary>
        /// <param name="newCaption">The new caption.</param>
        /// <param name="newPath">The new absolute path.</param>
        public override void MoveNodeOnCaptionChange(string newCaption, string newPath)
        {
            string oldPath       = this.AbsolutePath;
            bool   expandNewNode = this.Expanded;
            bool   selected      = this.Selected;

            // Make sure the environment says we can start the rename.
            if (!this.Hierarchy.AttachedProject.Tracker.CanRenameDirectory(oldPath, newPath))
            {
                return;
            }

            // Create the new folder before moving any of the children. Getting the parent is tricky
            // because on recursion this.Parent will point to the same parent and not be remapped
            // to the new location yet. Therefore, we have to use this mechanism to get the right parent.
            FolderNode newParent = (this.Parent.NewNodeOnRename == null ? this.Parent : this.Parent.NewNodeOnRename);
            FolderNode newNode   = this.Hierarchy.CreateAndAddFolder(newParent, newCaption);

            this.NewNodeOnRename = newNode;

            // Iterate through the children and change their hierarchy/file locations.
            // Do it on a cloned collection, however, since the collection will be
            // changing from underneath us. Note that the directory will automatically
            // be created when the first child is moved.
            ArrayList clone = new ArrayList(this.Children);

            foreach (Node child in clone)
            {
                string newChildPath = Path.Combine(newPath, child.Caption);
                child.MoveNodeOnCaptionChange(child.Caption, newChildPath);
            }

            // Move the rest of the files in the old directory to the new one.
            PackageUtility.XMove(oldPath, newPath);

            // Delete the old directory (it should be empty).
            DirectoryInfo oldDir = new DirectoryInfo(oldPath);

            if (oldDir.Exists && oldDir.GetFileSystemInfos().Length == 0)
            {
                oldDir.Delete(true);
            }

            // Remove us from the hierarchy.
            this.RemoveFromProject();

            // Expand and select the new node if we were expanded.
            if (expandNewNode)
            {
                newNode.Expand();
            }

            if (selected)
            {
                newNode.Select();
            }

            // Tell the environment that we're done renaming the document.
            this.Hierarchy.AttachedProject.Tracker.OnDirectoryRenamed(oldPath, newPath);

            // Update the property browser.
            IVsUIShell vsUIShell = (IVsUIShell)this.Hierarchy.ServiceProvider.GetServiceOrThrow(typeof(SVsUIShell), typeof(IVsUIShell), classType, "MoveNodeOnCaptionChange");

            vsUIShell.RefreshPropertyBrowser(0);
        }
Esempio n. 15
0
        /// <summary>
        /// Does the actual work of changing the caption after all of the verifications have been done
        /// that it's Ok to move the file.
        /// </summary>
        /// <param name="newCaption">The new caption.</param>
        /// <param name="newPath">The new absolute path.</param>
        public override void MoveNodeOnCaptionChange(string newCaption, string newPath)
        {
            string oldCaption            = this.Caption;
            string oldPath               = this.AbsolutePath;
            string oldRelativePath       = this.RelativePath;
            bool   updatedWindowCaptions = false;
            bool   removedNode           = false;
            Node   newNode               = null;

            // If we are currently selected, cache the value so we can restore the selection
            // after the addition.
            bool wasSelected = this.Selected;

            // Tell the environment to stop listening to file change events on the old file.
            using (FileChangeNotificationSuspender notificationSuspender = new FileChangeNotificationSuspender(oldPath))
            {
                // Make sure the environment says we can start the rename.
                if (!this.Hierarchy.AttachedProject.Tracker.CanRenameFile(oldPath, newPath))
                {
                    return;
                }

                // Move the file on the file system to match the new name.
                if (!this.IsVirtual && File.Exists(oldPath) && !File.Exists(newPath))
                {
                    Tracer.WriteLineInformation(classType, "MoveNodeOnCaptionChange", "Renaming the file '{0}' to '{1}'.", oldPath, newPath);
                    string newDirectoryName = Path.GetDirectoryName(newPath);
                    if (!Directory.Exists(newDirectoryName))
                    {
                        Directory.CreateDirectory(newDirectoryName);
                    }
                    File.Move(oldPath, newPath);
                }

                try
                {
                    // Update all of the windows that currently have this file opened in an editor.
                    this.UpdateOpenWindowCaptions(newCaption);
                    updatedWindowCaptions = true;

                    // We have to remove the node and re-add it so that we can have the sorting preserved.
                    // Also, if the extension has changed then we'll have to recreate a new type-specific
                    // FileNode. The easy way is to remove ourself from the project then tell the project
                    // to add an existing file.

                    string newRelativePath = PackageUtility.MakeRelative(this.Hierarchy.RootNode.AbsoluteDirectory, newPath);

                    // Remove ourself from the hierarchy.
                    this.Parent.Children.Remove(this);
                    removedNode = true;

                    // We have now been removed from the hierarchy. Do NOT call any virtual methods or
                    // methods that depend on our state after this point.

                    // Re-add ourself as a new incarnation (different object). Our life ends here.
                    newNode = this.Hierarchy.AddExistingFile(newRelativePath, true);

                    if (newNode != null)
                    {
                        // We need to set our hierarchy Id to match the new hierachy Id in case Visual Studio
                        // calls back into us for something.
                        this.SetHierarchyId(newNode.HierarchyId);

                        // Select the new node if we were previously selected.
                        if (wasSelected)
                        {
                            newNode.Select();
                        }

                        // Tell the RDT to rename the document.
                        Context.RunningDocumentTable.RenameDocument(oldPath, newPath, newNode.HierarchyId);
                    }
                }
                catch (Exception e)
                {
                    if (ErrorUtility.IsExceptionUnrecoverable(e))
                    {
                        throw;
                    }

                    // Rollback the file move
                    Tracer.WriteLineWarning(classType, "MoveNodeOnCaptionChange", "There was an error in renaming the document. Exception: {0}", e);
                    File.Move(newPath, oldPath);

                    // Remove the node that we just added.
                    if (newNode != null)
                    {
                        newNode.RemoveFromProject();
                    }

                    // Re-add a new node since we've already removed the old node.
                    if (removedNode || this.Parent == null)
                    {
                        newNode = this.Hierarchy.AddExistingFile(oldRelativePath, true);
                        this.SetHierarchyId(newNode.HierarchyId);
                        if (wasSelected)
                        {
                            newNode.Select();
                        }
                    }

                    // Rollback the caption update on open windows
                    if (updatedWindowCaptions)
                    {
                        this.UpdateOpenWindowCaptions(oldCaption);
                    }

                    // Rethrow the exception
                    throw;
                }

                // Tell the environment that we're done renaming the document.
                this.Hierarchy.AttachedProject.Tracker.OnFileRenamed(oldPath, newPath);

                // Update the property browser.
                IVsUIShell vsUIShell = (IVsUIShell)this.Hierarchy.ServiceProvider.GetServiceOrThrow(typeof(SVsUIShell), typeof(IVsUIShell), classType, "MoveNodeOnCaptionChange");
                vsUIShell.RefreshPropertyBrowser(0);
            }
        }
Esempio n. 16
0
        internal static void RefreshPropertyBrowser(HierarchyNode node)
        {
            IVsUIShell shell = (IVsUIShell)node.ProjectMgr.GetService(typeof(IVsUIShell));

            ErrorHandler.ThrowOnFailure(shell.RefreshPropertyBrowser(0));
        }