support adding bookmarks to files that may not have Editor.ObjectModel.Accessor set for whatever reason

This commit is contained in:
Michael Becker 2020-05-15 05:15:13 -04:00
parent f884365c95
commit 6becb6054a
No known key found for this signature in database
GPG Key ID: 506F54899E2BFED7

View File

@ -511,11 +511,13 @@ namespace UniversalEditor.UserInterface
Editor ed = LastWindow.GetCurrentEditor();
if (ed == null) return;
Accessor acc = ed.ObjectModel?.Accessor ?? (ed.Parent as Pages.EditorPage)?.Document?.Accessor;
// we cannot yet bookmark a file that does not yet exist. (this would be akin to creating a shortcut to a template I guess...?)
if (ed.ObjectModel.Accessor == null) return;
if (acc == null) return;
// FIXME: BookmarksAdd copypasta
string filename = ed.ObjectModel.Accessor.GetFileName();
string filename = acc.GetFileName();
BookmarksManager.FileNames.Add(filename);
Command cmdBookmarks = Application.Commands["Bookmarks"];