Load() private method

private Load ( Addin iad ) : AddinDescription
iad Addin
return Mono.Addins.Description.AddinDescription
Esempio n. 1
0
        bool InsertAddin(IProgressStatus statusMonitor, Addin iad)
        {
            try {
                RuntimeAddin p = new RuntimeAddin();

                // Read the config file and load the add-in assemblies
                AddinDescription description = p.Load(iad);

                // Register the add-in
                loadedAddins [Addin.GetIdName(p.Id)] = p;

                if (!AddinDatabase.RunningSetupProcess)
                {
                    // Load the extension points and other addin data

                    foreach (ExtensionNodeSet rel in description.ExtensionNodeSets)
                    {
                        RegisterNodeSet(rel);
                    }

                    foreach (ConditionTypeDescription cond in description.ConditionTypes)
                    {
                        Type ctype = p.GetType(cond.TypeName, true);
                        defaultContext.RegisterCondition(cond.Id, ctype);
                    }
                }

                foreach (ExtensionPoint ep in description.ExtensionPoints)
                {
                    InsertExtensionPoint(p, ep);
                }

                foreach (Assembly asm in p.Assemblies)
                {
                    loadedAssemblies [asm] = p;
                }

                // Fire loaded event
                defaultContext.NotifyAddinLoaded(p);
                AddinManager.ReportAddinLoad(p.Id);
                return(true);
            }
            catch (Exception ex) {
                AddinManager.ReportError("Extension could not be loaded", iad.Id, ex, false);
                if (statusMonitor != null)
                {
                    statusMonitor.ReportError("Extension '" + iad.Id + "' could not be loaded.", ex);
                }
                return(false);
            }
        }
Esempio n. 2
0
        bool InsertAddin(IProgressStatus statusMonitor, Addin iad)
        {
            try {
                RuntimeAddin p = new RuntimeAddin(this);

                // Read the config file and load the add-in assemblies
                AddinDescription description = p.Load(iad);

                // Register the add-in
                var loadedAddinsCopy = new Dictionary <string, RuntimeAddin> (loadedAddins);
                loadedAddinsCopy [Addin.GetIdName(p.Id)] = p;
                loadedAddins = loadedAddinsCopy;

                if (!AddinDatabase.RunningSetupProcess)
                {
                    // Load the extension points and other addin data

                    RegisterNodeSets(iad.Id, description.ExtensionNodeSets);

                    foreach (ConditionTypeDescription cond in description.ConditionTypes)
                    {
                        Type ctype = p.GetType(cond.TypeName, true);
                        RegisterCondition(cond.Id, ctype);
                    }
                }

                foreach (ExtensionPoint ep in description.ExtensionPoints)
                {
                    InsertExtensionPoint(p, ep);
                }

                // Fire loaded event
                NotifyAddinLoaded(p);
                ReportAddinLoad(p.Id);
                return(true);
            }
            catch (Exception ex) {
                ReportError("Add-in could not be loaded", iad.Id, ex, false);
                if (statusMonitor != null)
                {
                    statusMonitor.ReportError("Add-in '" + iad.Id + "' could not be loaded.", ex);
                }
                return(false);
            }
        }
Esempio n. 3
0
        bool InsertAddin(IProgressStatus statusMonitor, Addin iad)
        {
            try {
                RuntimeAddin p = new RuntimeAddin (this);

                // Read the config file and load the add-in assemblies
                AddinDescription description = p.Load (iad);

                // Register the add-in
                loadedAddins [Addin.GetIdName (p.Id)] = p;

                if (!AddinDatabase.RunningSetupProcess) {
                    // Load the extension points and other addin data

                    foreach (ExtensionNodeSet rel in description.ExtensionNodeSets) {
                        RegisterNodeSet (rel);
                    }

                    foreach (ConditionTypeDescription cond in description.ConditionTypes) {
                        Type ctype = p.GetType (cond.TypeName, true);
                        RegisterCondition (cond.Id, ctype);
                    }
                }

                foreach (ExtensionPoint ep in description.ExtensionPoints)
                    InsertExtensionPoint (p, ep);

                // Fire loaded event
                NotifyAddinLoaded (p);
                ReportAddinLoad (p.Id);
                return true;
            }
            catch (Exception ex) {
                ReportError ("Add-in could not be loaded", iad.Id, ex, false);
                if (statusMonitor != null)
                    statusMonitor.ReportError ("Add-in '" + iad.Id + "' could not be loaded.", ex);
                return false;
            }
        }