Skip to content

Commit

Permalink
Added support for copying stripped name.
Browse files Browse the repository at this point in the history
  • Loading branch information
vchelaru committed Apr 28, 2024
1 parent 990e3b5 commit aeee4a6
Showing 1 changed file with 24 additions and 6 deletions.
30 changes: 24 additions & 6 deletions FRBDK/Glue/Glue/FormHelpers/RightClickHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -834,15 +834,31 @@ private static void PopulateRightClickMenuItemsShared(ITreeNode targetNode, Menu
Add(L.Texts.ViewInExplorer, () => RightClickHelper.ViewInExplorerClick(targetNode));
Add(L.Texts.Open, () => HandleOpen(targetNode));
AddItem(mFindAllReferences);
Add(L.Texts.CopyPathClipboard, () => HandleCopyToClipboardClick(targetNode));

var rfs = targetNode.Tag as ReferencedFileSave;
var name = rfs.GetInstanceName();
Add($"Copy Code Instance Name ({name})", () =>

var topLevelCopyNameItem = Add("Copy Name...", () => { });
{
Clipboard.SetText(name);
var oldList = ListToAddTo;
ListToAddTo = topLevelCopyNameItem.DropDownItems;

Add(L.Texts.CopyPathClipboard, () => HandleCopyToClipboardClick(targetNode));
var name = rfs.GetInstanceName();
Add($"Copy Code Instance Name ({name})", () =>
{
Clipboard.SetText(name);
});
});

var strippedName = FileManager.RemovePath(FileManager.RemoveExtension(rfs.Name));
Add($"Copy Stripped Name ({strippedName})", () =>
{
Clipboard.SetText(strippedName);
});

ListToAddTo = oldList;
}
AddSeparator();

AddItem(mCreateZipPackage);
Expand Down Expand Up @@ -1069,7 +1085,7 @@ public static List<GeneralToolStripMenuItem> GetRightClickItems(ITreeNode target

#region Utility Methods

static void Add(string text, Action action, string shortcutDisplay = null, System.Windows.Controls.Image image = null)
static GeneralToolStripMenuItem Add(string text, Action action, string shortcutDisplay = null, System.Windows.Controls.Image image = null)
{
if (ListToAddTo != null)
{
Expand All @@ -1083,6 +1099,8 @@ static void Add(string text, Action action, string shortcutDisplay = null, Syste
item.Image = image;

ListToAddTo.Add(item);

return item;
}
else
{
Expand Down

0 comments on commit aeee4a6

Please sign in to comment.