Author: lluis
Date: 2006-05-31 08:36:02 -0400 (Wed, 31 May 2006)
New Revision: 61315
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinPackage.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInTreeSingleton.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
Log:
2006-05-31 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.Core.AddIns.Setup/AddinInfo.cs:
* MonoDevelop.Core.AddIns/AddIn.cs: Implemented support for optional
extensions in add-ins.
* MonoDevelop.Core.AddIns/AddInService.cs: Don't crash if pre-loading
of an add-in fails, just report the error. While resolving deps and
preloading add-ins, take into account disabled add-ins.
* MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs:
* MonoDevelop.Core.AddIns.Setup/SetupService.cs:
* MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs: Implement support
for enabling/disabling add-ins.
* MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs:
* MonoDevelop.Core.AddIns/AddInTreeSingleton.cs: Removed unused code.
* MonoDevelop.Core/PropertyService.cs:
* MonoDevelop.Core.AddIns.Setup/AddinPackage.cs: Fix warning.
Modified: trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog
===================================================================
--- trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog 2006-05-31
12:11:22 UTC (rev 61314)
+++ trunk/monodevelop/Core/src/MonoDevelop.Core/ChangeLog 2006-05-31
12:36:02 UTC (rev 61315)
@@ -1,3 +1,25 @@
+2006-05-31 Lluis Sanchez Gual <[EMAIL PROTECTED]>
+
+ * MonoDevelop.Core.AddIns.Setup/AddinInfo.cs:
+ * MonoDevelop.Core.AddIns/AddIn.cs: Implemented support for optional
+ extensions in add-ins.
+
+ * MonoDevelop.Core.AddIns/AddInService.cs: Don't crash if pre-loading
+ of an add-in fails, just report the error. While resolving deps and
+ preloading add-ins, take into account disabled add-ins.
+
+ * MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs:
+ * MonoDevelop.Core.AddIns.Setup/SetupService.cs:
+ * MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs: Implement support
+ for enabling/disabling add-ins.
+
+ * MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs:
+ * MonoDevelop.Core.AddIns/AddInTreeSingleton.cs: Removed unused code.
+
+ * MonoDevelop.Core/PropertyService.cs:
+ * MonoDevelop.Core.AddIns.Setup/AddinPackage.cs: Fix warning.
+
+
2006-05-05 Lluis Sanchez Gual <[EMAIL PROTECTED]>
* MonoDevelop.Core.AddIns/AddInService.cs: Throw an UserException if
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core/PropertyService.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -103,7 +103,7 @@
return false;
}
SetValueFromXmlElement(doc.DocumentElement["Properties"]);
- } catch (Exception e) {
+ } catch {
//Console.WriteLine("Exception while load
properties from stream :\n " + e.ToString());
return false;
}
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddIn.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -178,7 +178,7 @@
/// Initializes this addIn. It loads the xml definition in file
/// fileName.
/// </summary>
- public void Initialize(string fileName)
+ public void Initialize (string fileName)
{
this.fileName = fileName;
@@ -204,20 +204,30 @@
version = doc.DocumentElement.GetAttribute ("version");
XmlElement deps = doc.DocumentElement ["Dependencies"];
- if (deps != null)
- CheckDependencies (deps);
+ CheckDependencies (deps, true);
- foreach (object o in doc.DocumentElement.ChildNodes) {
+ ReadXmlContents (fileName, doc.DocumentElement);
+ }
+
+ void ReadXmlContents (string fileName, XmlElement elem)
+ {
+ foreach (object o in elem.ChildNodes) {
if (o is XmlElement) {
XmlElement curEl = (XmlElement)o;
switch (curEl.Name) {
case "Runtime":
-
AddRuntimeLibraries(Path.GetDirectoryName(fileName), curEl);
+ AddRuntimeLibraries
(Path.GetDirectoryName (fileName), curEl);
break;
case "Extension":
AddExtensions(curEl);
break;
+ case "Module":
+ // Load the module if
all dependencies can be satisfied
+ XmlElement deps = curEl
["Dependencies"];
+ if (CheckDependencies
(deps, false))
+ ReadXmlContents
(fileName, curEl);
+ break;
}
}
}
@@ -253,7 +263,7 @@
AddCodonsToExtension(e, el, new ConditionCollection());
}
- void CheckDependencies (XmlElement deps)
+ bool CheckDependencies (XmlElement deps, bool rootDependencies)
{
if (deps != null) {
ArrayList list = new ArrayList ();
@@ -269,8 +279,18 @@
throw new
InvalidOperationException ("Missing version attribute in AddIn dependency
element");
AddIn addin =
AddInTreeSingleton.AddInTree.AddIns [aname];
- if (addin == null)
- throw new
MissingDependencyException ("Required add-in not found: " + aname);
+ if (addin == null) {
+ if
(rootDependencies)
+ throw
new MissingDependencyException ("Required add-in not found: " + aname);
+ else {
+ // The
add-in is installed, but not yet loaded
+ if
(Runtime.SetupService.CheckInstalledAddin (aname, aversion) &&
Runtime.SetupService.IsAddinEnabled (aname))
+
throw new MissingDependencyException ("Required add-in not loaded: " + aname);
+ return
false;
+ }
+ }
+ else
+ list.Add
(addin);
// Make sure the
installed version is the required one.
if
(!Runtime.SetupService.CheckInstalledAddin (aname, aversion))
@@ -281,14 +301,20 @@
}
case "Assembly": {
string aname =
dep.GetAttribute ("name");
- if
(Runtime.SystemAssemblyService.GetAssemblyLocation (aname) == null)
- throw new
MissingDependencyException ("Required assembly not found: " + aname);
+ if
(Runtime.SystemAssemblyService.GetAssemblyLocation (aname) == null) {
+ if
(rootDependencies)
+ throw
new MissingDependencyException ("Required assembly not found: " + aname);
+ else
+ return
false;
+ }
break;
}
}
}
- dependencies = (AddIn[]) list.ToArray
(typeof(AddIn));
+ if (rootDependencies)
+ dependencies = (AddIn[]) list.ToArray
(typeof(AddIn));
}
+ return true;
}
/// <summary>
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInService.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -137,7 +137,7 @@
foreach (ExtensionRelation rel in
ads.ExtensionRelations) {
if ((rel.Path + "/").StartsWith
(ppath)) {
foreach (string addin in
rel.AddIns)
- if (!addins.Contains
(addin) && !IsAddinLoaded (addin))
+ if (!addins.Contains
(addin) && !IsAddinLoaded (addin) && Runtime.SetupService.IsAddinEnabled
(addin))
addins.Add
(addin);
}
}
@@ -149,7 +149,11 @@
try {
monitor.BeginTask
(GettextCatalog.GetString("Loading Add-ins"), addins.Count);
foreach (string id in addins) {
- PreloadAddin (monitor, id);
+ try {
+ PreloadAddin (monitor,
id);
+ } catch (Exception ex) {
+ ReportLoadError (new
AddinError (id, ex, false));
+ }
monitor.Step (1);
}
} finally {
@@ -162,13 +166,16 @@
{
if (IsAddinLoaded (id))
return;
+
+ if (!Runtime.SetupService.IsAddinEnabled (id))
+ throw new InvalidOperationException
(GettextCatalog.GetString ("The add-in {0} is disabled.", id));
if (monitor == null)
monitor = new
MonoDevelop.Core.ProgressMonitoring.NullProgressMonitor ();
ArrayList addins = new ArrayList ();
Stack depCheck = new Stack ();
- ResolveLoadDependencies (addins, depCheck, id, null);
+ ResolveLoadDependencies (addins, depCheck, id, null,
false);
addins.Reverse ();
monitor.BeginTask (GettextCatalog.GetString("Loading
Addins"), addins.Count);
@@ -201,10 +208,10 @@
}
}
- void ResolveLoadDependencies (ArrayList addins, Stack depCheck,
string id, string version)
+ bool ResolveLoadDependencies (ArrayList addins, Stack depCheck,
string id, string version, bool optional)
{
if (IsAddinLoaded (id))
- return;
+ return true;
if (depCheck.Contains (id))
throw new InvalidOperationException ("A cyclic
addin dependency has been detected.");
@@ -212,9 +219,15 @@
depCheck.Push (id);
AddinSetupInfo iad =
Runtime.SetupService.GetInstalledAddin (id);
- if (iad == null || (version != null &&
!iad.Addin.SupportsVersion (version)))
- throw new ArgumentException ("The addin '" + id
+ "' v" + version + " is not installed.");
-
+ if (iad == null || (version != null &&
!iad.Addin.SupportsVersion (version)) || !iad.Enabled) {
+ if (optional)
+ return false;
+ else if (iad != null && !iad.Enabled)
+ throw new MissingDependencyException
(GettextCatalog.GetString ("The required addin '{0}' v{1} is disabled.", id,
version));
+ else
+ throw new MissingDependencyException
(GettextCatalog.GetString ("The required addin '{0}' v{1} is not installed.",
id, version));
+ }
+
// If this addin has already been requested, bring it
to the head
// of the list, so it is loaded earlier than before.
addins.Remove (iad);
@@ -222,11 +235,30 @@
foreach (PackageDependency dep in
iad.Addin.Dependencies) {
AddinDependency adep = dep as AddinDependency;
- if (adep != null)
- ResolveLoadDependencies (addins,
depCheck, adep.AddinId, adep.Version);
+ if (adep != null) {
+ try {
+ ResolveLoadDependencies
(addins, depCheck, adep.AddinId, adep.Version, false);
+ } catch (MissingDependencyException) {
+ if (optional)
+ return false;
+ else
+ throw;
+ }
+ }
}
+
+ if (iad.Addin.OptionalDependencies != null) {
+ foreach (PackageDependency dep in
iad.Addin.OptionalDependencies) {
+ AddinDependency adep = dep as
AddinDependency;
+ if (adep != null) {
+ if (!ResolveLoadDependencies
(addins, depCheck, adep.AddinId, adep.Version, true))
+ return false;
+ }
+ }
+ }
depCheck.Pop ();
+ return true;
}
void ReportLoadError (AddinError err)
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInTreeSingleton.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInTreeSingleton.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/AddInTreeSingleton.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -21,10 +21,6 @@
public class AddInTreeSingleton
{
static DefaultAddInTree addInTree = null;
- readonly static string defaultCoreDirectory =
- PropertyService.EntryAssemblyDirectory +
Path.DirectorySeparatorChar + ".." + Path.DirectorySeparatorChar + "AddIns";
- static bool ignoreDefaultCoreDirectory = false;
- static string[] addInDirectories = null;
/// <summary>
/// Returns an <see cref="IAddInTree"/> object.
@@ -47,28 +43,9 @@
// something went wrong
return false;
}
- AddInTreeSingleton.addInDirectories = addInDirectories;
- AddInTreeSingleton.ignoreDefaultCoreDirectory =
ignoreDefaultCoreDirectory;
return true;
}
-
- static StringCollection InsertAddIns (StringCollection
addInFiles, out AddinError[] errors)
- {
- StringCollection retryList = new StringCollection();
- ArrayList list = new ArrayList ();
-
- foreach (string addInFile in addInFiles) {
- AddinError error = InsertAddIn (addInFile);
- if (error != null) {
- retryList.Add (addInFile);
- list.Add (error);
- }
- }
-
- errors = (AddinError[]) list.ToArray
(typeof(AddinError));
- return retryList;
- }
-
+
internal static AddinError InsertAddIn (string addInFile)
{
AddIn addIn = new AddIn();
@@ -97,57 +74,6 @@
addInTree = new DefaultAddInTree (loader);
}
- public static AddinError[] InitializeAddins ()
- {
- AssemblyLoader loader = new AssemblyLoader();
-
- try {
- loader.CheckAssembly (Assembly.GetEntryAssembly
());
- } catch (Exception ex) {
- AddinError err = new AddinError
(Assembly.GetEntryAssembly ().Location, ex, true);
- return new AddinError[] { err };
- }
-
- AddinError[] errors = null;
- addInTree = new DefaultAddInTree (loader);
-
- FileUtilityService fileUtilityService =
(FileUtilityService)ServiceManager.GetService(typeof(FileUtilityService));
-
- StringCollection addInFiles = null;
- StringCollection retryList = null;
-
- if (ignoreDefaultCoreDirectory == false) {
- addInFiles =
fileUtilityService.SearchDirectory(defaultCoreDirectory, "*.addin.xml");
- retryList = InsertAddIns (addInFiles, out
errors);
- }
- else
- retryList = new StringCollection();
-
- if (addInDirectories != null) {
- foreach(string path in addInDirectories) {
- addInFiles =
fileUtilityService.SearchDirectory(path, "*.addin.xml");
- StringCollection partialRetryList =
InsertAddIns (addInFiles, out errors);
- if (partialRetryList.Count != 0) {
- string [] retryListArray = new
string[partialRetryList.Count];
-
partialRetryList.CopyTo(retryListArray, 0);
-
retryList.AddRange(retryListArray);
- }
- }
- }
-
- while (retryList.Count > 0) {
- StringCollection newRetryList = InsertAddIns
(retryList, out errors);
-
- // break if no add-in could be inserted.
- if (newRetryList.Count == retryList.Count) {
- break;
- }
-
- retryList = newRetryList;
- }
-
- return errors;
- }
}
public class AddinError
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns/DumpAddinInfoApp.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -9,7 +9,6 @@
{
public class DumpAddinInfoApp: IApplication
{
- int extId;
ArrayList addins = new ArrayList ();
bool indent = true;
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinInfo.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -46,10 +46,12 @@
string description = "";
string category = "";
PackageDependencyCollection dependencies;
+ PackageDependencyCollection optionalDependencies;
public AddinInfo ()
{
dependencies = new PackageDependencyCollection ();
+ optionalDependencies = new PackageDependencyCollection
();
}
public string Id {
@@ -104,6 +106,13 @@
get { return dependencies; }
}
+ [XmlArrayItem ("AddinDependency", typeof(AddinDependency))]
+ [XmlArrayItem ("NativeDependency", typeof(NativeDependency))]
+ [XmlArrayItem ("AssemblyDependency",
typeof(AssemblyDependency))]
+ public PackageDependencyCollection OptionalDependencies {
+ get { return optionalDependencies; }
+ }
+
public static AddinInfo ReadFromAddinFile (StreamReader r)
{
XmlDocument doc = new XmlDocument ();
@@ -121,24 +130,32 @@
info.description = doc.DocumentElement.GetAttribute
("description");
info.category = doc.DocumentElement.GetAttribute
("category");
info.baseVersion = doc.DocumentElement.GetAttribute
("compatVersion");
+
+ ReadDependencies (info.Dependencies,
info.OptionalDependencies, doc.DocumentElement);
- foreach (XmlElement dep in doc.SelectNodes
("AddIn/Dependencies/AddIn")) {
+ return info;
+ }
+
+ static void ReadDependencies (PackageDependencyCollection deps,
PackageDependencyCollection opDeps, XmlElement elem)
+ {
+ foreach (XmlElement dep in elem.SelectNodes
("Dependencies/AddIn")) {
AddinDependency adep = new AddinDependency ();
adep.AddinId = dep.GetAttribute ("id");
string v = dep.GetAttribute ("version");
if (v.Length != 0)
adep.Version = v;
- info.Dependencies.Add (adep);
+ deps.Add (adep);
}
- foreach (XmlElement dep in doc.SelectNodes
("AddIn/Dependencies/Assembly")) {
+ foreach (XmlElement dep in elem.SelectNodes
("Dependencies/Assembly")) {
AssemblyDependency adep = new
AssemblyDependency ();
adep.FullName = dep.GetAttribute ("name");
adep.Package = dep.GetAttribute ("package");
- info.Dependencies.Add (adep);
+ deps.Add (adep);
}
- return info;
+ foreach (XmlElement mod in elem.SelectNodes ("Module"))
+ ReadDependencies (opDeps, opDeps, mod);
}
public bool SupportsVersion (string version)
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinPackage.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinPackage.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinPackage.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -245,7 +245,7 @@
if (Directory.GetFiles (basePath).Length == 0) {
try {
Directory.Delete (basePath);
- } catch (Exception ex) {
+ } catch {
monitor.ReportWarning ("Directory " +
basePath + " could not be deleted.");
}
}
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSetupInfo.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -37,10 +37,9 @@
{
public class AddinSetupInfo
{
- public AddinInfo addin;
- public bool enabled;
- public string configFile;
- public string directory;
+ AddinInfo addin;
+ string configFile;
+ string directory;
public AddinSetupInfo (string file)
{
@@ -49,7 +48,6 @@
using (StreamReader s = new StreamReader (file)) {
addin = AddinInfo.ReadFromAddinFile (s);
}
- enabled = true;
}
public AddinInfo Addin {
@@ -57,8 +55,13 @@
}
public bool Enabled {
- get { return enabled; }
- set { enabled = value; }
+ get { return Runtime.SetupService.IsAddinEnabled
(addin.Id); }
+ set {
+ if (value)
+ Runtime.SetupService.EnableAddin
(addin.Id);
+ else
+ Runtime.SetupService.DisableAddin
(addin.Id);
+ }
}
public string ConfigFile {
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/AddinSystemConfiguration.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -28,6 +28,7 @@
using System;
using System.Collections;
+using System.Collections.Specialized;
using System.Xml;
using System.Xml.Serialization;
@@ -37,6 +38,7 @@
{
ArrayList repositories = new ArrayList ();
int repositoryIdCount = 0;
+ StringCollection disabledAddins = new StringCollection ();
[XmlArrayItem ("Repository", typeof(RepositoryRecord))]
public ArrayList Repositories {
@@ -47,5 +49,10 @@
get { return repositoryIdCount; }
set { repositoryIdCount = value; }
}
+
+ public StringCollection DisabledAddins {
+ get { return disabledAddins; }
+ set { disabledAddins = value; }
+ }
}
}
Modified:
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
===================================================================
---
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
2006-05-31 12:11:22 UTC (rev 61314)
+++
trunk/monodevelop/Core/src/MonoDevelop.Core/MonoDevelop.Core.AddIns.Setup/SetupService.cs
2006-05-31 12:36:02 UTC (rev 61315)
@@ -620,6 +620,25 @@
return addinSetupInfos;
}
+ internal bool IsAddinEnabled (string id)
+ {
+ return !Configuration.DisabledAddins.Contains (id);
+ }
+
+ internal void EnableAddin (string id)
+ {
+ Configuration.DisabledAddins.Remove (id);
+ SaveConfiguration ();
+ }
+
+ internal void DisableAddin (string id)
+ {
+ if (IsAddinEnabled (id)) {
+ Configuration.DisabledAddins.Add (id);
+ SaveConfiguration ();
+ }
+ }
+
internal AddInStatus GetAddInStatus ()
{
if (addinStatus != null) return addinStatus;
@@ -629,17 +648,7 @@
foreach (AddinSetupInfo ia in
InternalGetInstalledAddins ()) {
AddinConfiguration conf = ia.GetConfiguration
();
- foreach (XmlElement elem in
conf.Content.SelectNodes ("AddIn/Extension")) {
- string path = elem.GetAttribute
("path");
- AddChildExtensions (ia.Addin.Id, hash,
path, elem);
- }
- foreach (XmlElement elem in
conf.Content.SelectNodes ("AddIn/[EMAIL
PROTECTED]'/Workspace/Applications']/Class")) {
- ApplicationRecord arec = new
ApplicationRecord ();
- arec.Id = elem.GetAttribute ("id");
- arec.Description = elem.GetAttribute
("description");
- arec.AddIn = ia.Addin.Id;
- apps.Add (arec);
- }
+ CollectExtensionData
(conf.Content.DocumentElement, ia, hash, apps);
}
addinStatus = new AddInStatus ();
ExtensionRelation[] rels = new ExtensionRelation
[hash.Count];
@@ -656,6 +665,24 @@
return addinStatus;
}
+ void CollectExtensionData (XmlElement rootElem, AddinSetupInfo
ia, Hashtable hash, ArrayList apps)
+ {
+ foreach (XmlElement elem in rootElem.SelectNodes
("Extension")) {
+ string path = elem.GetAttribute ("path");
+ AddChildExtensions (ia.Addin.Id, hash, path,
elem);
+ }
+ foreach (XmlElement elem in rootElem.SelectNodes
("[EMAIL PROTECTED]'/Workspace/Applications']/Class")) {
+ ApplicationRecord arec = new ApplicationRecord
();
+ arec.Id = elem.GetAttribute ("id");
+ arec.Description = elem.GetAttribute
("description");
+ arec.AddIn = ia.Addin.Id;
+ apps.Add (arec);
+ }
+ foreach (XmlElement elem in rootElem.SelectNodes
("Module")) {
+ CollectExtensionData (elem, ia, hash, apps);
+ }
+ }
+
void AddChildExtensions (string addin, Hashtable hash, string
path, XmlElement elem)
{
ArrayList list = (ArrayList) hash [path];
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches