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...")) if (ImGui.MenuItem("Open C# Project..."))
{ {
Editor.Instance.IdeAdapter.OpenScriptProject(); Editor.Instance.OpenScriptProject();
} }
ImGui.AttachTooltip("Opens the C# Solution of this project."); 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. // Special treatment for scripts, open them in Visual Studio.
if (entry->Path.EndsWith(".cs")) if (entry->Path.EndsWith(".cs"))
{ {
Editor.Instance.IdeAdapter.OpenScript(entry->Path); Editor.Instance.OpenScript(entry->Path);
} }
else if (Path.OpenFolder(entry->Path) case .Err) else if (Path.OpenFolder(entry->Path) case .Err)
Log.EngineLogger.Error("Failed to open file."); Log.EngineLogger.Error("Failed to open file.");
+25 -7
View File
@@ -178,16 +178,11 @@ namespace GlitchyEditor
_settingsWindow.Open = true; _settingsWindow.Open = true;
} }
/// Wrapper for IdeAdapter.OpenScript that check whether or not an IDE Adapter is configured. private void OpenIdeConfigurationPopup() {
/// 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) => { PopupService.Instance.OpenPopup("No IDE configured.", new (close) => {
close = false; close = false;
ImGui.TextUnformatted("In order to open a source file you need to configure an IDE to use."); 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...")) if (ImGui.Button("Go to settings..."))
{ {
@@ -204,10 +199,33 @@ namespace GlitchyEditor
} }
}); });
} }
/// 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)
{
OpenIdeConfigurationPopup();
}
else else
{ {
IdeAdapter.OpenScript(fileName, lineNumber, columnNumber); 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();
}
}
} }
} }