Skip to content
This repository was archived by the owner on Sep 11, 2023. It is now read-only.

Commit ba9c5ca

Browse files
committed
fixed program not updating renamed opened file
1 parent b1703c2 commit ba9c5ca

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

UI/MainWindow/MainWindow.xaml.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -447,8 +447,11 @@ public bool TryLoadSourceFile(string filePath, out EditorElement outEditor, bool
447447
/// <param name="SelectMe">Whether to focus this editor element once created.</param>
448448
private void AddEditorElement(FileInfo fInfo, string editorTitle, bool SelectMe, out EditorElement editor)
449449
{
450-
var layoutDocument = new LayoutDocument { Title = editorTitle };
451-
layoutDocument.ToolTip = fInfo.FullName;
450+
var layoutDocument = new LayoutDocument
451+
{
452+
Title = editorTitle,
453+
ToolTip = fInfo.FullName
454+
};
452455
editor = new EditorElement(fInfo.FullName) { Parent = layoutDocument };
453456
layoutDocument.Content = editor;
454457
EditorReferences.Add(editor);

UI/MainWindow/MainWindowObjectBrowser.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,16 @@ private void OBItemRename_Click(object sender, RoutedEventArgs e)
164164
fileTag.Value = newFileInfo.FullName;
165165
file.Header = BuildTreeViewItemContent(renameWindow.NewName, FileIcons[newFileInfo.Extension]);
166166
}
167+
168+
// Update file if opened by SPCode
169+
foreach (var editor in EditorReferences)
170+
{
171+
if (editor.FullFilePath == oldFileInfo.FullName)
172+
{
173+
editor.FullFilePath = newFileInfo.FullName;
174+
}
175+
}
176+
UpdateWindowTitle();
167177
}
168178
}
169179
catch (Exception ex)

0 commit comments

Comments
 (0)