Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRodrigo Moya <rodrigo.moya@xamarin.com>2020-01-24 01:08:59 +0300
committerGitHub <noreply@github.com>2020-01-24 01:08:59 +0300
commit6d95d7e313dffc6afb81e44f0dddbf408d8e0369 (patch)
tree65acf0ed4f77dee330d22c2ece13bb27675fe6a6
parent7642846e9d9e93deca1efb59de9ae868f98f0e82 (diff)
parent44fce79aa0f43e3b9743cc8f2d91e6743726e844 (diff)
Merge pull request #9583 from mono/iantoal/pr-Enable-Auth-For-AspDotNetCore
Enable authentication support in New Project Creation Wizard for AspNetCore projects
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/DotNetCoreRuntimeOptionsPanelWidget.Gui.cs4
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs199
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs86
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs14
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs18
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj4
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/gtk-gui/MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.cs138
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/gtk-gui/generated.cs88
-rw-r--r--main/src/addins/MonoDevelop.DotNetCore/gtk-gui/gui.stetic183
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs34
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplateWizard.cs1
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplatingService.cs6
12 files changed, 318 insertions, 457 deletions
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/DotNetCoreRuntimeOptionsPanelWidget.Gui.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/DotNetCoreRuntimeOptionsPanelWidget.Gui.cs
index d10e41e58c..5467472836 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/DotNetCoreRuntimeOptionsPanelWidget.Gui.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/DotNetCoreRuntimeOptionsPanelWidget.Gui.cs
@@ -38,8 +38,8 @@ namespace MonoDevelop.DotNetCore.Gui
void Build ()
{
- Stetic.Gui.Initialize (this);
- Stetic.BinContainer.Attach (this);
+ MonoDevelop.Components.Gui.Initialize (this);
+ MonoDevelop.Components.BinContainer.Attach (this);
Name = "MonoDevelop.Ide.Projects.DotNetCoreRuntimeOptionsPanelWidget";
mainVBox = new VBox ();
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs
index c6927d5c76..fdd7eccfeb 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Gui/GtkDotNetCoreProjectTemplateWizardPageWidget.cs
@@ -24,11 +24,11 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-using System;
-using System.Linq;
+using System;
using Gdk;
using Gtk;
using MonoDevelop.Components;
+using MonoDevelop.Core;
using MonoDevelop.Core.Assemblies;
using MonoDevelop.DotNetCore.Templating;
using MonoDevelop.Ide.Gui;
@@ -43,19 +43,40 @@ namespace MonoDevelop.DotNetCore.Gui
ImageView backgroundImageView;
Xwt.Drawing.Image backgroundImage;
- public GtkDotNetCoreProjectTemplateWizardPageWidget ()
+ HBox mainHBox;
+ EventBox leftBorderEventBox;
+ VBox configurationVBox;
+ EventBox configurationTopEventBox;
+ EventBox configurationTableEventBox;
+ Table configurationTable;
+
+ ComboBox targetFrameworkComboBox;
+ Label targetFrameworkInformationLabel;
+ Label targetFrameworkLabel;
+
+ ComboBox authenticationComboBox;
+ Label authenticationInformationLabel;
+ Label authenticationLabel;
+
+ EventBox configurationBottomEventBox;
+ EventBox backgroundLargeImageEventBox;
+ VBox backgroundLargeImageVBox;
+
+ public GtkDotNetCoreProjectTemplateWizardPageWidget (DotNetCoreProjectTemplateWizardPage wizardPage)
{
- this.Build ();
+ this.wizardPage = wizardPage;
+
+ Build ();
// Do not use a width request for the configuration box so the left hand side of the
// wizard page can expand to fit its contents.
configurationVBox.WidthRequest = -1;
- targetFrameworkLabel.WidthRequest = -1;
backgroundImage = Xwt.Drawing.Image.FromResource ("preview-netcore.png");
- backgroundImageView = new ImageView (backgroundImage);
- backgroundImageView.Xalign = 1.0f;
- backgroundImageView.Yalign = 0.5f;
+ backgroundImageView = new ImageView (backgroundImage) {
+ Xalign = 1.0f,
+ Yalign = 0.5f
+ };
backgroundLargeImageVBox.PackStart (backgroundImageView, true, true, 0);
backgroundColor = Styles.NewProjectDialog.ProjectConfigurationLeftHandBackgroundColor.ToGdkColor ();
@@ -64,14 +85,16 @@ namespace MonoDevelop.DotNetCore.Gui
configurationTableEventBox.ModifyBg (StateType.Normal, backgroundColor);
configurationBottomEventBox.ModifyBg (StateType.Normal, backgroundColor);
backgroundLargeImageEventBox.ModifyBg (StateType.Normal, backgroundColor);
- }
- internal GtkDotNetCoreProjectTemplateWizardPageWidget (DotNetCoreProjectTemplateWizardPage wizardPage)
- : this ()
- {
- this.wizardPage = wizardPage;
- PopulateTargetFrameworks ();
- targetFrameworkComboBox.Changed += TargetFrameworkComboBoxChanged;
+ if (wizardPage.TargetFrameworks.Count > 1) {
+ PopulateTargetFrameworks ();
+ targetFrameworkComboBox.Changed += TargetFrameworkComboBoxChanged;
+ }
+
+ if (wizardPage.SupportedAuthentications.Count > 0) {
+ PopulateAuthentications ();
+ authenticationComboBox.Changed += AuthenticationsComboBoxChanged;
+ }
}
void PopulateTargetFrameworks ()
@@ -87,5 +110,151 @@ namespace MonoDevelop.DotNetCore.Gui
{
wizardPage.SelectedTargetFrameworkIndex = targetFrameworkComboBox.Active;
}
+
+ void PopulateAuthentications ()
+ {
+ foreach (var authentication in wizardPage.SupportedAuthentications) {
+ authenticationComboBox.AppendText (authentication.Description);
+ }
+
+ authenticationComboBox.Active = wizardPage.SelectedAuthenticationIndex;
+ authenticationInformationLabel.LabelProp = wizardPage.SupportedAuthentications [wizardPage.SelectedAuthenticationIndex].Information;
+ }
+
+ void AuthenticationsComboBoxChanged (object sender, EventArgs e)
+ {
+ wizardPage.SelectedAuthenticationIndex = authenticationComboBox.Active;
+ authenticationInformationLabel.LabelProp = wizardPage.SupportedAuthentications [wizardPage.SelectedAuthenticationIndex].Information;
+ }
+
+ protected virtual void Build ()
+ {
+ MonoDevelop.Components.Gui.Initialize (this);
+ MonoDevelop.Components.BinContainer.Attach (this);
+
+ Name = "MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget";
+
+ mainHBox = new HBox {
+ Name = "mainHBox"
+ };
+
+ leftBorderEventBox = new EventBox {
+ WidthRequest = 30,
+ Name = "leftBorderEventBox"
+ };
+ mainHBox.PackStart (leftBorderEventBox, false, true, 0);
+
+ configurationVBox = new VBox {
+ WidthRequest = 440,
+ Name = "configurationVBox"
+ };
+
+ configurationTopEventBox = new EventBox {
+ Name = "configurationTopEventBox"
+ };
+ configurationVBox.PackStart (configurationTopEventBox, true, true, 0);
+
+ var showFrameworkSelection = wizardPage.TargetFrameworks.Count > 1;
+ var showAuthenticationSelection = wizardPage.SupportedAuthentications.Count > 0;
+
+ // Create the table of configurable options
+ uint tableRows = (uint)(showFrameworkSelection && showAuthenticationSelection ? 4 : 2);
+ configurationTable = new Table (tableRows, 3, false) {
+ Name = "configurationTable",
+ RowSpacing = 7,
+ ColumnSpacing = 6
+ };
+
+ if (showFrameworkSelection)
+ AddFrameworkSelection ();
+
+ if (showAuthenticationSelection)
+ AddAuthenticationSelection ((uint)(showFrameworkSelection ? 2 : 0));
+
+ configurationTableEventBox = new EventBox {
+ Name = "configurationTableEventBox"
+ };
+ configurationTableEventBox.Add (configurationTable);
+ configurationVBox.PackStart (configurationTableEventBox, false, false, 0);
+
+ configurationBottomEventBox = new EventBox {
+ Name = "configurationBottomEventBox"
+ };
+ configurationVBox.PackStart (configurationBottomEventBox);
+ mainHBox.PackStart (configurationVBox);
+
+ // Add the image
+ backgroundLargeImageEventBox = new EventBox {
+ Name = "backgroundLargeImageEventBox"
+ };
+ backgroundLargeImageVBox = new VBox {
+ Name = "backgroundLargeImageVBox"
+ };
+ backgroundLargeImageEventBox.Add (backgroundLargeImageVBox);
+ mainHBox.PackStart (backgroundLargeImageEventBox);
+
+ Add (mainHBox);
+
+ if (Child != null) {
+ Child.ShowAll ();
+ }
+
+ Hide ();
+ }
+
+ void AddFrameworkSelection()
+ {
+ targetFrameworkComboBox = ComboBox.NewText ();
+ targetFrameworkComboBox.WidthRequest = 350;
+ targetFrameworkComboBox.Name = "targetFrameworkComboBox";
+ configurationTable.Attach (targetFrameworkComboBox, 1, 2, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ targetFrameworkInformationLabel = new Label {
+ WidthRequest = 350,
+ Name = "targetFrameworkInformationLabel",
+ Xpad = 5,
+ Xalign = 0F,
+ LabelProp = GettextCatalog.GetString ("Select the target framework for your project."),
+ Justify = Justification.Left,
+ Wrap = true
+ };
+ configurationTable.Attach (targetFrameworkInformationLabel, 1, 2, 0, 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ targetFrameworkLabel = new Label {
+ Name = "targetFrameworkLabel",
+ Xpad = 5,
+ Xalign = 1F,
+ LabelProp = GettextCatalog.GetString ("Target Framework:"),
+ Justify = Justification.Right
+ };
+ configurationTable.Attach (targetFrameworkLabel, 0, 1, 1, 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+ }
+
+ void AddAuthenticationSelection(uint primaryRow)
+ {
+ authenticationComboBox = ComboBox.NewText ();
+ authenticationComboBox.WidthRequest = 350;
+ authenticationComboBox.Name = "authenticationComboBox";
+ configurationTable.Attach (authenticationComboBox, 1, 2, primaryRow, primaryRow + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ authenticationInformationLabel = new Label {
+ WidthRequest = 350,
+ Name = "authenticationInformationLabel",
+ Xpad = 5,
+ Xalign = 0F,
+ Justify = Justification.Left,
+ Wrap = true
+ };
+ configurationTable.Attach (authenticationInformationLabel, 1, 2, primaryRow + 1, primaryRow + 2, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+
+ authenticationLabel = new Label {
+ Name = "authenticationLabel",
+ Xpad = 5,
+ Xalign = 1F,
+ LabelProp = GettextCatalog.GetString ("Authentication:"),
+ Justify = Justification.Right
+ };
+ configurationTable.Attach (authenticationLabel, 0, 1, primaryRow, primaryRow + 1, AttachOptions.Fill, AttachOptions.Fill, 0, 0);
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs
new file mode 100644
index 0000000000..0e532d52ef
--- /dev/null
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateParameters.cs
@@ -0,0 +1,86 @@
+//
+// DotNetCoreTemplate.cs
+//
+// Author:
+// iantoal <iantoal@microsoft.com>
+//
+// Copyright (c) 2020 Microsoft
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using MonoDevelop.Core;
+using MonoDevelop.Ide;
+using MonoDevelop.Ide.Templates;
+
+namespace MonoDevelop.DotNetCore.Templating
+{
+ class AuthenticationParameter
+ {
+ static readonly string [] supportedParameters = new string [] { "None", "Individual" };
+
+ public static readonly string ParameterName = "auth";
+
+ public string Name { get; }
+
+ public string Description => Name switch
+ {
+ "None" => GettextCatalog.GetString ("No Authentication"),
+ "Individual" => GettextCatalog.GetString ("Individual Authentication (in\u2013app)"),
+ _ => throw new ArgumentException ("Invalid auth parameter"),
+ };
+
+ public string Information => Name switch
+ {
+ "None" => GettextCatalog.GetString ("Select this option for applications that do not require any authentication."),
+ "Individual" => GettextCatalog.GetString ("Select this option to create a project that includes a local user account store."),
+ _ => throw new ArgumentException ("Invalid auth parameter"),
+ };
+
+ public AuthenticationParameter (string name)
+ {
+ Name = name;
+ }
+
+ public static IReadOnlyList<AuthenticationParameter> CreateSupportedParameterList (IReadOnlyDictionary<string, string> parameterChoices)
+ {
+ var filteredList = parameterChoices.Where (choice => supportedParameters.Contains (choice.Key))
+ .Select (parameter => new AuthenticationParameter (parameter.Key))
+ .ToList ();
+
+ return (filteredList.Count == 1 && filteredList.First ().Name == "None") ? new List<AuthenticationParameter> () : filteredList;
+ }
+ }
+
+ class DotNetCoreProjectTemplateParameters
+ {
+ public static IReadOnlyList<AuthenticationParameter> GetAuthenticationParameters (string templateId)
+ {
+ if (IdeServices.TemplatingService.GetSolutionTemplate (templateId) is MicrosoftTemplateEngineSolutionTemplate template) {
+ if (template.IsSupportedParameter (AuthenticationParameter.ParameterName)) {
+ var parameterChoices = template.GetParameterChoices (AuthenticationParameter.ParameterName);
+ return AuthenticationParameter.CreateSupportedParameterList (parameterChoices);
+ }
+ }
+
+ return new List<AuthenticationParameter> ();
+ }
+ }
+}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs
index 41e3ce3b1e..18674cffe0 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizard.cs
@@ -28,7 +28,6 @@ using System.Collections.Generic;
using System.Linq;
using MonoDevelop.Core.Assemblies;
using MonoDevelop.Ide.Templates;
-using MonoDevelop.Projects;
namespace MonoDevelop.DotNetCore.Templating
{
@@ -42,7 +41,7 @@ namespace MonoDevelop.DotNetCore.Templating
public override WizardPage GetPage (int pageNumber)
{
- var page = new DotNetCoreProjectTemplateWizardPage (this, targetFrameworks);
+ var page = new DotNetCoreProjectTemplateWizardPage (this, targetFrameworks, SupportedAuthentications);
targetFrameworks = null;
return page;
}
@@ -53,6 +52,8 @@ namespace MonoDevelop.DotNetCore.Templating
internal IList<TargetFramework> TargetFrameworks => targetFrameworks;
+ internal IReadOnlyList<AuthenticationParameter> SupportedAuthentications { get; private set; }
+
/// <summary>
/// When only .NET Core 2.0 is installed there is only one option in the drop down
/// list for the target framework for .NET Core projects so there is no point in displaying
@@ -63,8 +64,9 @@ namespace MonoDevelop.DotNetCore.Templating
/// </summary>
int GetTotalPages ()
{
+ GetSupportedAuthentications ();
GetTargetFrameworks ();
- if (targetFrameworks.Count > 1)
+ if (targetFrameworks.Count > 1 || SupportedAuthentications.Any ())
return 1;
ConfigureDefaultParameters ();
@@ -72,6 +74,12 @@ namespace MonoDevelop.DotNetCore.Templating
return 0;
}
+ void GetSupportedAuthentications ()
+ {
+ var templateId = Parameters ["TemplateId"];
+ SupportedAuthentications = DotNetCoreProjectTemplateParameters.GetAuthenticationParameters (templateId);
+ }
+
void GetTargetFrameworks ()
{
if (IsSupportedParameter ("NetStandard")) {
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs
index 8d87500de2..aedb1b4e4c 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.Templating/DotNetCoreProjectTemplateWizardPage.cs
@@ -30,7 +30,6 @@ using MonoDevelop.Core;
using MonoDevelop.Core.Assemblies;
using MonoDevelop.DotNetCore.Gui;
using MonoDevelop.Ide.Templates;
-using MonoDevelop.Projects;
namespace MonoDevelop.DotNetCore.Templating
{
@@ -43,12 +42,15 @@ namespace MonoDevelop.DotNetCore.Templating
public DotNetCoreProjectTemplateWizardPage (
DotNetCoreProjectTemplateWizard wizard,
- List<TargetFramework> targetFrameworks)
+ List<TargetFramework> targetFrameworks,
+ IReadOnlyList<AuthenticationParameter> supportedAuthentications)
{
this.wizard = wizard;
this.targetFrameworks = targetFrameworks;
parameters = CreateTargetFrameworksParameters ();
+ SupportedAuthentications = supportedAuthentications;
+
if (targetFrameworks.Any ())
SelectedTargetFrameworkIndex = 0;
else
@@ -115,5 +117,17 @@ namespace MonoDevelop.DotNetCore.Templating
if (!string.IsNullOrEmpty (parameter))
wizard.Parameters [parameter] = "true";
}
+
+ public IReadOnlyList<AuthenticationParameter> SupportedAuthentications { get; }
+
+ int selectedAuthenticationIndex;
+
+ public int SelectedAuthenticationIndex {
+ get { return selectedAuthenticationIndex; }
+ set {
+ selectedAuthenticationIndex = value;
+ wizard.Parameters [AuthenticationParameter.ParameterName] = SupportedAuthentications [selectedAuthenticationIndex].Name;
+ }
+ }
}
}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
index 68fcebe996..c3af883e33 100644
--- a/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
+++ b/main/src/addins/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.csproj
@@ -73,9 +73,7 @@
<Compile Include="MonoDevelop.DotNetCore\DotNetCoreVersion.cs" />
<Compile Include="MonoDevelop.DotNetCore\DotNetCoreRuntimeVersions.cs" />
<Compile Include="MonoDevelop.DotNetCore.Templating\DotNetCoreProjectTemplateWizardPage.cs" />
- <Compile Include="gtk-gui\generated.cs" />
<Compile Include="MonoDevelop.DotNetCore.Gui\GtkDotNetCoreProjectTemplateWizardPageWidget.cs" />
- <Compile Include="gtk-gui\MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.cs" />
<Compile Include="MonoDevelop.DotNetCore\MSBuildSdksPathGlobalPropertyProvider.cs" />
<Compile Include="MonoDevelop.DotNetCore.Templating\DotNetCoreProjectTemplateStringTagProvider.cs" />
<Compile Include="MonoDevelop.DotNetCore.Gui\DotNetCoreSdkLocationPanel.cs" />
@@ -98,6 +96,7 @@
<Compile Include="MonoDevelop.DotNetCore\DotNetCoreRuntimeSystemInformation.cs" />
<Compile Include="MonoDevelop.DotNetCore.Commands\PackCommandHandler.cs" />
<Compile Include="MonoDevelop.DotNetCore.GlobalTools\DotNetCoreGlobalToolManager.cs" />
+ <Compile Include="MonoDevelop.DotNetCore.Templating\DotNetCoreProjectTemplateParameters.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\external\mono-addins\Mono.Addins\Mono.Addins.csproj">
@@ -148,7 +147,6 @@
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="Properties\MonoDevelop.DotNetCore.addin.xml" />
- <EmbeddedResource Include="gtk-gui\gui.stetic" />
<EmbeddedResource Include="images\preview-netcore.png" />
<EmbeddedResource Include="images\preview-netcore%402x.png" />
diff --git a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.cs b/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.cs
deleted file mode 100644
index 0151710038..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.cs
+++ /dev/null
@@ -1,138 +0,0 @@
-
-// This file has been generated by the GUI designer. Do not modify.
-namespace MonoDevelop.DotNetCore.Gui
-{
- partial class GtkDotNetCoreProjectTemplateWizardPageWidget
- {
- private global::Gtk.HBox mainHBox;
-
- private global::Gtk.EventBox leftBorderEventBox;
-
- private global::Gtk.VBox configurationVBox;
-
- private global::Gtk.EventBox configurationTopEventBox;
-
- private global::Gtk.EventBox configurationTableEventBox;
-
- private global::Gtk.Table configurationTable;
-
- private global::Gtk.ComboBox targetFrameworkComboBox;
-
- private global::Gtk.Label targetFrameworkInformationLabel;
-
- private global::Gtk.Label targetFrameworkLabel;
-
- private global::Gtk.EventBox configurationBottomEventBox;
-
- private global::Gtk.EventBox backgroundLargeImageEventBox;
-
- private global::Gtk.VBox backgroundLargeImageVBox;
-
- protected virtual void Build()
- {
- global::Stetic.Gui.Initialize(this);
- // Widget MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget
- global::Stetic.BinContainer.Attach(this);
- this.Name = "MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget";
- // Container child MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget.Gtk.Container+ContainerChild
- this.mainHBox = new global::Gtk.HBox();
- this.mainHBox.Name = "mainHBox";
- // Container child mainHBox.Gtk.Box+BoxChild
- this.leftBorderEventBox = new global::Gtk.EventBox();
- this.leftBorderEventBox.WidthRequest = 30;
- this.leftBorderEventBox.Name = "leftBorderEventBox";
- this.mainHBox.Add(this.leftBorderEventBox);
- global::Gtk.Box.BoxChild w1 = ((global::Gtk.Box.BoxChild)(this.mainHBox[this.leftBorderEventBox]));
- w1.Position = 0;
- w1.Expand = false;
- // Container child mainHBox.Gtk.Box+BoxChild
- this.configurationVBox = new global::Gtk.VBox();
- this.configurationVBox.WidthRequest = 440;
- this.configurationVBox.Name = "configurationVBox";
- // Container child configurationVBox.Gtk.Box+BoxChild
- this.configurationTopEventBox = new global::Gtk.EventBox();
- this.configurationTopEventBox.Name = "configurationTopEventBox";
- this.configurationVBox.Add(this.configurationTopEventBox);
- global::Gtk.Box.BoxChild w2 = ((global::Gtk.Box.BoxChild)(this.configurationVBox[this.configurationTopEventBox]));
- w2.Position = 0;
- // Container child configurationVBox.Gtk.Box+BoxChild
- this.configurationTableEventBox = new global::Gtk.EventBox();
- this.configurationTableEventBox.Name = "configurationTableEventBox";
- // Container child configurationTableEventBox.Gtk.Container+ContainerChild
- this.configurationTable = new global::Gtk.Table(((uint)(2)), ((uint)(3)), false);
- this.configurationTable.Name = "configurationTable";
- this.configurationTable.RowSpacing = ((uint)(7));
- this.configurationTable.ColumnSpacing = ((uint)(6));
- // Container child configurationTable.Gtk.Table+TableChild
- this.targetFrameworkComboBox = global::Gtk.ComboBox.NewText();
- this.targetFrameworkComboBox.WidthRequest = 250;
- this.targetFrameworkComboBox.Name = "targetFrameworkComboBox";
- this.configurationTable.Add(this.targetFrameworkComboBox);
- global::Gtk.Table.TableChild w3 = ((global::Gtk.Table.TableChild)(this.configurationTable[this.targetFrameworkComboBox]));
- w3.TopAttach = ((uint)(1));
- w3.BottomAttach = ((uint)(2));
- w3.LeftAttach = ((uint)(1));
- w3.RightAttach = ((uint)(2));
- w3.XOptions = ((global::Gtk.AttachOptions)(4));
- w3.YOptions = ((global::Gtk.AttachOptions)(4));
- // Container child configurationTable.Gtk.Table+TableChild
- this.targetFrameworkInformationLabel = new global::Gtk.Label();
- this.targetFrameworkInformationLabel.Name = "targetFrameworkInformationLabel";
- this.targetFrameworkInformationLabel.Xpad = 5;
- this.targetFrameworkInformationLabel.Xalign = 0F;
- this.targetFrameworkInformationLabel.LabelProp = global::Mono.Unix.Catalog.GetString("Select the target framework for your project.");
- this.targetFrameworkInformationLabel.Justify = ((global::Gtk.Justification)(1));
- this.configurationTable.Add(this.targetFrameworkInformationLabel);
- global::Gtk.Table.TableChild w4 = ((global::Gtk.Table.TableChild)(this.configurationTable[this.targetFrameworkInformationLabel]));
- w4.LeftAttach = ((uint)(1));
- w4.RightAttach = ((uint)(2));
- w4.XOptions = ((global::Gtk.AttachOptions)(4));
- w4.YOptions = ((global::Gtk.AttachOptions)(4));
- // Container child configurationTable.Gtk.Table+TableChild
- this.targetFrameworkLabel = new global::Gtk.Label();
- this.targetFrameworkLabel.WidthRequest = 132;
- this.targetFrameworkLabel.Name = "targetFrameworkLabel";
- this.targetFrameworkLabel.Xpad = 5;
- this.targetFrameworkLabel.Xalign = 1F;
- this.targetFrameworkLabel.LabelProp = global::Mono.Unix.Catalog.GetString("Target Framework:");
- this.targetFrameworkLabel.Justify = ((global::Gtk.Justification)(1));
- this.configurationTable.Add(this.targetFrameworkLabel);
- global::Gtk.Table.TableChild w5 = ((global::Gtk.Table.TableChild)(this.configurationTable[this.targetFrameworkLabel]));
- w5.TopAttach = ((uint)(1));
- w5.BottomAttach = ((uint)(2));
- w5.XOptions = ((global::Gtk.AttachOptions)(4));
- w5.YOptions = ((global::Gtk.AttachOptions)(4));
- this.configurationTableEventBox.Add(this.configurationTable);
- this.configurationVBox.Add(this.configurationTableEventBox);
- global::Gtk.Box.BoxChild w7 = ((global::Gtk.Box.BoxChild)(this.configurationVBox[this.configurationTableEventBox]));
- w7.Position = 1;
- w7.Expand = false;
- w7.Fill = false;
- // Container child configurationVBox.Gtk.Box+BoxChild
- this.configurationBottomEventBox = new global::Gtk.EventBox();
- this.configurationBottomEventBox.Name = "configurationBottomEventBox";
- this.configurationVBox.Add(this.configurationBottomEventBox);
- global::Gtk.Box.BoxChild w8 = ((global::Gtk.Box.BoxChild)(this.configurationVBox[this.configurationBottomEventBox]));
- w8.Position = 2;
- this.mainHBox.Add(this.configurationVBox);
- global::Gtk.Box.BoxChild w9 = ((global::Gtk.Box.BoxChild)(this.mainHBox[this.configurationVBox]));
- w9.Position = 1;
- // Container child mainHBox.Gtk.Box+BoxChild
- this.backgroundLargeImageEventBox = new global::Gtk.EventBox();
- this.backgroundLargeImageEventBox.Name = "backgroundLargeImageEventBox";
- // Container child backgroundLargeImageEventBox.Gtk.Container+ContainerChild
- this.backgroundLargeImageVBox = new global::Gtk.VBox();
- this.backgroundLargeImageVBox.Name = "backgroundLargeImageVBox";
- this.backgroundLargeImageEventBox.Add(this.backgroundLargeImageVBox);
- this.mainHBox.Add(this.backgroundLargeImageEventBox);
- global::Gtk.Box.BoxChild w11 = ((global::Gtk.Box.BoxChild)(this.mainHBox[this.backgroundLargeImageEventBox]));
- w11.Position = 2;
- this.Add(this.mainHBox);
- if ((this.Child != null))
- {
- this.Child.ShowAll();
- }
- this.Hide();
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/generated.cs b/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/generated.cs
deleted file mode 100644
index 453751b36a..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/generated.cs
+++ /dev/null
@@ -1,88 +0,0 @@
-
-// This file has been generated by the GUI designer. Do not modify.
-namespace Stetic
-{
- internal class Gui
- {
- private static bool initialized;
-
- internal static void Initialize(Gtk.Widget iconRenderer)
- {
- if ((Stetic.Gui.initialized == false))
- {
- Stetic.Gui.initialized = true;
- }
- }
- }
-
- internal class BinContainer
- {
- private Gtk.Widget child;
-
- private Gtk.UIManager uimanager;
-
- public static BinContainer Attach(Gtk.Bin bin)
- {
- BinContainer bc = new BinContainer();
- bin.SizeRequested += new Gtk.SizeRequestedHandler(bc.OnSizeRequested);
- bin.SizeAllocated += new Gtk.SizeAllocatedHandler(bc.OnSizeAllocated);
- bin.Added += new Gtk.AddedHandler(bc.OnAdded);
- return bc;
- }
-
- private void OnSizeRequested(object sender, Gtk.SizeRequestedArgs args)
- {
- if ((this.child != null))
- {
- args.Requisition = this.child.SizeRequest();
- }
- }
-
- private void OnSizeAllocated(object sender, Gtk.SizeAllocatedArgs args)
- {
- if ((this.child != null))
- {
- this.child.Allocation = args.Allocation;
- }
- }
-
- private void OnAdded(object sender, Gtk.AddedArgs args)
- {
- this.child = args.Widget;
- }
-
- public void SetUiManager(Gtk.UIManager uim)
- {
- this.uimanager = uim;
- this.child.Realized += new System.EventHandler(this.OnRealized);
- }
-
- private void OnRealized(object sender, System.EventArgs args)
- {
- if ((this.uimanager != null))
- {
- Gtk.Widget w;
- w = this.child.Toplevel;
- if (((w != null)
- && typeof(Gtk.Window).IsInstanceOfType(w)))
- {
- ((Gtk.Window)(w)).AddAccelGroup(this.uimanager.AccelGroup);
- this.uimanager = null;
- }
- }
- }
- }
-
- internal class ActionGroups
- {
- public static Gtk.ActionGroup GetActionGroup(System.Type type)
- {
- return Stetic.ActionGroups.GetActionGroup(type.FullName);
- }
-
- public static Gtk.ActionGroup GetActionGroup(string name)
- {
- return null;
- }
- }
-}
diff --git a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/gui.stetic b/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/gui.stetic
deleted file mode 100644
index b97a417600..0000000000
--- a/main/src/addins/MonoDevelop.DotNetCore/gtk-gui/gui.stetic
+++ /dev/null
@@ -1,183 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<stetic-interface>
- <configuration>
- <images-root-path>..</images-root-path>
- <target-gtk-version>2.12</target-gtk-version>
- </configuration>
- <import>
- <widget-library name="../../../../build/bin/MonoDevelop.Ide.dll" />
- <widget-library name="../../../../build/AddIns/MonoDevelop.UnitTesting/MonoDevelop.UnitTesting.dll" />
- <widget-library name="../../../../build/AddIns/MonoDevelop.DotNetCore/MonoDevelop.DotNetCore.dll" internal="true" />
- </import>
- <widget class="Gtk.Bin" id="MonoDevelop.DotNetCore.Gui.GtkDotNetCoreProjectTemplateWizardPageWidget" design-size="724 397">
- <property name="MemberName" />
- <property name="Visible">False</property>
- <child>
- <widget class="Gtk.HBox" id="mainHBox">
- <property name="MemberName" />
- <child>
- <widget class="Gtk.EventBox" id="leftBorderEventBox">
- <property name="MemberName" />
- <property name="WidthRequest">30</property>
- <child>
- <placeholder />
- </child>
- </widget>
- <packing>
- <property name="Position">0</property>
- <property name="AutoSize">False</property>
- <property name="Expand">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.VBox" id="configurationVBox">
- <property name="MemberName" />
- <property name="WidthRequest">440</property>
- <child>
- <widget class="Gtk.EventBox" id="configurationTopEventBox">
- <property name="MemberName" />
- <child>
- <placeholder />
- </child>
- </widget>
- <packing>
- <property name="Position">0</property>
- <property name="AutoSize">True</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.EventBox" id="configurationTableEventBox">
- <property name="MemberName" />
- <child>
- <widget class="Gtk.Table" id="configurationTable">
- <property name="MemberName" />
- <property name="NRows">2</property>
- <property name="NColumns">3</property>
- <property name="RowSpacing">7</property>
- <property name="ColumnSpacing">6</property>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <placeholder />
- </child>
- <child>
- <widget class="Gtk.ComboBox" id="targetFrameworkComboBox">
- <property name="MemberName" />
- <property name="WidthRequest">250</property>
- <property name="IsTextCombo">True</property>
- <property name="Items" translatable="yes" />
- </widget>
- <packing>
- <property name="TopAttach">1</property>
- <property name="BottomAttach">2</property>
- <property name="LeftAttach">1</property>
- <property name="RightAttach">2</property>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Label" id="targetFrameworkInformationLabel">
- <property name="MemberName" />
- <property name="Xpad">5</property>
- <property name="Xalign">0</property>
- <property name="LabelProp" translatable="yes">Select the target framework for your project.</property>
- <property name="Justify">Right</property>
- </widget>
- <packing>
- <property name="LeftAttach">1</property>
- <property name="RightAttach">2</property>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.Label" id="targetFrameworkLabel">
- <property name="MemberName" />
- <property name="WidthRequest">132</property>
- <property name="Xpad">5</property>
- <property name="Xalign">1</property>
- <property name="LabelProp" translatable="yes">Target Framework:</property>
- <property name="Justify">Right</property>
- </widget>
- <packing>
- <property name="TopAttach">1</property>
- <property name="BottomAttach">2</property>
- <property name="AutoSize">True</property>
- <property name="XOptions">Fill</property>
- <property name="YOptions">Fill</property>
- <property name="XExpand">False</property>
- <property name="XFill">True</property>
- <property name="XShrink">False</property>
- <property name="YExpand">False</property>
- <property name="YFill">True</property>
- <property name="YShrink">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">True</property>
- <property name="Expand">False</property>
- <property name="Fill">False</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.EventBox" id="configurationBottomEventBox">
- <property name="MemberName" />
- <child>
- <placeholder />
- </child>
- </widget>
- <packing>
- <property name="Position">2</property>
- <property name="AutoSize">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="Position">1</property>
- <property name="AutoSize">True</property>
- </packing>
- </child>
- <child>
- <widget class="Gtk.EventBox" id="backgroundLargeImageEventBox">
- <property name="MemberName" />
- <child>
- <widget class="Gtk.VBox" id="backgroundLargeImageVBox">
- <property name="MemberName" />
- <child>
- <placeholder />
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="Position">2</property>
- <property name="AutoSize">False</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
-</stetic-interface> \ No newline at end of file
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs
index 5b53a60a08..ef9a5e6f89 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/MicrosoftTemplateEngineSolutionTemplate.cs
@@ -33,7 +33,7 @@ using MonoDevelop.Ide.Codons;
namespace MonoDevelop.Ide.Templates
{
- class MicrosoftTemplateEngineSolutionTemplate : SolutionTemplate
+ public class MicrosoftTemplateEngineSolutionTemplate : SolutionTemplate
{
internal readonly ITemplateInfo templateInfo;
@@ -65,28 +65,6 @@ namespace MonoDevelop.Ide.Templates
this.templateInfo = templateInfo;
}
- string MergeDefaultParameters (string defaultParameters)
- {
- List<TemplateParameter> priorityParameters = null;
- var parameters = new List<string> ();
- var cacheParameters = templateInfo.CacheParameters.Where (m => !string.IsNullOrEmpty (m.Value.DefaultValue));
-
- if (!cacheParameters.Any ())
- return defaultParameters;
-
- if (!string.IsNullOrEmpty (defaultParameters)) {
- priorityParameters = TemplateParameter.CreateParameters (defaultParameters).ToList ();
- defaultParameters += ",";
- }
-
- foreach (var p in cacheParameters) {
- if (priorityParameters != null && !priorityParameters.Exists (t => t.Name == p.Key))
- parameters.Add ($"{p.Key}={p.Value.DefaultValue}");
- }
-
- return defaultParameters += string.Join (",", parameters);
- }
-
internal string FileFormattingExclude { get; set; }
internal bool ShouldFormatFile (string fileName)
@@ -166,5 +144,15 @@ namespace MonoDevelop.Ide.Templates
return textBuilder.ToString ();
}
+
+ public IReadOnlyDictionary<string, string> GetParameterChoices (string parameterName)
+ {
+ return templateInfo.Parameters.FirstOrDefault (parameter => parameter.Name == parameterName)?.Choices;
+ }
+
+ public bool IsSupportedParameter(string parameterName)
+ {
+ return templateInfo.Parameters.FirstOrDefault (parameter => parameter.Name == parameterName) != null;
+ }
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplateWizard.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplateWizard.cs
index 811dc651ec..709c800ad6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplateWizard.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplateWizard.cs
@@ -72,6 +72,7 @@ namespace MonoDevelop.Ide.Templates
internal void UpdateParameters (SolutionTemplate template)
{
+ Parameters ["TemplateId"] = template.Id;
Parameters ["TemplateName"] = template.Name;
UpdateSupportedParameters (template.SupportedParameters);
UpdateDefaultParameters (template.DefaultParameters);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplatingService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplatingService.cs
index 046e19e429..71c4101a49 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplatingService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/TemplatingService.cs
@@ -206,6 +206,12 @@ namespace MonoDevelop.Ide.Templates
return itemTemplatingProvider.GetTemplates ();
}
+ public SolutionTemplate GetSolutionTemplate (string templateId)
+ {
+ var categories = GetProjectTemplateCategories (template => template.Id == templateId);
+ return GetTemplate (categories, templateId);
+ }
+
public IEnumerable<ItemTemplate> GetItemTemplates (Predicate<ItemTemplate> match)
{
return GetItemTemplates ().Where (template => match (template));