protected virtual void RenameCaseOnlyChange(string newFileName)
{
//Update the include for this item.
string include = this.ItemNode.Item.EvaluatedInclude;
if(String.Equals(include, newFileName, StringComparison.OrdinalIgnoreCase))
{
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(UIHierarchyElements.Caption);
this.RenameChildNodes(this);
// Refresh the property browser.
IVsUIShell shell = this.ProjectManager.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.ProjectManager.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.ProjectManager.InteropSafeIVsUIHierarchy, this.Id, EXPANDFLAGS.EXPF_SelectItem));
}
}