[Monodevelop-patches-list] r2636 - in trunk/MonoDevelop/Core/src/MonoDevelop.Core: . AddIns
Lluis Sanchez <lluis@ximian.com>
lluis at mono-cvs.ximian.com
Wed Jul 13 11:31:13 EDT 2005
Author: lluis
Date: 2005-07-13 11:31:13 -0400 (Wed, 13 Jul 2005)
New Revision: 2636
Modified:
trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddIn.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInCollection.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInLoadException.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs
trunk/MonoDevelop/Core/src/MonoDevelop.Core/ChangeLog
Log:
2005-07-13 Lluis Sanchez Gual <lluis at novell.com>
* AddIns/AddIn.cs:
* AddIns/AddInTreeSingleton.cs:
* AddIns/AddInCollection.cs:
* AddIns/AddInLoadException.cs: Implemented some basic support for
declaring addin dependencies.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddIn.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddIn.cs 2005-07-13 15:27:46 UTC (rev 2635)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddIn.cs 2005-07-13 15:31:13 UTC (rev 2636)
@@ -181,6 +181,10 @@
throw new AddInLoadException("No or malformed 'AddIn' node");
}
+ XmlElement deps = doc.DocumentElement ["Dependencies"];
+ if (deps != null)
+ CheckDependencies (deps);
+
foreach (object o in doc.DocumentElement.ChildNodes) {
if (o is XmlElement) {
XmlElement curEl = (XmlElement)o;
@@ -227,6 +231,25 @@
extensions.Add(e);
}
+ void CheckDependencies (XmlElement deps)
+ {
+ if (deps != null) {
+ foreach (object o in deps.ChildNodes) {
+ XmlElement dep = o as XmlElement;
+ if (dep == null) continue;
+ switch (dep.LocalName) {
+ case "AddIn": {
+ string aname = dep.GetAttribute ("name");
+ AddIn addin = AddInTreeSingleton.AddInTree.AddIns [aname];
+ if (addin == null)
+ throw new MissingDependencyException ("Addin: " + aname);
+ break;
+ }
+ }
+ }
+ }
+ }
+
/// <summary>
/// Autoinitialized all fields of the customizer object to the values
/// in the codonNode using the XmlMemberAttributeAttribute.
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInCollection.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInCollection.cs 2005-07-13 15:27:46 UTC (rev 2635)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInCollection.cs 2005-07-13 15:31:13 UTC (rev 2636)
@@ -46,6 +46,16 @@
}
}
+ public AddIn this [string name]
+ {
+ get {
+ foreach (AddIn addin in List)
+ if (addin.Name == name)
+ return addin;
+ return null;
+ }
+ }
+
/// <summary>
/// <para>Adds a <see cref="AddIn"/> with the specified value to the
/// <see cref="AddInCollection"/> .</para>
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInLoadException.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInLoadException.cs 2005-07-13 15:27:46 UTC (rev 2635)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInLoadException.cs 2005-07-13 15:31:13 UTC (rev 2636)
@@ -21,4 +21,11 @@
{
}
}
+
+ public class MissingDependencyException: Exception
+ {
+ public MissingDependencyException (string message): base (message)
+ {
+ }
+ }
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs 2005-07-13 15:27:46 UTC (rev 2635)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Core/AddIns/AddInTreeSingleton.cs 2005-07-13 15:31:13 UTC (rev 2636)
@@ -67,6 +67,10 @@
retryList.Add(addInFile);
} catch (ConditionNotFoundException) {
retryList.Add(addInFile);
+ } catch (MissingDependencyException) {
+ // Try to load the addin later. Maybe it depends on an
+ // addin that has not yet been loaded.
+ retryList.Add(addInFile);
} catch (Exception e) {
throw new AddInInitializeException(addInFile, e);
}
Modified: trunk/MonoDevelop/Core/src/MonoDevelop.Core/ChangeLog
===================================================================
--- trunk/MonoDevelop/Core/src/MonoDevelop.Core/ChangeLog 2005-07-13 15:27:46 UTC (rev 2635)
+++ trunk/MonoDevelop/Core/src/MonoDevelop.Core/ChangeLog 2005-07-13 15:31:13 UTC (rev 2636)
@@ -1,3 +1,11 @@
+2005-07-13 Lluis Sanchez Gual <lluis at novell.com>
+
+ * AddIns/AddIn.cs:
+ * AddIns/AddInTreeSingleton.cs:
+ * AddIns/AddInCollection.cs:
+ * AddIns/AddInLoadException.cs: Implemented some basic support for
+ declaring addin dependencies.
+
2005-06-27 John Luke <john.luke at gmail.com>
* MonoDevelop.Core.mdp:
More information about the Monodevelop-patches-list
mailing list