diff --git a/Common/Product/SharedProject/FileNode.cs b/Common/Product/SharedProject/FileNode.cs
index ef442974e..1c667f53b 100644
--- a/Common/Product/SharedProject/FileNode.cs
+++ b/Common/Product/SharedProject/FileNode.cs
@@ -287,7 +287,7 @@ public override int SetEditLabel(string label) {
for (HierarchyNode n = this.Parent.FirstChild; n != null; n = n.NextSibling) {
// TODO: Distinguish between real Urls and fake ones (eg. "References")
- if (n != this && String.Equals(n.GetEditLabel(), label, StringComparison.OrdinalIgnoreCase)) {
+ if (n != this && String.Equals(n.GetItemName(), label, StringComparison.OrdinalIgnoreCase)) {
//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, label));
@@ -318,7 +318,7 @@ public override int SetEditLabel(string label) {
// where we get called is when a folder above us gets renamed (in which case our path is invalid)
HierarchyNode parent = this.Parent;
while (parent != null && (parent is FolderNode)) {
- strRelPath = Path.Combine(parent.GetEditLabel(), strRelPath);
+ strRelPath = Path.Combine(parent.GetItemName(), strRelPath);
parent = parent.Parent;
}
@@ -614,7 +614,7 @@ public override object GetProperty(int propId) {
public virtual string FileName {
get {
- return this.GetEditLabel();
+ return this.GetItemName();
}
set {
this.SetEditLabel(value);
@@ -630,7 +630,7 @@ internal protected virtual bool IsFileOnDisk(bool showMessage) {
bool fileExist = IsFileOnDisk(this.Url);
if (!fileExist && showMessage && !Utilities.IsInAutomationFunction(this.ProjectMgr.Site)) {
- string message = SR.GetString(SR.ItemDoesNotExistInProjectDirectory, GetEditLabel());
+ string message = SR.GetString(SR.ItemDoesNotExistInProjectDirectory, GetItemName());
string title = string.Empty;
OLEMSGICON icon = OLEMSGICON.OLEMSGICON_CRITICAL;
OLEMSGBUTTON buttons = OLEMSGBUTTON.OLEMSGBUTTON_OK;
@@ -726,7 +726,7 @@ protected virtual void RenameChildNodes(FileNode parentNode) {
newfilename = relationalName + extension;
newfilename = CommonUtils.GetAbsoluteFilePath(Path.GetDirectoryName(childNode.Parent.GetMkDocument()), newfilename);
} else {
- newfilename = CommonUtils.GetAbsoluteFilePath(Path.GetDirectoryName(childNode.Parent.GetMkDocument()), childNode.GetEditLabel());
+ newfilename = CommonUtils.GetAbsoluteFilePath(Path.GetDirectoryName(childNode.Parent.GetMkDocument()), childNode.GetItemName());
}
childNode.RenameDocument(childNode.GetMkDocument(), newfilename);
diff --git a/Common/Product/SharedProject/FolderNode.cs b/Common/Product/SharedProject/FolderNode.cs
index fc4794e1a..c15033147 100644
--- a/Common/Product/SharedProject/FolderNode.cs
+++ b/Common/Product/SharedProject/FolderNode.cs
@@ -211,7 +211,7 @@ private int FinishFolderAdd(string label, bool wasCancelled) {
return VSConstants.E_FAIL;
}
- if (filename == GetEditLabel() || Parent.FindImmediateChildByName(filename) == null) {
+ if (filename == GetItemName() || Parent.FindImmediateChildByName(filename) == null) {
if (ProjectMgr.QueryFolderAdd(Parent, path)) {
Directory.CreateDirectory(path);
IsBeingCreated = false;
@@ -358,7 +358,7 @@ public virtual void DeleteFolder(string path) {
}
} catch (IOException ioEx) {
// re-throw with a friendly path
- throw new IOException(ioEx.Message.Replace(path, GetEditLabel()));
+ throw new IOException(ioEx.Message.Replace(path, GetItemName()));
}
}
}
@@ -455,7 +455,7 @@ public virtual void RenameFolder(string newName) {
if (node == null) {
child.SetEditLabel(child.GetEditLabel());
} else {
- node.RenameFolder(node.GetEditLabel());
+ node.RenameFolder(node.GetItemName());
}
}
} finally {
@@ -515,7 +515,7 @@ private int ShowFileOrFolderAlreadyExistsErrorMessage(string newPath) {
protected override void OnCancelLabelEdit() {
if (IsBeingCreated) {
// finish the creation
- FinishFolderAdd(GetEditLabel(), true);
+ FinishFolderAdd(GetItemName(), true);
}
}
diff --git a/Common/Product/SharedProject/HierarchyNode.cs b/Common/Product/SharedProject/HierarchyNode.cs
index 42fbd45c2..113b7c032 100644
--- a/Common/Product/SharedProject/HierarchyNode.cs
+++ b/Common/Product/SharedProject/HierarchyNode.cs
@@ -590,7 +590,7 @@ public virtual object GetProperty(int propId) {
break;
case __VSHPROPID.VSHPROPID_Name:
- result = this.GetEditLabel();
+ result = this.GetItemName();
break;
case __VSHPROPID.VSHPROPID_ExpandByDefault:
@@ -686,7 +686,7 @@ public virtual object GetProperty(int propId) {
case __VSHPROPID.VSHPROPID_SaveName:
//SaveName is the name shown in the Save and the Save Changes dialog boxes.
- result = this.GetEditLabel();
+ result = this.GetItemName();
break;
case __VSHPROPID.VSHPROPID_ExtObject:
@@ -874,6 +874,14 @@ public virtual int SetEditLabel(string label) {
///
/// the node cation
public virtual string GetEditLabel() {
+ return GetItemName();
+ }
+
+ ///
+ /// Returns the underlying file or directory name based on the Url.
+ ///
+ ///
+ public string GetItemName() {
return CommonUtils.GetFileOrDirectoryName(Url);
}
@@ -1000,7 +1008,7 @@ internal void RemoveNonDocument(bool removeFromStorage) {
///
public virtual string GetRelationalName() {
//Get the first part of the caption
- string[] partsOfParent = this.GetEditLabel().Split(new string[] { this.NameRelationSeparator }, StringSplitOptions.None);
+ string[] partsOfParent = this.GetItemName().Split(new string[] { this.NameRelationSeparator }, StringSplitOptions.None);
return partsOfParent[0];
}
@@ -1010,7 +1018,7 @@ public virtual string GetRelationalName() {
///
/// The extension
public virtual string GetRelationNameExtension() {
- return this.GetEditLabel().Substring(this.GetEditLabel().IndexOf(this.NameRelationSeparator, StringComparison.Ordinal));
+ return this.GetItemName().Substring(this.GetItemName().IndexOf(this.NameRelationSeparator, StringComparison.Ordinal));
}
///
diff --git a/Common/Product/SharedProject/NodeProperties.cs b/Common/Product/SharedProject/NodeProperties.cs
index 16445bccf..48fe415b9 100644
--- a/Common/Product/SharedProject/NodeProperties.cs
+++ b/Common/Product/SharedProject/NodeProperties.cs
@@ -246,7 +246,7 @@ public class FileNodeProperties : NodeProperties {
[AlwaysSerialized]
public virtual string FileName {
get {
- return this.HierarchyNode.GetEditLabel();
+ return this.HierarchyNode.GetItemName();
}
set {
this.HierarchyNode.SetEditLabel(value);
@@ -274,7 +274,7 @@ public string URL {
[Browsable(false)]
public string Extension {
get {
- return Path.GetExtension(this.HierarchyNode.GetEditLabel());
+ return Path.GetExtension(this.HierarchyNode.GetItemName());
}
}
@@ -444,7 +444,7 @@ public string ItemType {
[ReadOnly(true)]
public override string FileName {
get {
- return this.HierarchyNode.GetEditLabel();
+ return this.HierarchyNode.GetItemName();
}
set {
throw new InvalidOperationException();
@@ -461,7 +461,7 @@ public class DependentFileNodeProperties : NodeProperties {
[SRDescriptionAttribute(SR.FileNameDescription)]
public virtual string FileName {
get {
- return this.HierarchyNode.GetEditLabel();
+ return this.HierarchyNode.GetItemName();
}
}
@@ -728,7 +728,7 @@ public class FolderNodeProperties : NodeProperties {
[SRDescriptionAttribute(SR.FolderNameDescription)]
public string FolderName {
get {
- return this.HierarchyNode.GetEditLabel();
+ return this.HierarchyNode.GetItemName();
}
set {
HierarchyNode.ProjectMgr.Site.GetUIThread().Invoke(() => {
@@ -743,7 +743,7 @@ public string FolderName {
[AutomationBrowsable(true)]
public string FileName {
get {
- return this.HierarchyNode.GetEditLabel();
+ return this.HierarchyNode.GetItemName();
}
set {
HierarchyNode.ProjectMgr.Site.GetUIThread().Invoke(() => {
diff --git a/Common/Product/SharedProject/ProjectNode.cs b/Common/Product/SharedProject/ProjectNode.cs
index 7d3bd0690..1ba831071 100644
--- a/Common/Product/SharedProject/ProjectNode.cs
+++ b/Common/Product/SharedProject/ProjectNode.cs
@@ -4306,7 +4306,7 @@ public virtual int GenerateUniqueItemName(uint itemIdLoc, string ext, string sug
continue;
}
- if (parent.AllChildren.Any(n => candidate == n.GetEditLabel())) {
+ if (parent.AllChildren.Any(n => candidate == n.GetItemName())) {
// Cannot create a node if one exists with the same name.
continue;
}
diff --git a/Nodejs/Product/Nodejs/Project/NodejsFileNode.cs b/Nodejs/Product/Nodejs/Project/NodejsFileNode.cs
index 506402679..104ae526d 100644
--- a/Nodejs/Product/Nodejs/Project/NodejsFileNode.cs
+++ b/Nodejs/Product/Nodejs/Project/NodejsFileNode.cs
@@ -188,12 +188,6 @@ internal override void RenameInStorage(string oldName, string newName) {
}
}
- public override int SetEditLabel(string label) {
- var res = base.SetEditLabel(label);
-
- return res;
- }
-
public new NodejsProjectNode ProjectMgr {
get {
return (NodejsProjectNode)base.ProjectMgr;