An extension point definition.
Inheritance: ObjectDescription
コード例 #1
0
 /// <summary>
 /// Gets the type of the node.
 /// </summary>
 /// <returns>
 /// The node type.
 /// </returns>
 /// <remarks>
 /// This method only works when the add-in description to which the node belongs has been
 /// loaded from an add-in registry.
 /// </remarks>
 public ExtensionNodeType GetNodeType()
 {
     if (Parent is Extension)
     {
         Extension ext = (Extension)Parent;
         object    ob  = ext.GetExtendedObject();
         if (ob is ExtensionPoint)
         {
             ExtensionPoint ep = (ExtensionPoint)ob;
             return(ep.NodeSet.GetAllowedNodeTypes() [NodeName]);
         }
         else if (ob is ExtensionNodeDescription)
         {
             ExtensionNodeDescription pn = (ExtensionNodeDescription)ob;
             ExtensionNodeType        pt = ((ExtensionNodeDescription)pn).GetNodeType();
             if (pt != null)
             {
                 return(pt.GetAllowedNodeTypes() [NodeName]);
             }
         }
     }
     else if (Parent is ExtensionNodeDescription)
     {
         ExtensionNodeType pt = ((ExtensionNodeDescription)Parent).GetNodeType();
         if (pt != null)
         {
             return(pt.GetAllowedNodeTypes() [NodeName]);
         }
     }
     return(null);
 }
コード例 #2
0
ファイル: Util.cs プロジェクト: Kalnor/monodevelop
		public static string GetDisplayName (ExtensionPoint ep)
		{
			if (string.IsNullOrEmpty (ep.Name))
				return ep.Path;
			else
				return ep.Name;
		}
コード例 #3
0
        /// <summary>
        /// Adds an extension point.
        /// </summary>
        /// <returns>
        /// The extension point.
        /// </returns>
        /// <param name='path'>
        /// Path that identifies the new extension point.
        /// </param>
        public ExtensionPoint AddExtensionPoint(string path)
        {
            ExtensionPoint ep = new ExtensionPoint();

            ep.Path = path;
            ExtensionPoints.Add(ep);
            return(ep);
        }
		public ExtensionPointDetailWidget (ExtensionPoint ep)
		{
			this.ExtensionPoint = ep;

			BorderWidth = 12;

			PackStart (new Label { Markup = string.Format ("<big><tt>{0}</tt></big>\n{1}\n{2}", ep.Path, ep.Name, ep.Description)}, true, false, 0);

			ShowAll ();
		}
コード例 #5
0
		public void Fill (AddinRegistry reg, ExtensionPoint ep)
		{
			List<AddinDescription> deps = new List<AddinDescription> ();
			foreach (var addinId in ep.ExtenderAddins) {
				Addin ad = reg.GetAddin (addinId);
				if (ad != null && ad.LocalId != ep.ParentAddinDescription.LocalId)
					deps.Add (ad.Description);
			}
			Fill (ep.ParentAddinDescription, ep.ParentAddinDescription, ep.Path, deps);
		}
コード例 #6
0
		public NewExtensionPointDialog (DotNetProject project, AddinRegistry registry, AddinDescription adesc, ExtensionPoint ep)
		{
			this.Build();
			this.ep = ep;
			this.project = project;
			this.registry = registry;
			this.adesc = adesc;

			notebook.Page = 0;
			
			Fill ();
		}
コード例 #7
0
		internal void MergeWith (string thisAddinId, ExtensionPoint ep)
		{
			NodeSet.MergeWith (thisAddinId, ep.NodeSet);
			
			foreach (ConditionTypeDescription cond in ep.Conditions) {
				if (cond.AddinId != thisAddinId && !Conditions.Contains (cond))
					Conditions.Add (cond);
			}
			foreach (string s in ep.Addins) {
				if (!Addins.Contains (s))
					Addins.Add (s);
			}
		}
コード例 #8
0
		public void RegisterAddinRootExtensionPoint (AddinDescription description, ExtensionPoint ep)
		{
			ArrayList list = (ArrayList) pathHash [ep.Path];
			if (list == null) {
				list = new ArrayList ();
				pathHash [ep.Path] = list;
			}
			
			RootExtensionPoint rep = new RootExtensionPoint ();
			rep.Description = description;
			rep.ExtensionPoint = ep;
			ep.RootAddin = description.AddinId;
			list.Add (rep);
		}
コード例 #9
0
		/// <summary>
		/// Copies another extension point.
		/// </summary>
		/// <param name='ep'>
		/// Extension point from which to copy.
		/// </param>
		public void CopyFrom (ExtensionPoint ep)
		{
			path = ep.path;
			name = ep.name;
			description = ep.description;
			NodeSet.CopyFrom (ep.NodeSet);
			Conditions.Clear ();
			foreach (ConditionTypeDescription cond in ep.Conditions) {
				ConditionTypeDescription cc = new ConditionTypeDescription ();
				cc.CopyFrom (cond);
				Conditions.Add (cc);
			}
			Addins.Clear ();
			foreach (string s in ep.Addins)
				Addins.Add (s);
			rootAddin = ep.rootAddin;
		}
コード例 #10
0
ファイル: ExtensionPoint.cs プロジェクト: ewin66/mono-addins
        internal void MergeWith(string thisAddinId, ExtensionPoint ep)
        {
            NodeSet.MergeWith(thisAddinId, ep.NodeSet);

            foreach (ConditionTypeDescription cond in ep.Conditions)
            {
                if (cond.AddinId != thisAddinId && !Conditions.Contains(cond))
                {
                    Conditions.Add(cond);
                }
            }
            foreach (string s in ep.Addins)
            {
                if (!Addins.Contains(s))
                {
                    Addins.Add(s);
                }
            }
        }
コード例 #11
0
        /// <summary>
        /// Gets the object extended by this extension
        /// </summary>
        /// <returns>
        /// The extended object can be an <see cref="Mono.Addins.Description.ExtensionPoint"/> or
        /// an <see cref="Mono.Addins.Description.ExtensionNodeDescription"/>.
        /// </returns>
        /// <remarks>
        /// This method only works when the add-in description to which the extension belongs has been
        /// loaded from an add-in registry.
        /// </remarks>
        public ObjectDescription GetExtendedObject()
        {
            AddinDescription desc = ParentAddinDescription;

            if (desc == null)
            {
                return(null);
            }
            ExtensionPoint ep = FindExtensionPoint(desc, path);

            if (ep == null && desc.OwnerDatabase != null)
            {
                foreach (Dependency dep in desc.MainModule.Dependencies)
                {
                    AddinDependency adep = dep as AddinDependency;
                    if (adep == null)
                    {
                        continue;
                    }
                    Addin ad = desc.OwnerDatabase.GetInstalledAddin(ParentAddinDescription.Domain, adep.FullAddinId);
                    if (ad != null && ad.Description != null)
                    {
                        ep = FindExtensionPoint(ad.Description, path);
                        if (ep != null)
                        {
                            break;
                        }
                    }
                }
            }
            if (ep != null)
            {
                string subp = path.Substring(ep.Path.Length).Trim('/');
                if (subp.Length == 0)
                {
                    return(ep); // The extension is directly extending the extension point
                }
                // The extension is extending a node of the extension point

                return(desc.FindExtensionNode(path, true));
            }
            return(null);
        }
コード例 #12
0
 /// <summary>
 /// Copies another extension point.
 /// </summary>
 /// <param name='ep'>
 /// Extension point from which to copy.
 /// </param>
 public void CopyFrom(ExtensionPoint ep)
 {
     path        = ep.path;
     name        = ep.name;
     description = ep.description;
     NodeSet.CopyFrom(ep.NodeSet);
     Conditions.Clear();
     foreach (ConditionTypeDescription cond in ep.Conditions)
     {
         ConditionTypeDescription cc = new ConditionTypeDescription();
         cc.CopyFrom(cond);
         Conditions.Add(cc);
     }
     Addins.Clear();
     foreach (string s in ep.Addins)
     {
         Addins.Add(s);
     }
     rootAddin = ep.rootAddin;
 }
コード例 #13
0
        internal void MergeExternalData(AddinDescription other)
        {
            // Removes extension types and extension sets coming from other add-ins.
            foreach (ExtensionPoint ep in other.ExtensionPoints)
            {
                ExtensionPoint tep = ExtensionPoints [ep.Path];
                if (tep != null)
                {
                    tep.MergeWith(AddinId, ep);
                }
            }

            foreach (ExtensionNodeSet ns in other.ExtensionNodeSets)
            {
                ExtensionNodeSet tns = ExtensionNodeSets [ns.Id];
                if (tns != null)
                {
                    tns.MergeWith(AddinId, ns);
                }
            }
        }
コード例 #14
0
		public void Fill (ExtensionPoint ep, AddinRegistry reg)
		{
			string name;
			if (!string.IsNullOrEmpty (ep.Name))
				name = ep.Name;
			else
				name = ep.Path;
			
			labelName.Markup = "<small>Extension Point</small>\n<big><b>" + GLib.Markup.EscapeText (name) + "</b></big>";
			if (!string.IsNullOrEmpty (ep.Description))
				labelDesc.Text = ep.Description;
			else
				labelDesc.Text = AddinManager.CurrentLocalizer.GetString ("No additional documentation");
			
			List<ExtensionNodeType> types = new List<ExtensionNodeType> ();
			GetNodeTypes (reg, ep.NodeSet, types);
			
			uint row = 0;
			foreach (ExtensionNodeType nt in types) {
				Gtk.Label lab = new Gtk.Label ();
				lab.Markup = "<b>" + GLib.Markup.EscapeText (nt.NodeName) + "</b>";
				lab.UseUnderline = false;
				lab.Xalign = lab.Yalign = 0;
				Gtk.Button but = new Gtk.Button (lab);
				but.Relief = Gtk.ReliefStyle.None;
				tableNodes.Attach (but, 0, 1, row, row + 1);
				Gtk.Table.TableChild ct = (Gtk.Table.TableChild) tableNodes [but];
				ct.XOptions = Gtk.AttachOptions.Fill;
				
				lab = new Gtk.Label (nt.Description);
				lab.UseUnderline = false;
				lab.Xalign = lab.Yalign = 0;
				lab.Wrap = true;
				tableNodes.Attach (lab, 1, 2, row, row + 1);
				ct = (Gtk.Table.TableChild) tableNodes [lab];
				ct.XOptions = Gtk.AttachOptions.Expand | Gtk.AttachOptions.Fill;
				row++;
			}
			tableNodes.ShowAll ();
		}
コード例 #15
0
        /// <summary>
        /// Gets the node types allowed in this extension.
        /// </summary>
        /// <returns>
        /// The allowed node types.
        /// </returns>
        /// <remarks>
        /// This method only works when the add-in description to which the extension belongs has been
        /// loaded from an add-in registry.
        /// </remarks>
        public ExtensionNodeTypeCollection GetAllowedNodeTypes()
        {
            ObjectDescription ob = GetExtendedObject();
            ExtensionPoint    ep = ob as ExtensionPoint;

            if (ep != null)
            {
                return(ep.NodeSet.GetAllowedNodeTypes());
            }

            ExtensionNodeDescription node = ob as ExtensionNodeDescription;

            if (node != null)
            {
                ExtensionNodeType nt = node.GetNodeType();
                if (nt != null)
                {
                    return(nt.GetAllowedNodeTypes());
                }
            }
            return(new ExtensionNodeTypeCollection());
        }
コード例 #16
0
ファイル: SetupTool.cs プロジェクト: directhex/mono-addins
        void PrintExtensionPoint(AddinDescription desc, ExtensionPoint ep)
        {
            Console.WriteLine ();
            Console.WriteLine ("* Extension Point: " + ep.Path);
            if (ep.Description.Length > 0)
                Console.WriteLine (ep.Description);

            ArrayList list = new ArrayList ();
            Hashtable visited = new Hashtable ();

            Console.WriteLine ();
            Console.WriteLine ("  Extension nodes:");
            GetNodes (desc, ep.NodeSet, list, new Hashtable ());

            foreach (ExtensionNodeType nt in list)
                Console.WriteLine ("   - " + nt.Id + ": " + nt.Description);

            Console.WriteLine ();
            Console.WriteLine ("  Node description:");

            string sind = "    ";

            for (int n=0; n<list.Count; n++) {

                ExtensionNodeType nt = (ExtensionNodeType) list [n];
                if (visited.Contains (nt.Id + " " + nt.TypeName))
                    continue;

                visited.Add (nt.Id + " " + nt.TypeName, nt);
                Console.WriteLine ();

                Console.WriteLine (sind + "- " + nt.Id + ": " + nt.Description);
                string nsind = sind + "    ";
                if (nt.Attributes.Count > 0) {
                    Console.WriteLine (nsind + "Attributes:");
                    foreach (NodeTypeAttribute att in nt.Attributes) {
                        string req = att.Required ? " (required)" : "";
                        Console.WriteLine (nsind + "  " + att.Name + " (" + att.Type + "): " + att.Description + req);
                    }
                }

                if (nt.NodeTypes.Count > 0 || nt.NodeSets.Count > 0) {
                    Console.WriteLine (nsind + "Child nodes:");
                    ArrayList newList = new ArrayList ();
                    GetNodes (desc, nt, newList, new Hashtable ());
                    list.AddRange (newList);
                    foreach (ExtensionNodeType cnt in newList)
                        Console.WriteLine ("          " + cnt.Id + ": " + cnt.Description);
                }
            }
            Console.WriteLine ();
        }
コード例 #17
0
ファイル: AddinEngine.cs プロジェクト: slluis/mono-addins
 internal void InsertExtensionPoint(RuntimeAddin addin, ExtensionPoint ep)
 {
     CreateExtensionPoint (ep);
     foreach (ExtensionNodeType nt in ep.NodeSet.NodeTypes) {
         if (nt.ObjectTypeName.Length > 0) {
             Type ntype = addin.GetType (nt.ObjectTypeName, true);
             RegisterAutoTypeExtensionPoint (ntype, ep.Path);
         }
     }
 }
コード例 #18
0
		IEnumerable GetExtensionInfo (Hashtable hash, string path, AddinDescription description, ModuleDescription module, bool lookInParents)
		{
			ArrayList list = new ArrayList ();
			
			object data = hash [path];
			if (data == null && lookInParents) {
				// Root add-in extension points are registered before any other kind of extension,
				// so we should find it now.
				data = GetParentExtensionInfo (path);
			}
			
			if (data is ArrayList) {
				// Extension point which belongs to a root assembly.
				list.AddRange (GetRootExtensionInfo (hash, path, description, module, (ArrayList) data));
			}
			else {
				ExtensionPoint info = (ExtensionPoint) data;
				if (info == null) {
					info = new ExtensionPoint ();
					info.Path = path;
					hash [path] = info;
				}
				list.Add (info);
			}
			return list;
		}
コード例 #19
0
		void CollectObjectTypeExtensions (AddinDescription desc, ExtensionPoint ep, string objectTypeName)
		{
			ArrayList list = (ArrayList) objectTypeExtensions [objectTypeName];
			if (list == null)
				return;
			
			foreach (UnresolvedObjectTypeExtension data in list) {
				if (IsAddinCompatible (desc, data.Description, data.ModuleDescription)) {
					data.Extension.Path = ep.Path;
					RegisterExtension (data.Description, data.ModuleDescription, ep.Path);
					data.FoundExtensionPoint = true;
				}
			}
		}
コード例 #20
0
ファイル: TreeNode.cs プロジェクト: wanglehui/mono-addins
		public void ResetCachedData ()
		{
			if (extensionPoint != null) {
				string aid = Addin.GetIdName (extensionPoint.ParentAddinDescription.AddinId);
				RuntimeAddin ad = addinEngine.GetAddin (aid);
				if (ad != null)
					extensionPoint = ad.Addin.Description.ExtensionPoints [GetPath ()];
			}
			if (childrenList != null) {
				foreach (TreeNode cn in childrenList)
					cn.ResetCachedData ();
			}
		}
コード例 #21
0
		public void RegisterAddinRootNodeSet (AddinDescription description, ExtensionNodeSet nodeSet)
		{
			ArrayList list = (ArrayList) nodeSetHash [nodeSet.Id];
			if (list == null) {
				list = new ArrayList ();
				nodeSetHash [nodeSet.Id] = list;
			}
			
			RootExtensionPoint rep = new RootExtensionPoint ();
			rep.Description = description;
			ExtensionPoint ep = new ExtensionPoint ();
			ep.RootAddin = description.AddinId;
			ep.SetNodeSet (nodeSet);
			rep.ExtensionPoint = ep;
			list.Add (rep);
		}
コード例 #22
0
		void RegisterObjectTypes (ExtensionPoint ep)
		{
			// Register extension points bound to a node type
			
			foreach (ExtensionNodeType nt in ep.NodeSet.NodeTypes) {
				if (nt.ObjectTypeName.Length > 0) {
					ArrayList list = (ArrayList) objectTypeExtensions [nt.ObjectTypeName];
					if (list == null) {
						list = new ArrayList ();
						objectTypeExtensions [nt.ObjectTypeName] = list;
					}
					list.Add (ep);
				}
			}
		}
コード例 #23
0
		public void OnAddExtensionPoint ()
		{
			DotNetProject project = (DotNetProject) CurrentNode.DataItem;
			if (project == null)
				return;
			AddinData data = project.GetAddinData ();
			if (project == null)
				return;
			
			ExtensionPoint ep = new ExtensionPoint ();
			NewExtensionPointDialog dlg = new NewExtensionPointDialog (project, data.AddinRegistry, data.CachedAddinManifest, ep);
			try {
				if (dlg.Run () == (int) Gtk.ResponseType.Ok) {
					data.CachedAddinManifest.ExtensionPoints.Add (ep);
					data.SaveAddinManifest ();
					data.NotifyChanged (false);
				}
			} finally {
				dlg.Destroy ();
			}
		}
コード例 #24
0
		TreeIter AddExtensionPoint (ExtensionPoint extep, Extension ext)
		{
			string spath = ext.Path.Substring (extep.Path.Length);
			spath = spath.Trim ('/').Replace ("/", " / ");
			TreeIter ait = AddAddin (extep.ParentAddinDescription);
			string name;
			if (extep.Name.Length > 0) {
				name = GLib.Markup.EscapeText (extep.Name);
				if (spath.Length > 0)
					name += " / " + GLib.Markup.EscapeText (spath);
			}
			else if (extep.Description.Length > 0) {
				name = GLib.Markup.EscapeText (extep.Description);
				if (spath.Length > 0)
					name += " / " + GLib.Markup.EscapeText (spath);
			}
			else
				name = GLib.Markup.EscapeText (extep.Path);
			
			return store.AppendValues (ait, name, null, ext, null, pixExtensionPoint, true, extep);
		}
コード例 #25
0
		internal static IEnumerable<Extension> GetExtensions (AddinProjectFlavor project, ExtensionPoint extensionPoint)
		{
			//TODO: handle node sets
			foreach (var addin in extensionPoint.ExtenderAddins) {
				var modules = project.AddinRegistry.GetAddin (addin).Description.AllModules;
				foreach (ModuleDescription module in modules) {
					foreach (Extension extension in module.Extensions) {
						if (extension.Path == extensionPoint.Path)
							yield return extension;
					}
				}
			}
		}
コード例 #26
0
		public ExtensionNodeElement (AddinProjectFlavor proj, ExtensionPoint extensionPoint, ExtensionNodeType info) : base (info.NodeName, info.Description)
		{
			this.proj = proj;
			this.extensionPoint = extensionPoint;
			this.info = info;
		}
		protected virtual void OnButtonNewClicked (object sender, System.EventArgs e)
		{
			ExtensionPoint ep = new ExtensionPoint ();
			NewExtensionPointDialog dlg = new NewExtensionPointDialog ((DotNetProject)data.Project, data.AddinRegistry, adesc, ep);
			try {
				if (dlg.Run () == (int) ResponseType.Ok) {
					adesc.ExtensionPoints.Add (ep);
					Fill ();
					NotifyChanged ();
				}
			} finally {
				dlg.Destroy ();
			}
		}
		protected virtual void OnButtonPropertiesClicked (object sender, System.EventArgs e)
		{
			TreeIter iter;
			tree.Selection.GetSelected (out iter);
			
			ExtensionPoint ep = (ExtensionPoint) store.GetValue (iter, 0);
			ExtensionPoint epc = new ExtensionPoint ();
			epc.CopyFrom (ep);
			NewExtensionPointDialog epdlg = new NewExtensionPointDialog ((DotNetProject)data.Project, data.AddinRegistry, adesc, epc);
			if (epdlg.Run () == (int) ResponseType.Ok)
				ep.CopyFrom (epc);
			epdlg.Destroy ();
			Fill ();
			NotifyChanged ();
		}
コード例 #29
0
		public override void ActivateItem ()
		{
			DotNetProject project = (DotNetProject) CurrentNode.GetParentDataItem (typeof(DotNetProject), true);
			if (project == null)
				return;
			AddinData data = project.GetAddinData ();
			if (data == null)
				return;
			
			ExtensionPoint ep = (ExtensionPoint) CurrentNode.DataItem;
			ExtensionPoint epc = new ExtensionPoint ();
			epc.CopyFrom (ep);
			NewExtensionPointDialog epdlg = new NewExtensionPointDialog (project, data.AddinRegistry, data.CachedAddinManifest, epc);
			if (epdlg.Run () == (int) Gtk.ResponseType.Ok) {
				ep.CopyFrom (epc);
				data.CachedAddinManifest.Save ();
			}
			epdlg.Destroy ();
		}
コード例 #30
0
		ExtensionLoadData GetAddinExtensions (string id, ExtensionPoint ep)
		{
			Addin pinfo = null;

			// Root add-ins are not returned by GetInstalledAddin.
			RuntimeAddin addin = AddinManager.SessionService.GetAddin (id);
			if (addin != null)
				pinfo = addin.Addin;
			else
				pinfo = AddinManager.Registry.GetAddin (id);
			
			if (pinfo == null) {
				AddinManager.ReportError ("Required add-in not found", id, null, false);
				return null;
			}
			if (!pinfo.Enabled)
				return null;
				
			// Loads extensions defined in each module
			
			ExtensionLoadData data = null;
			AddinDescription conf = pinfo.Description;
			GetAddinExtensions (conf.MainModule, id, ep, ref data);
			
			foreach (ModuleDescription module in conf.OptionalModules) {
				if (CheckOptionalAddinDependencies (conf, module))
					GetAddinExtensions (module, id, ep, ref data);
			}
			if (data != null)
				data.Extensions.Sort ();

			return data;
		}
コード例 #31
0
		void GetAddinExtensions (ModuleDescription module, string addinId, ExtensionPoint ep, ref ExtensionLoadData data)
		{
			string basePath = ep.Path + "/";
			
			foreach (Extension extension in module.Extensions) {
				if (extension.Path == ep.Path || extension.Path.StartsWith (basePath)) {
					if (data == null) {
						data = new ExtensionLoadData ();
						data.AddinId = addinId;
						data.Extensions = new ArrayList ();
					}
					data.Extensions.Add (extension);
				}
			}
		}
コード例 #32
0
		void RegisterObjectTypes (ExtensionPoint ep)
		{
			// Register extension points bound to a node type
			
			foreach (ExtensionNodeType nt in ep.NodeSet.NodeTypes) {
				if (nt.ObjectTypeName.Length > 0) {
					List<ExtensionPoint> list;
					if (!objectTypeExtensions.TryGetValue (nt.ObjectTypeName, out list)) {
						list = new List<ExtensionPoint> ();
						objectTypeExtensions [nt.ObjectTypeName] = list;
					}
					list.Add (ep);
				}
				if (nt.ExtensionAttributeTypeName.Length > 0) {
					List<ExtensionNodeType> list;
					if (!customAttributeTypeExtensions.TryGetValue (nt.ExtensionAttributeTypeName, out list)) {
						list = new List<ExtensionNodeType> ();
						customAttributeTypeExtensions [nt.ExtensionAttributeTypeName] = list;
					}
					list.Add (nt);
				}
			}
		}
コード例 #33
0
		internal void CreateExtensionPoint (ExtensionPoint ep)
		{
			TreeNode node = tree.GetNode (ep.Path, true);
			if (node.ExtensionPoint == null) {
				node.ExtensionPoint = ep;
				node.ExtensionNodeSet = ep.NodeSet;
			}
		}
コード例 #34
0
		public ExtensionPoint AddExtensionPoint (string path)
		{
			ExtensionPoint ep = new ExtensionPoint ();
			ep.Path = path;
			ExtensionPoints.Add (ep);
			return ep;
		}
コード例 #35
0
		public void RegisterExtensionPoint (AddinDescription description, ExtensionPoint ep)
		{
			List<RootExtensionPoint> extensions;
			if (pathHash.TryGetValue (ep.Path, out extensions)) {
				// Extension point already registered
				List<ExtensionPoint> compatExtensions = GetCompatibleExtensionPoints (ep.Path, description, description.MainModule, extensions);
				if (compatExtensions.Count > 0) {
					foreach (ExtensionPoint einfo in compatExtensions)
						einfo.MergeWith (null, ep);
					RegisterObjectTypes (ep);
					return;
				}
			}
			// Create a new extension
			RootExtensionPoint rep = new RootExtensionPoint ();
			rep.ExtensionPoint = ep;
			rep.ExtensionPoint.RootAddin = description.AddinId;
			rep.Description = description;
			if (extensions == null) {
				extensions = new List<RootExtensionPoint> ();
				pathHash [ep.Path] = extensions;
			}
			extensions.Add (rep);
			RegisterObjectTypes (ep);
		}
コード例 #36
0
		void FillExtensionPoint (TreeIter iter, ExtensionPoint ep)
		{
			// Add extension node types

			FillExtensionNodeSet (iter, ep.NodeSet);
			
			// Add extension nodes from known add-ins
			
			ArrayList extensions = new ArrayList ();
			
			CollectExtensions (ep.ParentAddinDescription, ep.Path, extensions);
			foreach (Dependency dep in ep.ParentAddinDescription.MainModule.Dependencies) {
				AddinDependency adep = dep as AddinDependency;
				if (adep == null) continue;
				Addin addin = registry.GetAddin (adep.FullAddinId);
				if (addin != null)
					CollectExtensions (addin.Description, ep.Path, extensions);
			}
			
			// Sort the extensions, to make sure they are added in the correct order
			// That is, deepest children last.
			extensions.Sort (new ExtensionComparer ());
			
//			iter = store.AppendValues (iter, "Extensions", null, ep, false, false, null, false, true);
			
			// Add the nodes
			foreach (Extension ext in extensions) {
				string subp = ext.Path.Substring (ep.Path.Length);
				TreeIter citer = iter;
				ExtensionNodeSet ns = ep.NodeSet;
				bool found = true;
				foreach (string p in subp.Split ('/')) {
					if (p.Length == 0) continue;
					if (!GetNodeBranch (citer, p, ns, out citer, out ns)) {
						found = false;
						break;
					}
				}
				if (found)
					FillNodes (citer, ns, ext.ExtensionNodes);
			}
		}
コード例 #37
0
		public void RegisterExtensionPoint (AddinDescription description, ExtensionPoint ep)
		{
			foreach (ExtensionPoint einfo in GetExtensionInfo (pathHash, ep.Path, description, description.MainModule, false)) {
				if (einfo.RootAddin == null || database.AddinDependsOn (einfo.RootAddin, description.AddinId))
					einfo.RootAddin = description.AddinId;
				einfo.MergeWith (null, ep);
			}
		}