mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-11-04 12:51:48 +00:00
Show popup when trying to open script project with no IDE selected
This commit is contained in:
@@ -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.");
|
||||||
|
|||||||
+37
-19
@@ -178,36 +178,54 @@ namespace GlitchyEditor
|
|||||||
_settingsWindow.Open = true;
|
_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.
|
/// Wrapper for IdeAdapter.OpenScript that check whether or not an IDE Adapter is configured.
|
||||||
/// If not, a popup will be show.
|
/// If not, a popup will be show.
|
||||||
public void OpenScript(StringView fileName, int lineNumber = 0, int columnNumber = 0)
|
public void OpenScript(StringView fileName, int lineNumber = 0, int columnNumber = 0)
|
||||||
{
|
{
|
||||||
if (IdeAdapter == null)
|
if (IdeAdapter == null)
|
||||||
{
|
{
|
||||||
PopupService.Instance.OpenPopup("No IDE configured.", new (close) => {
|
OpenIdeConfigurationPopup();
|
||||||
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;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user