summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs30
1 files changed, 25 insertions, 5 deletions
diff --git a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
index c267d32f5a..f50803af95 100644
--- a/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
+++ b/modules/mono/editor/GodotTools/GodotTools/GodotSharpEditor.cs
@@ -35,6 +35,7 @@ namespace GodotTools
private PopupMenu _menuPopup;
private AcceptDialog _errorDialog;
+ private ConfirmationDialog _confirmCreateSlnDialog;
private Button _bottomPanelBtn;
private Button _toolBarBuildButton;
@@ -99,7 +100,7 @@ namespace GodotTools
pr.Step("Done".TTR());
// Here, after all calls to progress_task_step
- CallDeferred(nameof(_RemoveCreateSlnMenuOption));
+ CallDeferred(nameof(_ShowDotnetFeatures));
}
else
{
@@ -110,9 +111,8 @@ namespace GodotTools
}
}
- private void _RemoveCreateSlnMenuOption()
+ private void _ShowDotnetFeatures()
{
- _menuPopup.RemoveItem(_menuPopup.GetItemIndex((int)MenuOptions.CreateSln));
_bottomPanelBtn.Show();
_toolBarBuildButton.Show();
}
@@ -122,8 +122,17 @@ namespace GodotTools
switch ((MenuOptions)id)
{
case MenuOptions.CreateSln:
- CreateProjectSolution();
+ {
+ if (File.Exists(GodotSharpDirs.ProjectSlnPath) || File.Exists(GodotSharpDirs.ProjectCsProjPath))
+ {
+ ShowConfirmCreateSlnDialog();
+ }
+ else
+ {
+ CreateProjectSolution();
+ }
break;
+ }
case MenuOptions.SetupGodotNugetFallbackFolder:
{
try
@@ -169,6 +178,13 @@ namespace GodotTools
_errorDialog.PopupCentered();
}
+ public void ShowConfirmCreateSlnDialog()
+ {
+ _confirmCreateSlnDialog.Title = "C# solution already exists. This will override the existing C# project file, any manual changes will be lost.".TTR();
+ _confirmCreateSlnDialog.DialogText = "Create C# solution".TTR();
+ _confirmCreateSlnDialog.PopupCentered();
+ }
+
private static string _vsCodePath = string.Empty;
private static readonly string[] VsCodeNames =
@@ -420,6 +436,10 @@ namespace GodotTools
_errorDialog = new AcceptDialog();
editorBaseControl.AddChild(_errorDialog);
+ _confirmCreateSlnDialog = new ConfirmationDialog();
+ _confirmCreateSlnDialog.Confirmed += () => CreateProjectSolution();
+ editorBaseControl.AddChild(_confirmCreateSlnDialog);
+
MSBuildPanel = new MSBuildPanel();
MSBuildPanel.Ready += () =>
MSBuildPanel.BuildOutputView.BuildStateChanged += BuildStateChanged;
@@ -453,8 +473,8 @@ namespace GodotTools
{
_bottomPanelBtn.Hide();
_toolBarBuildButton.Hide();
- _menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln);
}
+ _menuPopup.AddItem("Create C# solution".TTR(), (int)MenuOptions.CreateSln);
_menuPopup.IdPressed += _MenuOptionPressed;