Get code editor name through CodeEditingManager
This commit is contained in:
@@ -22,52 +22,7 @@ namespace FlaxEditor.Modules.SourceCodeEditing
|
|||||||
public InBuildSourceCodeEditor(CodeEditorTypes type)
|
public InBuildSourceCodeEditor(CodeEditorTypes type)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
switch (type)
|
Name = CodeEditingManager.GetName(type);
|
||||||
{
|
|
||||||
case CodeEditorTypes.Custom:
|
|
||||||
Name = "Custom";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.SystemDefault:
|
|
||||||
Name = "System Default";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2008:
|
|
||||||
Name = "Visual Studio 2008";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2010:
|
|
||||||
Name = "Visual Studio 2010";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2012:
|
|
||||||
Name = "Visual Studio 2012";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2013:
|
|
||||||
Name = "Visual Studio 2013";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2015:
|
|
||||||
Name = "Visual Studio 2015";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2017:
|
|
||||||
Name = "Visual Studio 2017";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2019:
|
|
||||||
Name = "Visual Studio 2019";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2022:
|
|
||||||
Name = "Visual Studio 2022";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VS2026:
|
|
||||||
Name = "Visual Studio 2026";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VSCode:
|
|
||||||
Name = "Visual Studio Code";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.VSCodeInsiders:
|
|
||||||
Name = "Visual Studio Code - Insiders";
|
|
||||||
break;
|
|
||||||
case CodeEditorTypes.Rider:
|
|
||||||
Name = "Rider";
|
|
||||||
break;
|
|
||||||
default: throw new ArgumentOutOfRangeException(nameof(type), type, null);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
|
|||||||
@@ -139,6 +139,19 @@ CodeEditor* CodeEditingManager::GetCodeEditor(CodeEditorTypes editorType)
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String CodeEditingManager::GetName(CodeEditorTypes editorType)
|
||||||
|
{
|
||||||
|
const auto editor = GetCodeEditor(editorType);
|
||||||
|
if (editor)
|
||||||
|
{
|
||||||
|
return editor->GetName();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
LOG(Warning, "Missing code editor type {0}", (int32)editorType);
|
||||||
|
return String::Empty;
|
||||||
|
}
|
||||||
|
}
|
||||||
void CodeEditingManager::OpenFile(CodeEditorTypes editorType, const String& path, int32 line)
|
void CodeEditingManager::OpenFile(CodeEditorTypes editorType, const String& path, int32 line)
|
||||||
{
|
{
|
||||||
const auto editor = GetCodeEditor(editorType);
|
const auto editor = GetCodeEditor(editorType);
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ public:
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the name of the editor.
|
/// Gets the name of the editor.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns>The name</returns>
|
/// <returns>The name.</returns>
|
||||||
virtual String GetName() const = 0;
|
virtual String GetName() const = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -169,6 +169,13 @@ public:
|
|||||||
/// <returns>The editor object or null if not found.</returns>
|
/// <returns>The editor object or null if not found.</returns>
|
||||||
static CodeEditor* GetCodeEditor(CodeEditorTypes editorType);
|
static CodeEditor* GetCodeEditor(CodeEditorTypes editorType);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name of the editor.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="editorType">The code editor type.</param>
|
||||||
|
/// <returns>The name.</returns>
|
||||||
|
API_FUNCTION() static String GetName(CodeEditorTypes editorType);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Opens the file. Handles async opening.
|
/// Opens the file. Handles async opening.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
Reference in New Issue
Block a user