Exemple #1
0
        internal static void RemoveReferences(AddinData data, string[] fullIds)
        {
            AddinDescription     desc = data.LoadAddinManifest();
            AddinDescriptionView view = FindLoadedDescription(data);

            foreach (string ad in fullIds)
            {
                RemoveReference(desc, ad);
                if (view != null)
                {
                    RemoveReference(view.AddinDescription, ad);
                }
            }
            if (view != null)
            {
                view.Update();
                view.BeginInternalUpdate();
            }

            try {
                desc.Save();
                data.NotifyChanged(true);
            } finally {
                if (view != null)
                {
                    view.EndInternalUpdate();
                }
            }
        }
Exemple #2
0
        public void ApplyFeature(SolutionFolder parentCombine, SolutionItem entry, Widget ed)
        {
            AddinFeatureWidget editor = (AddinFeatureWidget)ed;
            AddinData          data   = AddinData.EnableAddinAuthoringSupport((DotNetProject)entry);

            DotNetProject project = (DotNetProject)entry;

            if (editor.HasRegistryInfo)
            {
                project.GetAddinData().ApplicationName = editor.ApplicationName;
            }

            AddinDescription desc = data.LoadAddinManifest();

            if (editor.AddinId.Length > 0)
            {
                desc.LocalId = editor.AddinId;
            }
            if (editor.AddinName.Length > 0)
            {
                desc.Name = editor.AddinName;
            }
            desc.Namespace = editor.AddinNamespace;
            desc.IsRoot    = project.CompileTarget != CompileTarget.Library || editor.IsRoot;
            desc.Version   = "1.0";
            desc.Save();
            data.NotifyChanged();
        }
Exemple #3
0
        public void OnAddExtension()
        {
            DotNetProject project = (DotNetProject)CurrentNode.DataItem;

            if (project == null)
            {
                return;
            }
            AddinData data = project.GetAddinData();

            if (project == null)
            {
                return;
            }

            AddinDescription adesc = data.CachedAddinManifest;

            ExtensionSelectorDialog dlg = new ExtensionSelectorDialog(data.AddinRegistry, adesc, adesc.IsRoot, false);

            if (dlg.Run() == (int)Gtk.ResponseType.Ok)
            {
                foreach (object ob in dlg.GetSelection())
                {
                    AddinDescription desc = null;
                    if (ob is ExtensionPoint)
                    {
                        ExtensionPoint ep  = (ExtensionPoint)ob;
                        Extension      ext = new Extension(ep.Path);
                        adesc.MainModule.Extensions.Add(ext);
                        desc = (AddinDescription)ep.Parent;
                    }
                    else if (ob is ExtensionNodeDescription)
                    {
                        ExtensionNodeDescription node = (ExtensionNodeDescription)ob;
                        desc = node.ParentAddinDescription;
                        string path = "";
                        while (node != null && !(node.Parent is Extension))
                        {
                            if (!node.IsCondition)
                            {
                                path = "/" + node.Id + path;
                            }
                            node = node.Parent as ExtensionNodeDescription;
                        }
                        Extension eext = (Extension)node.Parent;
                        Extension ext  = new Extension(eext.Path + "/" + node.Id + path);
                        adesc.MainModule.Extensions.Add(ext);
                    }
                    if (adesc.AddinId != desc.AddinId && !adesc.MainModule.DependsOnAddin(desc.AddinId))
                    {
                        adesc.MainModule.Dependencies.Add(new AddinDependency(desc.AddinId));
                    }
                }
                adesc.Save();
            }
            dlg.Destroy();
        }