Browse Source

Fix various bugs in new solution model.

pull/32/merge
Daniel Grunwald 13 years ago
parent
commit
453c566254
  1. 1
      src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs
  2. 1
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  3. 1
      src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs
  4. 3
      src/Main/Base/Project/Src/Project/MSBuildConfigurationOrPlatformNameCollection.cs
  5. 6
      src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.cs
  6. 4
      src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.cs
  7. 7
      src/Main/SharpDevelop/Project/Solution.cs

1
src/Main/Base/Project/Src/Internal/Templates/Project/ProjectDescriptor.cs

@ -313,6 +313,7 @@ namespace ICSharpCode.SharpDevelop.Internal.Templates
} }
} }
info.TypeGuid = descriptor.Guid;
info.RootNamespace = standardNamespace.ToString(); info.RootNamespace = standardNamespace.ToString();
info.ProjectName = newProjectName; info.ProjectName = newProjectName;
if (!string.IsNullOrEmpty(defaultPlatform)) if (!string.IsNullOrEmpty(defaultPlatform))

1
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -46,6 +46,7 @@ namespace ICSharpCode.SharpDevelop.Project
this.Name = information.ProjectName; this.Name = information.ProjectName;
this.FileName = information.FileName; this.FileName = information.FileName;
this.idGuid = (information.IdGuid != Guid.Empty ? information.IdGuid : Guid.NewGuid()); this.idGuid = (information.IdGuid != Guid.Empty ? information.IdGuid : Guid.NewGuid());
Debug.Assert(information.TypeGuid != Guid.Empty);
this.TypeGuid = information.TypeGuid; this.TypeGuid = information.TypeGuid;
if (information.ProjectSections != null) if (information.ProjectSections != null)
this.projectSections.AddRange(information.ProjectSections); this.projectSections.AddRange(information.ProjectSections);

1
src/Main/Base/Project/Src/Project/MSBuildBasedProject.cs

@ -171,6 +171,7 @@ namespace ICSharpCode.SharpDevelop.Project
userProjectFile.FullPath = information.FileName + ".user"; userProjectFile.FullPath = information.FileName + ".user";
projectFile.AddProperty(ProjectGuidPropertyName, IdGuid.ToString("B").ToUpperInvariant()); projectFile.AddProperty(ProjectGuidPropertyName, IdGuid.ToString("B").ToUpperInvariant());
projectFile.AddProperty("ProjectTypeGuids", TypeGuid.ToString("B").ToUpperInvariant());
AddGuardedProperty("Configuration", information.ActiveProjectConfiguration.Configuration); AddGuardedProperty("Configuration", information.ActiveProjectConfiguration.Configuration);
AddGuardedProperty("Platform", information.ActiveProjectConfiguration.Platform); AddGuardedProperty("Platform", information.ActiveProjectConfiguration.Platform);

3
src/Main/Base/Project/Src/Project/MSBuildConfigurationOrPlatformNameCollection.cs

@ -109,6 +109,7 @@ namespace ICSharpCode.SharpDevelop.Project
var userProjectFile = project.MSBuildUserProjectFile; var userProjectFile = project.MSBuildUserProjectFile;
bool copiedGroupInMainFile = false; bool copiedGroupInMainFile = false;
if (copyFrom != null) { if (copyFrom != null) {
copyFrom = MSBuildInternals.FixPlatformNameForProject(copyFrom);
foreach (ProjectPropertyGroupElement g in projectFile.PropertyGroups.ToList()) { foreach (ProjectPropertyGroupElement g in projectFile.PropertyGroups.ToList()) {
var gConfig = ConfigurationAndPlatform.FromCondition(g.Condition); var gConfig = ConfigurationAndPlatform.FromCondition(g.Condition);
if (HasName(gConfig, copyFrom)) { if (HasName(gConfig, copyFrom)) {
@ -181,7 +182,7 @@ namespace ICSharpCode.SharpDevelop.Project
string otherName = null; string otherName = null;
foreach (string configName in this) { foreach (string configName in this) {
if (!ConfigurationAndPlatform.ConfigurationNameComparer.Equals(configName, name)) { if (!ConfigurationAndPlatform.ConfigurationNameComparer.Equals(configName, name)) {
otherName = name; otherName = configName;
break; break;
} }
} }

6
src/Main/SharpDevelop/Project/Configuration/EditAvailableConfigurationsDialog.cs

@ -29,12 +29,14 @@ namespace ICSharpCode.SharpDevelop.Project
ctl.Text = StringParser.Parse(ctl.Text); ctl.Text = StringParser.Parse(ctl.Text);
} }
this.configurable = configurable;
this.editPlatforms = editPlatforms;
if (editPlatforms) { if (editPlatforms) {
this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionPlatforms}"); this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionPlatforms}");
this.editedCollection = configurable.ConfigurationNames; this.editedCollection = configurable.PlatformNames;
} else { } else {
this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionConfigurations}"); this.Text = StringParser.Parse("${res:Dialog.EditAvailableConfigurationsDialog.EditSolutionConfigurations}");
this.editedCollection = configurable.PlatformNames; this.editedCollection = configurable.ConfigurationNames;
} }
InitList(); InitList();
} }

4
src/Main/SharpDevelop/Project/Configuration/SolutionConfigurationEditor.cs

@ -160,8 +160,8 @@ namespace ICSharpCode.SharpDevelop.Project
IProject project = (IProject)row.Tag; IProject project = (IProject)row.Tag;
var newConfig = new ConfigurationAndPlatform( var newConfig = new ConfigurationAndPlatform(
row.Cells[configurationColumn.Index].ToString(), row.Cells[configurationColumn.Index].Value.ToString(),
row.Cells[platformColumn.Index].ToString()); row.Cells[platformColumn.Index].Value.ToString());
project.ConfigurationMapping.SetProjectConfiguration(solutionConfig, newConfig); project.ConfigurationMapping.SetProjectConfiguration(solutionConfig, newConfig);
} }

7
src/Main/SharpDevelop/Project/Solution.cs

@ -130,10 +130,12 @@ namespace ICSharpCode.SharpDevelop.Project
{ {
foreach (var project in addedItems) { foreach (var project in addedItems) {
project.ProjectSections.CollectionChanged += solution.OnSolutionSectionCollectionChanged; project.ProjectSections.CollectionChanged += solution.OnSolutionSectionCollectionChanged;
project.ConfigurationMapping.Changed += solution.OnProjectConfigurationMappingChanged;
solution.OnSolutionSectionCollectionChanged(EmptyList<SolutionSection>.Instance, project.ProjectSections); solution.OnSolutionSectionCollectionChanged(EmptyList<SolutionSection>.Instance, project.ProjectSections);
} }
foreach (var project in removedItems) { foreach (var project in removedItems) {
project.ProjectSections.CollectionChanged -= solution.OnSolutionSectionCollectionChanged; project.ProjectSections.CollectionChanged -= solution.OnSolutionSectionCollectionChanged;
project.ConfigurationMapping.Changed -= solution.OnProjectConfigurationMappingChanged;
solution.OnSolutionSectionCollectionChanged(project.ProjectSections, EmptyList<SolutionSection>.Instance); solution.OnSolutionSectionCollectionChanged(project.ProjectSections, EmptyList<SolutionSection>.Instance);
} }
// If the startup project was removed, reset that property // If the startup project was removed, reset that property
@ -198,6 +200,11 @@ namespace ICSharpCode.SharpDevelop.Project
get { return globalSections; } get { return globalSections; }
} }
void OnProjectConfigurationMappingChanged(object sender, EventArgs e)
{
this.IsDirty = true;
}
void OnSolutionSectionCollectionChanged(IReadOnlyCollection<SolutionSection> oldItems, IReadOnlyCollection<SolutionSection> newItems) void OnSolutionSectionCollectionChanged(IReadOnlyCollection<SolutionSection> oldItems, IReadOnlyCollection<SolutionSection> newItems)
{ {
this.IsDirty = true; this.IsDirty = true;

Loading…
Cancel
Save