From a664dc20472b08126ad23d9f67cf8f2c0e6ac08e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Simon=20L=C3=BCbe=C3=9F?= Date: Wed, 21 Oct 2026 13:24:34 +0200 Subject: [PATCH] Show popup when trying to open script project with no IDE selected --- .../src/EditWindows/ContentBrowserWindow.bf | 4 +- GlitchyEditor/src/Editor.bf | 56 ++++++++++++------- 2 files changed, 39 insertions(+), 21 deletions(-) diff --git a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf index d99815e..92c20a3 100644 --- a/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf +++ b/GlitchyEditor/src/EditWindows/ContentBrowserWindow.bf @@ -604,7 +604,7 @@ namespace GlitchyEditor.EditWindows if (ImGui.MenuItem("Open C# Project...")) { - Editor.Instance.IdeAdapter.OpenScriptProject(); + Editor.Instance.OpenScriptProject(); } ImGui.AttachTooltip("Opens the C# Solution of this project."); @@ -1434,7 +1434,7 @@ namespace GlitchyEditor.EditWindows // Special treatment for scripts, open them in Visual Studio. if (entry->Path.EndsWith(".cs")) { - Editor.Instance.IdeAdapter.OpenScript(entry->Path); + Editor.Instance.OpenScript(entry->Path); } else if (Path.OpenFolder(entry->Path) case .Err) Log.EngineLogger.Error("Failed to open file."); diff --git a/GlitchyEditor/src/Editor.bf b/GlitchyEditor/src/Editor.bf index 3226ac2..0878b86 100644 --- a/GlitchyEditor/src/Editor.bf +++ b/GlitchyEditor/src/Editor.bf @@ -178,36 +178,54 @@ namespace GlitchyEditor _settingsWindow.Open = true; } + private void OpenIdeConfigurationPopup() { + PopupService.Instance.OpenPopup("No IDE configured.", new (close) => { + close = false; + + ImGui.TextUnformatted("In order to open a source file or the script project you need to configure an IDE to use."); + + if (ImGui.Button("Go to settings...")) + { + ShowSettings(); + SettingsWindow.HighlightSetting("Tools", "ide"); + close = true; + } + + ImGui.SameLine(); + + if (ImGui.Button("Cancel")) + { + close = true; + } + }); + } + /// Wrapper for IdeAdapter.OpenScript that check whether or not an IDE Adapter is configured. /// If not, a popup will be show. public void OpenScript(StringView fileName, int lineNumber = 0, int columnNumber = 0) { if (IdeAdapter == null) { - PopupService.Instance.OpenPopup("No IDE configured.", new (close) => { - close = false; - - ImGui.TextUnformatted("In order to open a source file you need to configure an IDE to use."); - - if (ImGui.Button("Go to settings...")) - { - ShowSettings(); - SettingsWindow.HighlightSetting("Tools", "ide"); - close = true; - } - - ImGui.SameLine(); - - if (ImGui.Button("Cancel")) - { - close = true; - } - }); + OpenIdeConfigurationPopup(); } else { IdeAdapter.OpenScript(fileName, lineNumber, columnNumber); } } + + /// Wrapper for IdeAdapter.OpenScript that check whether or not an IDE Adapter is configured. + /// If not, a popup will be show. + public void OpenScriptProject() + { + if (IdeAdapter == null) + { + OpenIdeConfigurationPopup(); + } + else + { + IdeAdapter.OpenScriptProject(); + } + } } }