add new file and dir to project
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
using Godot;
|
||||
using SharpIDE.Application.Features.FileWatching;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
|
||||
namespace SharpIDE.Godot.Features.SolutionExplorer.ContextMenus.Dialogs;
|
||||
|
||||
@@ -8,7 +8,7 @@ public partial class NewDirectoryDialog : ConfirmationDialog
|
||||
{
|
||||
private LineEdit _nameLineEdit = null!;
|
||||
|
||||
public SharpIdeFolder ParentFolder { get; set; } = null!;
|
||||
public IFolderOrProject ParentFolder { get; set; } = null!;
|
||||
|
||||
[Inject] private readonly IdeFileOperationsService _ideFileOperationsService = null!;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using Godot;
|
||||
using SharpIDE.Application.Features.FileWatching;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery;
|
||||
using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
||||
using SharpIDE.Godot.Features.SolutionExplorer.ContextMenus.Dialogs;
|
||||
|
||||
namespace SharpIDE.Godot.Features.SolutionExplorer;
|
||||
@@ -76,7 +77,7 @@ public partial class SolutionExplorerPanel
|
||||
|
||||
private readonly PackedScene _newDirectoryDialogScene = GD.Load<PackedScene>("uid://bgi4u18y8pt4x");
|
||||
private readonly PackedScene _newCsharpFileDialogScene = GD.Load<PackedScene>("uid://chnb7gmcdg0ww");
|
||||
private void OnCreateNewSubmenuPressed(long id, SharpIdeFolder folder)
|
||||
private void OnCreateNewSubmenuPressed(long id, IFolderOrProject folder)
|
||||
{
|
||||
var actionId = (CreateNewSubmenuOptions)id;
|
||||
if (actionId is CreateNewSubmenuOptions.Directory)
|
||||
|
||||
@@ -11,11 +11,18 @@ namespace SharpIDE.Godot.Features.SolutionExplorer;
|
||||
|
||||
file enum ProjectContextMenuOptions
|
||||
{
|
||||
Run = 0,
|
||||
Build = 1,
|
||||
Rebuild = 2,
|
||||
Clean = 3,
|
||||
Restore = 4
|
||||
CreateNew = 0,
|
||||
Run = 1,
|
||||
Build = 2,
|
||||
Rebuild = 3,
|
||||
Clean = 4,
|
||||
Restore = 5
|
||||
}
|
||||
|
||||
file enum CreateNewSubmenuOptions
|
||||
{
|
||||
Directory = 1,
|
||||
CSharpFile = 2
|
||||
}
|
||||
|
||||
public partial class SolutionExplorerPanel
|
||||
@@ -29,6 +36,13 @@ public partial class SolutionExplorerPanel
|
||||
{
|
||||
var menu = new PopupMenu();
|
||||
AddChild(menu);
|
||||
var createNewSubmenu = new PopupMenu();
|
||||
menu.AddSubmenuNodeItem("Add", createNewSubmenu, (int)ProjectContextMenuOptions.CreateNew);
|
||||
menu.AddSeparator();
|
||||
createNewSubmenu.AddItem("Directory", (int)CreateNewSubmenuOptions.Directory);
|
||||
createNewSubmenu.AddItem("C# File", (int)CreateNewSubmenuOptions.CSharpFile);
|
||||
createNewSubmenu.IdPressed += id => OnCreateNewSubmenuPressed(id, project);
|
||||
|
||||
menu.AddIconItem(_runIcon, "Run", (int)ProjectContextMenuOptions.Run);
|
||||
menu.SetItemIconMaxWidth((int)ProjectContextMenuOptions.Run, 20);
|
||||
menu.AddSeparator();
|
||||
|
||||
Reference in New Issue
Block a user