smarter prefix suggestion for document and project templates
This commit is contained in:
parent
f6461e6cd2
commit
49a237ab94
@ -546,6 +546,11 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
template.Description = tagInformation.Elements["Description"].Value;
|
||||
}
|
||||
|
||||
if (tagInformation.Elements["Prefix"] != null)
|
||||
{
|
||||
template.Prefix = tagInformation.Elements["Prefix"].Value;
|
||||
}
|
||||
|
||||
MarkupTagElement tagPath = (tagInformation.Elements["Path"] as MarkupTagElement);
|
||||
if (tagPath != null)
|
||||
{
|
||||
@ -739,7 +744,7 @@ namespace UniversalEditor.DataFormats.UEPackage
|
||||
|
||||
if (tagInformation.Elements["ProjectNamePrefix"] != null)
|
||||
{
|
||||
template.ProjectNamePrefix = tagInformation.Elements["ProjectNamePrefix"].Value;
|
||||
template.Prefix = tagInformation.Elements["ProjectNamePrefix"].Value;
|
||||
}
|
||||
|
||||
MarkupTagElement tagPath = (tagInformation.Elements["Path"] as MarkupTagElement);
|
||||
|
||||
@ -21,10 +21,9 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
using UniversalEditor.ObjectModels.Markup;
|
||||
using UniversalEditor.ObjectModels.PropertyList;
|
||||
using UniversalEditor.ObjectModels.Project;
|
||||
using UniversalEditor.ObjectModels.PropertyList;
|
||||
|
||||
namespace UniversalEditor
|
||||
{
|
||||
@ -82,6 +81,8 @@ namespace UniversalEditor
|
||||
/// </summary>
|
||||
public string Description { get { return mvarDescription; } set { mvarDescription = value; } }
|
||||
|
||||
public string Prefix { get; set; } = null;
|
||||
|
||||
private TemplateVariable.TemplateVariableCollection mvarVariables = new TemplateVariable.TemplateVariableCollection();
|
||||
/// <summary>
|
||||
/// Variables that affect the content of this template.
|
||||
@ -231,9 +232,6 @@ namespace UniversalEditor
|
||||
|
||||
public ProjectType.ProjectTypeCollection ProjectTypes { get; } = new ProjectType.ProjectTypeCollection();
|
||||
|
||||
private string mvarProjectNamePrefix = String.Empty;
|
||||
public string ProjectNamePrefix { get { return mvarProjectNamePrefix; } set { mvarProjectNamePrefix = value; } }
|
||||
|
||||
private ProjectFileSystem mvarFileSystem = new ProjectFileSystem();
|
||||
public ProjectFileSystem FileSystem { get { return mvarFileSystem; } }
|
||||
|
||||
|
||||
@ -512,7 +512,7 @@ namespace UniversalEditor.UserInterface.Dialogs
|
||||
|
||||
if (!txtFileName.IsChangedByUser)
|
||||
{
|
||||
string projectNamePrefix = pt.ProjectNamePrefix;
|
||||
string projectNamePrefix = pt.Prefix;
|
||||
if (String.IsNullOrEmpty(projectNamePrefix))
|
||||
{
|
||||
projectNamePrefix = pt.Title.Replace(" ", String.Empty);
|
||||
@ -520,6 +520,10 @@ namespace UniversalEditor.UserInterface.Dialogs
|
||||
}
|
||||
txtFileName.Text = projectNamePrefix + "1";
|
||||
}
|
||||
if (!txtSolutionName.IsChangedByUser && SolutionTitle == null)
|
||||
{
|
||||
txtSolutionName.Text = txtFileName.Text;
|
||||
}
|
||||
}
|
||||
else if (Mode == NewDialogMode.File)
|
||||
{
|
||||
@ -527,7 +531,17 @@ namespace UniversalEditor.UserInterface.Dialogs
|
||||
if (pt == null) return;
|
||||
if (!txtFileName.IsChangedByUser)
|
||||
{
|
||||
// txtFileName.Text = projectNamePrefix + "1";
|
||||
|
||||
string prefix = pt.Prefix;
|
||||
if (String.IsNullOrEmpty(prefix))
|
||||
{
|
||||
prefix = pt.ObjectModel.GetType().Name;
|
||||
if (prefix.EndsWith("ObjectModel"))
|
||||
{
|
||||
prefix = prefix.Substring(0, prefix.Length - "ObjectModel".Length);
|
||||
}
|
||||
}
|
||||
txtFileName.Text = prefix + "1";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -589,6 +589,8 @@ namespace UniversalEditor.UserInterface
|
||||
NewDialog dlg = new NewDialog();
|
||||
dlg.Mode = NewDialogMode.Project;
|
||||
dlg.CombineObjects = combineObjects;
|
||||
dlg.SolutionTitle = CurrentSolution?.Title;
|
||||
|
||||
if (dlg.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
SolutionObjectModel solution = null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user