[Monodevelop-patches-list] r2626 - in trunk/MonoDevelop/Core/src/MonoDevelop.Base: . Internal/Codons/Commands Internal/Codons/LanguageBinding Internal/Project/Combine Internal/Project/Project Internal/Serialization
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Mon Jul 11 10:51:40 EDT 2005
Author: lluis
Date: 2005-07-11 10:51:40 -0400 (Mon, 11 Jul 2005)
New Revision: 2626
Added:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryCollection.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationEventHandler.cs
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs
Log:
2005-07-11 Lluis Sanchez Gual <lluis at novell.com>
* Internal/Codons/Commands/CommandCodon.cs: Set the text and description
for custom commands.
* Internal/Codons/LanguageBinding/ILanguageBinding.cs:
CreateCompilationParameters now returns an ICloneable.
* Internal/Project/IConfiguration.cs: Added CopyFrom method.
* Internal/Project/AbstractConfiguration.cs:
* Internal/Project/AbstractProjectConfiguration.cs
* Internal/Project/DotNetProjectConfiguration.cs: Implement CopyFrom.
* Internal/Combine/Combine.cs: Added CreateConfiguration method.
When the active configuration is changed, propagate the change to all
children entries. When building a combine, build the child entries which
have the build flag in the active configuration.
* Internal/Project/DotNetProject.cs: CreateConfiguration is now defined
in CombineEntry.
* Internal/Combine/CombineEntry.cs: Make it extensible by implementing
IExtendedDataItem. Use the new ConfigurationCollection collection.
Added CreateConfiguration abtract method. Added ActiveConfigurationChanged
event. Moved CombineEntryCollection to its own file.
* Internal/Combine/ConfigurationCollection.cs: New class.
* Internal/Combine/CombineConfiguration.cs: Renamed the Config class to
CombineConfigurationEntry and made it public. Implemented CopyFrom.
* Internal/Combine/ConfigurationEventHandler.cs: New handler.
* Internal/Combine/CombineEntryCollection.cs: Moved from CombineEntry.cs.
* Internal/Serialization/ClassDataType.cs: Properties dynamically added
to a class must also be added to its subclasses.
* Internal/Serialization/ItemProperty.cs: Avoid crash in HasSetter for
properties not linked to a member (extended properties).
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/ChangeLog 2005-07-11 14:51:40 UTC (rev 2626)
@@ -1,3 +1,36 @@
+2005-07-11 Lluis Sanchez Gual <lluis at novell.com>
+
+ * Internal/Codons/Commands/CommandCodon.cs: Set the text and description
+ for custom commands.
+ * Internal/Codons/LanguageBinding/ILanguageBinding.cs:
+ CreateCompilationParameters now returns an ICloneable.
+
+ * Internal/Project/IConfiguration.cs: Added CopyFrom method.
+ * Internal/Project/AbstractConfiguration.cs:
+ * Internal/Project/AbstractProjectConfiguration.cs
+ * Internal/Project/DotNetProjectConfiguration.cs: Implement CopyFrom.
+
+ * Internal/Combine/Combine.cs: Added CreateConfiguration method.
+ When the active configuration is changed, propagate the change to all
+ children entries. When building a combine, build the child entries which
+ have the build flag in the active configuration.
+ * Internal/Project/DotNetProject.cs: CreateConfiguration is now defined
+ in CombineEntry.
+ * Internal/Combine/CombineEntry.cs: Make it extensible by implementing
+ IExtendedDataItem. Use the new ConfigurationCollection collection.
+ Added CreateConfiguration abtract method. Added ActiveConfigurationChanged
+ event. Moved CombineEntryCollection to its own file.
+ * Internal/Combine/ConfigurationCollection.cs: New class.
+ * Internal/Combine/CombineConfiguration.cs: Renamed the Config class to
+ CombineConfigurationEntry and made it public. Implemented CopyFrom.
+ * Internal/Combine/ConfigurationEventHandler.cs: New handler.
+ * Internal/Combine/CombineEntryCollection.cs: Moved from CombineEntry.cs.
+
+ * Internal/Serialization/ClassDataType.cs: Properties dynamically added
+ to a class must also be added to its subclasses.
+ * Internal/Serialization/ItemProperty.cs: Avoid crash in HasSetter for
+ properties not linked to a member (extended properties).
+
2005-07-11 Lluis Sanchez Gual <lluis at novell.com>
* Services/ParserService/AssemblyCodeCompletionDatabase.cs:
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/Commands/CommandCodon.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -120,6 +120,8 @@
throw new InvalidOperationException ("Array custom commands are not allowed.");
CustomCommand ccmd = new CustomCommand ();
+ ccmd.Text = label;
+ ccmd.Description = description;
ccmd.WidgetType = AddIn.GetType (widget);
if (ccmd.WidgetType == null)
throw new InvalidOperationException ("Could not find command type '" + widget + "'.");
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Codons/LanguageBinding/ILanguageBinding.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -38,7 +38,7 @@
void GenerateMakefile (Project project, Combine parentCombine);
- object CreateCompilationParameters (XmlElement projectOptions);
+ ICloneable CreateCompilationParameters (XmlElement projectOptions);
/// <summary>
/// Used by Comment and Uncomment operations and by Centaurus Addin.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/Combine.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -151,6 +151,22 @@
referenceRemovedFromProjectHandler = new ProjectReferenceEventHandler (NotifyReferenceRemovedFromProject);
}
+ public override IConfiguration CreateConfiguration (string name)
+ {
+ CombineConfiguration cc = new CombineConfiguration ();
+ cc.Name = name;
+ return cc;
+ }
+
+ protected override void OnActiveConfigurationChanged (ConfigurationEventArgs args)
+ {
+ foreach (CombineConfigurationEntry cce in ((CombineConfiguration)ActiveConfiguration).Entries) {
+ IConfiguration conf = cce.Entry.GetConfiguration (cce.ConfigurationName);
+ cce.Entry.ActiveConfiguration = conf;
+ }
+ base.OnActiveConfigurationChanged (args);
+ }
+
internal void NotifyEntryAdded (CombineEntry entry)
{
if (StartupEntry == null)
@@ -419,6 +435,29 @@
}
}
+ public CombineEntryCollection GetAllBuildableEntries (string configuration)
+ {
+ CombineEntryCollection list = new CombineEntryCollection();
+ GetAllBuildableEntries (list, configuration);
+ return list;
+ }
+
+ void GetAllBuildableEntries (CombineEntryCollection list, string configuration)
+ {
+ CombineConfiguration conf = (CombineConfiguration) GetConfiguration (configuration);
+ if (conf == null)
+ return;
+
+ foreach (CombineConfigurationEntry entry in conf.Entries) {
+ if (!entry.Build)
+ continue;
+ if (entry.Entry is Combine)
+ ((Combine)entry.Entry).GetAllBuildableEntries (list, configuration);
+ else if (entry.Entry is Project)
+ list.Add (entry.Entry);
+ }
+ }
+
public Project GetProjectEntryContaining (string fileName)
{
CombineEntryCollection projects = GetAllProjects ();
@@ -471,19 +510,19 @@
public override void Clean ()
{
- foreach (CombineEntry entry in Entries)
- entry.Clean ();
+ foreach (CombineConfigurationEntry cce in ((CombineConfiguration)ActiveConfiguration).Entries)
+ cce.Entry.Clean ();
}
public override ICompilerResult Build (IProgressMonitor monitor)
{
- CombineEntryCollection allProjects = GetAllProjects ();
- monitor.BeginTask ("Building Combine " + Name, allProjects.Count);
+ CombineEntryCollection allProjects = GetAllBuildableEntries (ActiveConfiguration.Name);
+ monitor.BeginTask (string.Format (GettextCatalog.GetString ("Building Solution {0}"), Name), allProjects.Count);
try {
CompilerResults cres = new CompilerResults (null);
try {
- allProjects = TopologicalSort(allProjects);
+ allProjects = TopologicalSort (allProjects);
} catch (CyclicBuildOrderException) {
monitor.ReportError (GettextCatalog.GetString ("Cyclic dependencies can not be built with this version.\nBut we are working on it."), null);
return new DefaultCompilerResult (cres, "", 1, 1);
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineConfiguration.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -24,40 +24,9 @@
public class CombineConfiguration : AbstractConfiguration
{
[ExpandedCollection]
- [ItemProperty ("Entry", ValueType=typeof(Config))]
+ [ItemProperty ("Entry", ValueType=typeof(CombineConfigurationEntry))]
ArrayList configurations = new ArrayList();
- [DataItem ("Entry")]
- public class Config
- {
- string entryName;
-
- [ItemProperty ("name")]
- string EntryName {
- get { return Entry != null ? Entry.Name : entryName; }
- set { entryName = value; }
- }
-
- public CombineEntry entry;
-
- //[ItemProperty ("configurationname")]
- public string ConfigurationName;
-
- [ItemProperty ("build")]
- public bool Build;
-
- public CombineEntry Entry {
- get { return entry; }
- set { entry = value; if (entry != null) entryName = entry.Name; }
- }
-
- internal void SetCombine (Combine combine)
- {
- if (entryName != null)
- Entry = combine.Entries [entryName];
- }
- }
-
public CombineConfiguration ()
{
}
@@ -69,33 +38,41 @@
internal void SetCombine (Combine combine)
{
- foreach (Config conf in configurations)
+ foreach (CombineConfigurationEntry conf in configurations) {
conf.SetCombine (combine);
+ if (conf.ConfigurationName == null)
+ conf.ConfigurationName = Name;
+ }
}
- public Config GetConfiguration(int number)
+ public ICollection Entries {
+ get { return configurations; }
+ }
+
+ public CombineConfigurationEntry GetConfiguration(int number)
{
if (number < configurations.Count) {
- return (Config)configurations[number];
+ return (CombineConfigurationEntry)configurations[number];
}
Debug.Assert(false, "Configuration number " + number + " not found.\n" + configurations.Count + " configurations avaiable.");
return null;
}
- public void AddEntry (CombineEntry combine)
+ public CombineConfigurationEntry AddEntry (CombineEntry combine)
{
- Config conf = new Config();
+ CombineConfigurationEntry conf = new CombineConfigurationEntry();
conf.Entry = combine;
conf.ConfigurationName = combine.ActiveConfiguration != null ? combine.ActiveConfiguration.Name : String.Empty;
conf.Build = true;
configurations.Add(conf);
+ return conf;
}
public void RemoveEntry (CombineEntry entry)
{
- Config removeConfig = null;
+ CombineConfigurationEntry removeConfig = null;
- foreach (Config config in configurations) {
+ foreach (CombineConfigurationEntry config in configurations) {
if (config.Entry == entry) {
removeConfig = config;
break;
@@ -105,5 +82,51 @@
Debug.Assert(removeConfig != null);
configurations.Remove(removeConfig);
}
+
+ public override void CopyFrom (IConfiguration configuration)
+ {
+ base.CopyFrom (configuration);
+ CombineConfiguration conf = (CombineConfiguration) configuration;
+
+ configurations.Clear ();
+ foreach (CombineConfigurationEntry cce in conf.configurations) {
+ CombineConfigurationEntry nc = new CombineConfigurationEntry ();
+ nc.Entry = cce.Entry;
+ nc.ConfigurationName = cce.ConfigurationName;
+ nc.Build = cce.Build;
+ configurations.Add (nc);
+ }
+ }
}
+
+ [DataItem ("Entry")]
+ public class CombineConfigurationEntry
+ {
+ string entryName;
+
+ [ItemProperty ("name")]
+ string EntryName {
+ get { return Entry != null ? Entry.Name : entryName; }
+ set { entryName = value; }
+ }
+
+ public CombineEntry entry;
+
+ [ItemProperty ("configuration")]
+ public string ConfigurationName;
+
+ [ItemProperty ("build")]
+ public bool Build;
+
+ public CombineEntry Entry {
+ get { return entry; }
+ set { entry = value; if (entry != null) entryName = entry.Name; }
+ }
+
+ internal void SetCombine (Combine combine)
+ {
+ if (entryName != null)
+ Entry = combine.Entries [entryName];
+ }
+ }
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntry.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -23,11 +23,12 @@
namespace MonoDevelop.Internal.Project
{
- public abstract class CombineEntry : ICustomDataItem, IDisposable
+ public abstract class CombineEntry : ICustomDataItem, IDisposable, IExtendedDataItem
{
[ItemProperty ("Configurations")]
[ItemProperty ("Configuration", ValueType=typeof(IConfiguration), Scope=1)]
- ArrayList configurations = new ArrayList();
+ ConfigurationCollection configurations = new ConfigurationCollection ();
+ Hashtable extendedProperties;
Combine parentCombine;
IConfiguration activeConfiguration;
@@ -37,7 +38,16 @@
IFileFormat fileFormat;
public event CombineEntryRenamedEventHandler NameChanged;
+ public event ConfigurationEventHandler ActiveConfigurationChanged;
+ IDictionary IExtendedDataItem.ExtendedProperties {
+ get {
+ if (extendedProperties == null)
+ extendedProperties = new Hashtable ();
+ return extendedProperties;
+ }
+ }
+
[ItemProperty ("name")]
public virtual string Name {
get {
@@ -116,7 +126,7 @@
parentCombine = combine;
}
- public ArrayList Configurations {
+ public ConfigurationCollection Configurations {
get {
return configurations;
}
@@ -130,7 +140,10 @@
return activeConfiguration;
}
set {
- activeConfiguration = value;
+ if (activeConfiguration != value) {
+ activeConfiguration = value;
+ OnActiveConfigurationChanged (new ConfigurationEventArgs (this, value));
+ }
}
}
@@ -158,6 +171,8 @@
activeConfiguration = GetConfiguration (ac.Value);
}
+ public abstract IConfiguration CreateConfiguration (string name);
+
public IConfiguration GetConfiguration (string name)
{
if (configurations != null) {
@@ -207,6 +222,12 @@
}
}
+ protected virtual void OnActiveConfigurationChanged (ConfigurationEventArgs args)
+ {
+ if (ActiveConfigurationChanged != null)
+ ActiveConfigurationChanged (this, args);
+ }
+
public abstract void Clean ();
public abstract ICompilerResult Build (IProgressMonitor monitor);
public abstract void Execute (IProgressMonitor monitor);
@@ -216,88 +237,5 @@
public virtual void GenerateMakefiles (Combine parentCombine)
{
}
-
}
-
- public interface ICombineEntryCollection: IEnumerable
- {
- int Count { get; }
- CombineEntry this [int n] { get; }
- }
-
- public class CombineEntryCollection: ICombineEntryCollection
- {
- ArrayList list = new ArrayList ();
- Combine parentCombine;
-
- internal CombineEntryCollection ()
- {
- }
-
- internal CombineEntryCollection (Combine combine)
- {
- parentCombine = combine;
- }
-
- public int Count
- {
- get { return list.Count; }
- }
-
- public CombineEntry this [int n]
- {
- get { return (CombineEntry) list[n]; }
- }
-
- public CombineEntry this [string name]
- {
- get {
- for (int n=0; n<list.Count; n++)
- if (((CombineEntry)list[n]).Name == name)
- return (CombineEntry)list[n];
- return null;
- }
- }
-
- public IEnumerator GetEnumerator ()
- {
- return list.GetEnumerator ();
- }
-
- public void Add (CombineEntry entry)
- {
- list.Add (entry);
- if (parentCombine != null) {
- entry.SetParentCombine (parentCombine);
- parentCombine.NotifyEntryAdded (entry);
- }
- }
-
- public void Remove (CombineEntry entry)
- {
- list.Remove (entry);
- if (parentCombine != null) {
- entry.SetParentCombine (null);
- parentCombine.NotifyEntryRemoved (entry);
- }
- }
-
- public int IndexOf (CombineEntry entry)
- {
- return list.IndexOf (entry);
- }
-
- public int IndexOf (string name)
- {
- for (int n=0; n<list.Count; n++)
- if (((CombineEntry)list[n]).Name == name)
- return n;
- return -1;
- }
-
- public void Clear ()
- {
- list.Clear ();
- }
- }
}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryCollection.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryCollection.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/CombineEntryCollection.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -0,0 +1,95 @@
+// <file>
+// <copyright see="prj:///doc/copyright.txt"/>
+// <license see="prj:///doc/license.txt"/>
+// <owner name="Mike Krüger" email="mike at icsharpcode.net"/>
+// <version value="$version"/>
+// </file>
+
+using System;
+using System.Collections;
+using MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Internal.Project
+{
+ public interface ICombineEntryCollection: IEnumerable
+ {
+ int Count { get; }
+ CombineEntry this [int n] { get; }
+ }
+
+ public class CombineEntryCollection: ICombineEntryCollection
+ {
+ ArrayList list = new ArrayList ();
+ Combine parentCombine;
+
+ internal CombineEntryCollection ()
+ {
+ }
+
+ internal CombineEntryCollection (Combine combine)
+ {
+ parentCombine = combine;
+ }
+
+ public int Count
+ {
+ get { return list.Count; }
+ }
+
+ public CombineEntry this [int n]
+ {
+ get { return (CombineEntry) list[n]; }
+ }
+
+ public CombineEntry this [string name]
+ {
+ get {
+ for (int n=0; n<list.Count; n++)
+ if (((CombineEntry)list[n]).Name == name)
+ return (CombineEntry)list[n];
+ return null;
+ }
+ }
+
+ public IEnumerator GetEnumerator ()
+ {
+ return list.GetEnumerator ();
+ }
+
+ public void Add (CombineEntry entry)
+ {
+ list.Add (entry);
+ if (parentCombine != null) {
+ entry.SetParentCombine (parentCombine);
+ parentCombine.NotifyEntryAdded (entry);
+ }
+ }
+
+ public void Remove (CombineEntry entry)
+ {
+ list.Remove (entry);
+ if (parentCombine != null) {
+ entry.SetParentCombine (null);
+ parentCombine.NotifyEntryRemoved (entry);
+ }
+ }
+
+ public int IndexOf (CombineEntry entry)
+ {
+ return list.IndexOf (entry);
+ }
+
+ public int IndexOf (string name)
+ {
+ for (int n=0; n<list.Count; n++)
+ if (((CombineEntry)list[n]).Name == name)
+ return n;
+ return -1;
+ }
+
+ public void Clear ()
+ {
+ list.Clear ();
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationCollection.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -0,0 +1,77 @@
+//
+// ConfigurationCollection.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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;
+
+using MonoDevelop.Internal.Project;
+using MonoDevelop.Internal.Serialization;
+
+using MonoDevelop.Core.Properties;
+
+namespace MonoDevelop.Internal.Project
+{
+ public class ConfigurationCollection : CollectionBase
+ {
+ public int Add (IConfiguration config)
+ {
+ return List.Add (config);
+ }
+
+ public new IConfiguration this [int index] {
+ get {
+ return (IConfiguration) List [index];
+ }
+ }
+
+ public IConfiguration this [string name] {
+ get {
+ foreach (IConfiguration c in this)
+ if (c.Name == name)
+ return c;
+ return null;
+ }
+ }
+
+ public void Remove (IConfiguration config)
+ {
+ List.Remove (config);
+ }
+
+ public void Remove (string name)
+ {
+ for (int n=0; n<Count; n++) {
+ if (this [n].Name == name) {
+ List.RemoveAt (n);
+ return;
+ }
+ }
+ }
+ }
+}
Added: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationEventHandler.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationEventHandler.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Combine/ConfigurationEventHandler.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -0,0 +1,52 @@
+//
+// ConfigurationEventHandler.cs
+//
+// Author:
+// Lluis Sanchez Gual
+//
+// Copyright (C) 2005 Novell, Inc (http://www.novell.com)
+//
+// 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 MonoDevelop.Internal.Project;
+
+namespace MonoDevelop.Internal.Project
+{
+ public delegate void ConfigurationEventHandler (object sender, ConfigurationEventArgs e);
+
+ public class ConfigurationEventArgs : CombineEntryEventArgs
+ {
+ IConfiguration configuration;
+
+ public ConfigurationEventArgs (CombineEntry entry, IConfiguration configuration): base (entry)
+ {
+ this.configuration = configuration;
+ }
+
+ public IConfiguration Configuration {
+ get {
+ return configuration;
+ }
+ }
+ }
+}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractConfiguration.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -5,6 +5,7 @@
// <version value="$version"/>
// </file>
+using System;
using System.Xml;
using MonoDevelop.Internal.Project;
using MonoDevelop.Internal.Serialization;
@@ -26,9 +27,28 @@
public object Clone()
{
- return MemberwiseClone();
+ IConfiguration conf = (IConfiguration) System.Activator.CreateInstance (GetType());
+ conf.Name = Name;
+ conf.CopyFrom (this);
+ return conf;
}
+ public virtual void CopyFrom (IConfiguration configuration)
+ {
+ AbstractConfiguration other = (AbstractConfiguration) configuration;
+ if (other.properties != null) {
+ properties = new Hashtable ();
+ foreach (DictionaryEntry e in other.properties) {
+ if (e.Value is ICloneable)
+ properties [e.Key] = ((ICloneable)e.Value).Clone ();
+ else
+ properties [e.Key] = e.Value;
+ }
+ }
+ else
+ properties = null;
+ }
+
public override string ToString()
{
return name;
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/AbstractProjectConfiguration.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -99,5 +99,21 @@
get { return pauseconsoleoutput; }
set { pauseconsoleoutput = value; }
}
+
+ public override void CopyFrom (IConfiguration configuration)
+ {
+ base.CopyFrom (configuration);
+ AbstractProjectConfiguration conf = (AbstractProjectConfiguration) configuration;
+
+ directory = conf.directory;
+ executeScript = conf.executeScript;
+ executeBeforeBuild = conf.executeBeforeBuild;
+ executeAfterBuild = conf.executeAfterBuild;
+ runWithWarnings = conf.runWithWarnings;
+ debugmode = conf.debugmode;
+ commandLineParameters = conf.commandLineParameters;
+ externalConsole = conf.externalConsole;
+ pauseconsoleoutput = conf.pauseconsoleoutput;
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProject.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -57,13 +57,11 @@
language = languageName;
languageBinding = FindLanguage (language);
- DotNetProjectConfiguration configuration = CreateConfiguration ();
- configuration.Name = "Debug";
+ DotNetProjectConfiguration configuration = (DotNetProjectConfiguration) CreateConfiguration ("Debug");
configuration.CompilationParameters = languageBinding.CreateCompilationParameters (projectOptions);
Configurations.Add (configuration);
- configuration = CreateConfiguration ();
- configuration.Name = "Release";
+ configuration = (DotNetProjectConfiguration) CreateConfiguration ("Release");
configuration.DebugMode = false;
configuration.CompilationParameters = languageBinding.CreateCompilationParameters (projectOptions);
Configurations.Add (configuration);
@@ -97,9 +95,12 @@
return binding;
}
- protected virtual DotNetProjectConfiguration CreateConfiguration ()
+ public override IConfiguration CreateConfiguration (string name)
{
- return new DotNetProjectConfiguration ();
+ DotNetProjectConfiguration conf = new DotNetProjectConfiguration ();
+ conf.Name = name;
+ conf.CompilationParameters = languageBinding.CreateCompilationParameters (null);
+ return conf;
}
protected override ICompilerResult DoBuild (IProgressMonitor monitor)
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/DotNetProjectConfiguration.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -57,7 +57,7 @@
CompileTarget compiletarget = CompileTarget.Exe;
[ItemProperty ("CodeGeneration")]
- object compilationParameters;
+ ICloneable compilationParameters;
string sourcePath;
@@ -76,7 +76,7 @@
set { compiletarget = value; }
}
- public object CompilationParameters {
+ public ICloneable CompilationParameters {
get { return compilationParameters; }
set { compilationParameters = value; }
}
@@ -89,5 +89,17 @@
get { return sourcePath; }
set { sourcePath = value; }
}
+
+ public override void CopyFrom (IConfiguration configuration)
+ {
+ base.CopyFrom (configuration);
+ DotNetProjectConfiguration conf = (DotNetProjectConfiguration) configuration;
+
+ assembly = conf.assembly;
+ netRuntime = conf.netRuntime;
+ compiletarget = conf.compiletarget;
+ sourcePath = conf.sourcePath;
+ compilationParameters = conf.compilationParameters != null ? (ICloneable)conf.compilationParameters.Clone () : null;
+ }
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Project/Project/IConfiguration.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -22,5 +22,7 @@
get;
set;
}
+
+ void CopyFrom (IConfiguration configuration);
}
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ClassDataType.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -141,6 +141,11 @@
throw new InvalidOperationException ("Duplicate property '" + prop.Name + "' in class '" + ValueType);
properties.Add (prop.Name, prop);
sortedPoperties.Add (prop);
+
+ if (subtypes != null && subtypes.Count > 0) {
+ foreach (ClassDataType subtype in subtypes)
+ subtype.AddProperty (prop);
+ }
}
Exception CreateNestedConflictException (ItemProperty p1, ItemProperty p2)
@@ -294,9 +299,9 @@
object pval = GetPropValue (prop, obj);
if (pval == null) {
if (prop.HasSetter)
- throw new InvalidOperationException ("The property is null and a new instance of '" + prop.PropertyType + "' can't be created.");
+ throw new InvalidOperationException ("The property '" + prop.Name + "' is null and a new instance of '" + prop.PropertyType + "' can't be created.");
else
- throw new InvalidOperationException ("The property is null and it does not have a setter.");
+ throw new InvalidOperationException ("The property '" + prop.Name + "' is null and it does not have a setter.");
}
prop.Deserialize (serCtx, value, pval);
} else {
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs 2005-07-11 14:19:57 UTC (rev 2625)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Base/Internal/Serialization/ItemProperty.cs 2005-07-11 14:51:40 UTC (rev 2626)
@@ -169,7 +169,7 @@
}
internal bool HasSetter {
- get { return (member is FieldInfo) || ((member is PropertyInfo) && ((PropertyInfo)member).CanWrite); }
+ get { return member == null || (member is FieldInfo) || ((member is PropertyInfo) && ((PropertyInfo)member).CanWrite); }
}
internal DataNode Serialize (SerializationContext serCtx, object value)
More information about the Monodevelop-patches-list
mailing list