From f2b248ea6bc2eb9bce1b7b6a0b326a69776d2349 Mon Sep 17 00:00:00 2001 From: Matt Parker <61717342+MattParkerDev@users.noreply.github.com> Date: Sun, 19 Oct 2025 23:09:30 +1000 Subject: [PATCH] add new file menu stub --- .../Features/Common/TreeItemContainer.cs.uid | 1 + .../ContextMenus/FileContextMenu.cs | 2 +- .../ContextMenus/FolderContextMenu.cs | 29 ++++++++++++++++++- 3 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 src/SharpIDE.Godot/Features/Common/TreeItemContainer.cs.uid diff --git a/src/SharpIDE.Godot/Features/Common/TreeItemContainer.cs.uid b/src/SharpIDE.Godot/Features/Common/TreeItemContainer.cs.uid new file mode 100644 index 0000000..9d65947 --- /dev/null +++ b/src/SharpIDE.Godot/Features/Common/TreeItemContainer.cs.uid @@ -0,0 +1 @@ +uid://c3k4fos7lp7oa diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FileContextMenu.cs b/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FileContextMenu.cs index dcf2495..61de879 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FileContextMenu.cs +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FileContextMenu.cs @@ -30,7 +30,7 @@ public partial class SolutionExplorerPanel } else if (actionId is FileContextMenuOptions.RevealInFileExplorer) { - OS.ShellOpen(Path.GetDirectoryName(file.Path)!); + OS.ShellShowInFileManager(file.Path); } else if (actionId is FileContextMenuOptions.CopyFullPath) { diff --git a/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FolderContextMenu.cs b/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FolderContextMenu.cs index c133d42..db4b674 100644 --- a/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FolderContextMenu.cs +++ b/src/SharpIDE.Godot/Features/SolutionExplorer/ContextMenus/FolderContextMenu.cs @@ -5,7 +5,14 @@ namespace SharpIDE.Godot.Features.SolutionExplorer; file enum FolderContextMenuOptions { - RevealInFileExplorer = 1 + CreateNew = 1, + RevealInFileExplorer = 2 +} + +file enum CreateNewSubmenuOptions +{ + Directory = 1, + CSharpFile = 2 } public partial class SolutionExplorerPanel @@ -14,6 +21,13 @@ public partial class SolutionExplorerPanel { var menu = new PopupMenu(); AddChild(menu); + + var createNewSubmenu = new PopupMenu(); + menu.AddSubmenuNodeItem("Add", createNewSubmenu, (int)FolderContextMenuOptions.CreateNew); + createNewSubmenu.AddItem("Directory", (int)CreateNewSubmenuOptions.Directory); + createNewSubmenu.AddItem("C# File", (int)CreateNewSubmenuOptions.CSharpFile); + createNewSubmenu.IdPressed += OnCreateNewSubmenuPressed; + menu.AddItem("Reveal in File Explorer", (int)FolderContextMenuOptions.RevealInFileExplorer); menu.PopupHide += () => menu.QueueFree(); menu.IdPressed += id => @@ -29,4 +43,17 @@ public partial class SolutionExplorerPanel menu.Position = new Vector2I((int)globalMousePosition.X, (int)globalMousePosition.Y); menu.Popup(); } + + private void OnCreateNewSubmenuPressed(long id) + { + var actionId = (CreateNewSubmenuOptions)id; + if (actionId is CreateNewSubmenuOptions.Directory) + { + //OpenCreateNewFolderDialog(folder); + } + else if (actionId is CreateNewSubmenuOptions.CSharpFile) + { + //OpenCreateNewCSharpFileDialog(folder); + } + } } \ No newline at end of file