Example #1
0
            public void Apply(IList items)
            {
                AddInTreeNode node;

                try
                {
                    node = AddInTree.GetTreeNode(path);
                    foreach (object o in node.BuildChildItems(caller))
                    {
                        items.Add(o);
                    }
                }
                catch (TreePathNotFoundException)
                {
                    MessageService.ShowError("IncludeDoozer: AddinTree-Path not found: " + path);
                }
            }
Example #2
0
 /// <summary>
 /// Initializes the AddIn system.
 /// This loads the AddIns that were added to the list,
 /// then it executes the <see cref="ICommand">commands</see>
 /// in <c>/Workspace/Autostart</c>.
 /// </summary>
 public void RunInitialization()
 {
     AddInTree.Load(addInFiles, disabledAddIns);
     // run workspace autostart commands
     LoggingService.Info("Running autostart commands...");
     foreach (ICommand command in AddInTree.BuildItems <ICommand>("/Workspace/Autostart", null, false))
     {
         try
         {
             command.Run();
         }
         catch (Exception ex)
         {
             // allow startup to continue if some commands fail
             MessageService.ShowError(ex);
         }
     }
 }
Example #3
0
        /// <summary>
        /// Adds the specified external AddIns to the list of registered external
        /// AddIns.
        /// </summary>
        /// <param name="addIns">
        /// The list of AddIns to add. (use <see cref="AddIn"/> instances
        /// created by <see cref="AddIn.Load(TextReader)"/>).
        /// </param>
        public static void AddExternalAddIns(IList <AddIn> addIns)
        {
            List <string> addInFiles = new List <string>();
            List <string> disabled   = new List <string>();

            LoadAddInConfiguration(addInFiles, disabled);

            foreach (AddIn addIn in addIns)
            {
                if (!addInFiles.Contains(addIn.FileName))
                {
                    addInFiles.Add(addIn.FileName);
                }
                addIn.Enabled = false;
                addIn.Action  = AddInAction.Install;
                AddInTree.InsertAddIn(addIn);
            }

            SaveAddInConfiguration(addInFiles, disabled);
        }
Example #4
0
        public object BuildItem(object caller, Codon codon, ArrayList subItems)
        {
            string item = codon.Properties["item"];
            string path = codon.Properties["path"];

            if (item != null && item.Length > 0)
            {
                // include item
                return(AddInTree.BuildItem(item, caller));
            }
            else if (path != null && path.Length > 0)
            {
                // include path (=multiple items)
                return(new IncludeReturnItem(caller, path));
            }
            else
            {
                MessageService.ShowMessage("<Include> requires the attribute 'item' (to include one item) or the attribute 'path' (to include multiple items)");
                return(null);
            }
        }
Example #5
0
        /// <summary>
        /// Removes the specified external AddIns from the list of registered external
        /// AddIns.
        /// </summary>
        /// The list of AddIns to remove.
        /// (use external AddIns from the <see cref="AddInTree.AddIns"/> collection).
        public static void RemoveExternalAddIns(IList <AddIn> addIns)
        {
            List <string> addInFiles = new List <string>();
            List <string> disabled   = new List <string>();

            LoadAddInConfiguration(addInFiles, disabled);

            foreach (AddIn addIn in addIns)
            {
                foreach (string identity in addIn.Manifest.Identities.Keys)
                {
                    disabled.Remove(identity);
                }
                addInFiles.Remove(addIn.FileName);
                addIn.Action = AddInAction.Uninstall;
                if (!addIn.Enabled)
                {
                    AddInTree.RemoveAddIn(addIn);
                }
            }

            SaveAddInConfiguration(addInFiles, disabled);
        }