Exemple #1
0
        private List <MenuItem> LoadMenuFromExtensionPoint()
        {
            Log.Debug("Entering");

            List <MenuItem> addinItems = new List <MenuItem>();

            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.SystemTray);

            Log.Debug($"Found '{nodes.Count}' items ...");
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;
                try
                {
                    SysTrayAddin addin = typeNode.CreateInstance() as SysTrayAddin;
                    Log.Debug($"SysTrayAdd-in [{addin.ToString()}]");

                    addinItems = addin.MenuItems();
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create SysTrayAddin instance: " + ex.Message);
                }
            }

            return(addinItems);
        }
        public void ReloadPages()
        {
            _preferencePages.Clear();

            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
                {
                    //BROKEN: 2018-12-05
                    //PreferencePageExtension instance = typeNode.CreateInstance() as PreferencePageExtension;
                    //InitPage(instance, typeNode.Id, typeNode.TypeName);
                }
                catch (Exception ex)
                {
                    Log.Error($"Couldn't initialize PreferencePage id '{typeNode.Id}': " + ex.Message);
                }
            }
        }
Exemple #3
0
        public void LoadAddinsForNote(Note note)
        {
            Mono.Addins.ExtensionNodeList list = Mono.Addins.AddinManager.GetExtensionNodes("/Tomboy/NoteAddins");
            foreach (Mono.Addins.ExtensionNode node in list)
            {
                Mono.Addins.TypeExtensionNode type_node =
                    node as Mono.Addins.TypeExtensionNode;

                try {
                    NoteAddin n_addin = type_node.CreateInstance() as NoteAddin;

                    // Keep track of the addins added to each note
                    AttachAddin(type_node.Id, note, n_addin);
                } catch (Exception e) {
                    Logger.Warn("Couldn't create a NoteAddin instance: {0}", e.Message);
                }
            }

            // Make sure we remove addins when a note is deleted
            note.Manager.NoteDeleted += OnNoteDeleted;
        }
Exemple #4
0
        AddinPreferenceFactory GetAddinPrefFactory(Mono.Addins.Addin addin)
        {
            Mono.Addins.ExtensionNode node =
                Mono.Addins.AddinManager.GetExtensionNode("/Tomboy/AddinPreferences");

            if (node != null)
            {
                Mono.Addins.ExtensionNodeList child_nodes = node.ChildNodes;
                if (child_nodes != null)
                {
                    foreach (Mono.Addins.ExtensionNode child_node in child_nodes)
                    {
                        if (addin.Id.StartsWith(child_node.Addin.Id))
                        {
                            AddinPreferenceFactory factory =
                                ((Mono.Addins.TypeExtensionNode)child_node).GetInstance() as AddinPreferenceFactory;
                            return(factory);
                        }
                    }
                }
            }

            return(null);
        }
Exemple #5
0
 /// <summary>
 /// Adds all commands.
 /// </summary>
 private void AddCommands()
 {
     commands = Mono.Addins.AddinManager.GetExtensionNodes(typeof(ITerminalCommand));
 }