Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Common/Product/SharedProject/FileNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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);
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions Common/Product/SharedProject/FolderNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()));
}
}
}
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -515,7 +515,7 @@ private int ShowFileOrFolderAlreadyExistsErrorMessage(string newPath) {
protected override void OnCancelLabelEdit() {
if (IsBeingCreated) {
// finish the creation
FinishFolderAdd(GetEditLabel(), true);
FinishFolderAdd(GetItemName(), true);
}
}

Expand Down
16 changes: 12 additions & 4 deletions Common/Product/SharedProject/HierarchyNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -874,6 +874,14 @@ public virtual int SetEditLabel(string label) {
/// </summary>
/// <returns>the node cation</returns>
public virtual string GetEditLabel() {
return GetItemName();
}

/// <summary>
/// Returns the underlying file or directory name based on the Url.
/// </summary>
/// <returns></returns>
public string GetItemName() {
return CommonUtils.GetFileOrDirectoryName(Url);
}

Expand Down Expand Up @@ -1000,7 +1008,7 @@ internal void RemoveNonDocument(bool removeFromStorage) {
/// </summary>
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];
}

Expand All @@ -1010,7 +1018,7 @@ public virtual string GetRelationalName() {
/// </summary>
/// <returns>The extension</returns>
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));
}

/// <summary>
Expand Down
12 changes: 6 additions & 6 deletions Common/Product/SharedProject/NodeProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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());
}
}

Expand Down Expand Up @@ -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();
Expand All @@ -461,7 +461,7 @@ public class DependentFileNodeProperties : NodeProperties {
[SRDescriptionAttribute(SR.FileNameDescription)]
public virtual string FileName {
get {
return this.HierarchyNode.GetEditLabel();
return this.HierarchyNode.GetItemName();
}
}

Expand Down Expand Up @@ -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(() => {
Expand All @@ -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(() => {
Expand Down
2 changes: 1 addition & 1 deletion Common/Product/SharedProject/ProjectNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
6 changes: 0 additions & 6 deletions Nodejs/Product/Nodejs/Project/NodejsFileNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down