/// <summary> /// Checks if the provided add-ins are installed, and requests the installation of those /// which aren't. /// </summary> /// <param name="message"> /// Message to show to the user when new add-ins have to be installed. /// </param> /// <param name="addinIds"> /// List of IDs of the add-ins to be checked. /// </param> /// <remarks> /// This method checks if the specified add-ins are installed. /// If some of the add-ins are not installed, it will use /// the installer assigned to the DefaultAddinInstaller property /// to install them. If the installation fails, or if DefaultAddinInstaller /// is not set, an exception will be thrown. /// </remarks> public void CheckInstalled(string message, params string[] addinIds) { ArrayList notInstalled = new ArrayList(); foreach (string id in addinIds) { Addin addin = Registry.GetAddin(id, false); if (addin != null) { // The add-in is already installed // If the add-in is disabled, enable it now if (!addin.Enabled) { addin.Enabled = true; } } else { notInstalled.Add(id); } } if (notInstalled.Count == 0) { return; } if (installer == null) { throw new InvalidOperationException("Add-in installer not set"); } // Install the add-ins installer.InstallAddins(Registry, message, (string[])notInstalled.ToArray(typeof(string))); }
public SelectNodeSetDialog (DotNetProject project, AddinRegistry registry, AddinDescription desc) { this.Build(); this.project = project; this.registry = registry; this.desc = desc; foreach (AddinDependency adep in desc.MainModule.Dependencies) { Addin addin = registry.GetAddin (adep.FullAddinId); if (addin != null && addin.Description != null) { foreach (ExtensionNodeSet ns in addin.Description.ExtensionNodeSets) { combo.AppendText (ns.Id); sets [ns.Id] = ns; } } } foreach (ExtensionNodeSet ns in desc.ExtensionNodeSets) { combo.AppendText (ns.Id); sets [ns.Id] = ns; } nodeseteditor.AllowEditing = false; buttonOk.Sensitive = false; }
public void Fill (AddinRegistry reg, ExtensionPoint ep) { List<AddinDescription> deps = new List<AddinDescription> (); foreach (var addinId in ep.ExtenderAddins) { Addin ad = reg.GetAddin (addinId); if (ad != null && ad.LocalId != ep.ParentAddinDescription.LocalId) deps.Add (ad.Description); } Fill (ep.ParentAddinDescription, ep.ParentAddinDescription, ep.Path, deps); }
public void Fill (AddinRegistry reg, AddinDescription localDesc, AddinDescription pdesc, string path) { List<AddinDescription> deps = new List<AddinDescription> (); foreach (Dependency dep in pdesc.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; Addin addin = reg.GetAddin (adep.FullAddinId); if (addin != null) deps.Add (addin.Description); } Fill (localDesc, pdesc, path, deps); }
internal static ExtensionNodeDescriptionCollection GetExtensionNodes (AddinRegistry registry, AddinDescription desc, string path) { ArrayList extensions = new ArrayList (); CollectExtensions (desc, path, extensions); foreach (Dependency dep in desc.MainModule.Dependencies) { AddinDependency adep = dep as AddinDependency; if (adep == null) continue; Addin addin = registry.GetAddin (adep.FullAddinId); if (addin != null) CollectExtensions (addin.Description, path, extensions); } // Sort the extensions, to make sure they are added in the correct order // That is, deepest children last. extensions.Sort (new ExtensionComparer ()); ExtensionNodeDescriptionCollection nodes = new ExtensionNodeDescriptionCollection (); // Add the nodes foreach (Extension ext in extensions) { string subp = path.Substring (ext.Path.Length); ExtensionNodeDescriptionCollection col = ext.ExtensionNodes; foreach (string p in subp.Split ('/')) { if (p.Length == 0) continue; ExtensionNodeDescription node = col [p]; if (node == null) { col = null; break; } else col = node.ChildNodes; } if (col != null) nodes.AddRange (col); } return nodes; }
ExtensionNodeSet FindNodeSet (AddinRegistry reg, AddinDescription adesc, string name) { ExtensionNodeSet nset = adesc.ExtensionNodeSets [name]; if (nset != null) return nset; foreach (AddinDependency adep in adesc.MainModule.Dependencies) { Addin addin = reg.GetAddin (adep.FullAddinId); if (addin != null) { nset = adesc.ExtensionNodeSets [name]; if (nset != null) return nset; } } return null; }