예제 #1
0
        public override void Initialize(XElement elem)
        {
            XAttribute attr = elem.Attributes [new XName("path")];

            if (attr != null)
            {
                ModuleCompletionContext ctx = ParentContext as ModuleCompletionContext;
                if (ctx != null && ctx.Module != null)
                {
                    extension = ctx.Module.GetExtension(attr.Value);
                }
            }
        }
예제 #2
0
        CompletionDataList GetPathCompletion(string subPath)
        {
            CompletionContext ctx = GetCompletionContext(1);

            if (!(ctx is ExtensionCompletionContext))
            {
                return(null);
            }
            ModuleCompletionContext mc = (ModuleCompletionContext)ctx.GetParentContext(typeof(ModuleCompletionContext));

            Set <string>       paths = new Set <string> ();
            CompletionDataList cp    = new CompletionDataList();

            foreach (AddinDependency adep in mc.Module.Dependencies)
            {
                Addin addin = registry.GetAddin(adep.FullAddinId);
                if (addin != null && addin.Description != null)
                {
                    foreach (ExtensionPoint ep in addin.Description.ExtensionPoints)
                    {
                        if (ep.Path.StartsWith(subPath))
                        {
                            string spath = ep.Path.Substring(subPath.Length);
                            int    i     = spath.IndexOf('/');
                            if (i != -1)
                            {
                                spath = spath.Substring(0, i);
                            }
                            if (paths.Add(spath))
                            {
                                if (i == -1)                                 // Full match. Add the documentation
                                {
                                    cp.Add(spath, "md-extension-point", ep.Name + "\n" + ep.Description);
                                }
                                else
                                {
                                    cp.Add(spath, "md-literal");
                                }
                            }
                        }
                    }
                }
            }
            return(cp);
        }
예제 #3
0
 public override void OnAddAttributeValues(string attName)
 {
     if (attName == "id")
     {
         ModuleCompletionContext mc = (ModuleCompletionContext)GetParentContext(typeof(ModuleCompletionContext));
         foreach (AddinDependency adep in mc.Module.Dependencies)
         {
             Addin addin = AddinRegistry.GetAddin(adep.FullAddinId);
             if (addin != null && addin.Description != null)
             {
                 foreach (ExtensionNodeSet ns in addin.Description.ExtensionNodeSets)
                 {
                     Add(ns.Id, "");
                 }
             }
         }
     }
 }