Show popup when trying to open script project with no IDE selected

This commit is contained in:
Simon Lübeß
2026-10-21 13:24:34 +02:00
parent 8341097b7e
commit a664dc2047
2 changed files with 39 additions and 21 deletions
@@ -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.");
+37 -19
View File
@@ -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();
}
}
}
}