A list of extension nodes.
Inheritance: IEnumerable
Esempio n. 1
0
        internal bool NotifyChildChanged()
        {
            if (!childrenLoaded)
            {
                return(false);
            }

            ExtensionNodeList oldList = childNodes;

            childrenLoaded = false;

            bool changed = false;

            foreach (ExtensionNode nod in oldList)
            {
                if (ChildNodes [nod.Id] == null)
                {
                    changed = true;
                    OnChildNodeRemoved(nod);
                }
            }
            foreach (ExtensionNode nod in ChildNodes)
            {
                if (oldList [nod.Id] == null)
                {
                    changed = true;
                    OnChildNodeAdded(nod);
                }
            }
            if (changed)
            {
                OnChildrenChanged();
            }
            return(changed);
        }
Esempio n. 2
0
        public InternalBackendManager(IPreferences preferences)
        {
            if (preferences == null)
                throw new ArgumentNullException ("preferences");
            this.preferences = preferences;

            availableBackendNodes = AddinManager
                .GetExtensionNodes<BackendNode> (typeof(IBackend));

            taskLists = new TaskListCollection ();
        }
Esempio n. 3
0
        /// <summary>Load utility add-ins</summary>
        public void LoadUtilityAddins()
        {
            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.Utility);
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;

                try
                {
                    UtilityAddin utility = typeNode.CreateInstance() as UtilityAddin;

                    LoadUtilityAddin(utility, typeNode.Id, typeNode.TypeName);
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create UtilityAddin: " + ex.Message);
                }
            }
        }
Esempio n. 4
0
	Gtk.Menu BuildTemplateItems (ExtensionNodeList nodes)
	{
		Gtk.Menu menu = new Gtk.Menu ();
		foreach (ExtensionNode tn in nodes) {
			Gtk.MenuItem item;
			if (tn is TemplateCategoryNode) {
				TemplateCategoryNode cat = (TemplateCategoryNode) tn;
				item = new Gtk.MenuItem (cat.Name);
				item.Submenu = BuildTemplateItems (cat.ChildNodes);
			}
			else {
				FileTemplateNode t = (FileTemplateNode) tn;
				item = new Gtk.MenuItem (t.Name);
				item.Activated += delegate {
					TextEditor.TextEditorApp.NewFile (t.GetContent ());
				};
			}
			menu.Insert (item, -1);
		}
		return menu;
	}
Esempio n. 5
0
        public ExtensionNodeList GetExtensionNodes(string path, Type expectedNodeType)
        {
            TreeNode node = GetNode(path);

            if (node == null || node.ExtensionNode == null)
            {
                return(ExtensionNodeList.Empty);
            }

            ExtensionNodeList list = node.ExtensionNode.ChildNodes;

            if (expectedNodeType != null)
            {
                bool foundError = false;
                foreach (ExtensionNode cnode in list)
                {
                    if (!expectedNodeType.IsInstanceOfType(cnode))
                    {
                        foundError = true;
                        AddinManager.ReportError("Error while getting nodes for path '" + path + "'. Expected subclass of node type '" + expectedNodeType + "'. Found '" + cnode.GetType(), null, null, false);
                    }
                }
                if (foundError)
                {
                    // Create a new list excluding the elements that failed the test
                    ArrayList newList = new ArrayList();
                    foreach (ExtensionNode cnode in list)
                    {
                        if (expectedNodeType.IsInstanceOfType(cnode))
                        {
                            newList.Add(cnode);
                        }
                    }
                    return(new ExtensionNodeList(newList));
                }
            }
            return(list);
        }
Esempio n. 6
0
        public List <IPreferencePageExtension> GetPreferenceAddins()
        {
            List <IPreferencePageExtension> pages = new List <IPreferencePageExtension>();

            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.PreferencePage);
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;
                try
                {
                    IPreferencePageExtension page = typeNode.CreateInstance() as IPreferencePageExtension;
                    page.InitializePage();
                    page.Id = node.Id;
                    pages.Add(page);
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create PreferencePage: " + ex.Message);
                }
            }

            return(pages);
        }