AddIn插件体系

这套体系是由xml与相关类共同作用形成的。
xml文件为:SharpDevelopCore.addin(搜索一下,这个文件是唯一的)
相关类在:Core/AddIns

在逻辑上,SharpDevelop有一棵插件树AddInTree,树上有很多节点AddInTreeNode,对外表现为SharpDevelopCore.addin这个xml文件。


每个AddIn插件由Codon和Conditional组成。如下图:
< AddIn name         =   " SharpDevelop Core "
       author      
=   " Mike "
       copyright   
=   " GPL "
       url         
=   " http://www.icsharpcode.net "
       description 
=   " NCvs core module "
       version     
=   " 1.0.0 " >

    
< Runtime >
        
< Import assembly = " SharpDevelop.Base.dll " />
        
< Import assembly = " CSharpParser.dll " />
    
</ Runtime >

    
< Extension path  =   " /SharpDevelop/Workbench/Ambiences " >
        
< Class id     =   " Net "
               
class   =   " ICSharpCode.SharpDevelop.Services.NetAmbience " />
        
< Class id     =   " CSharp "
               
class   =   " ICSharpCode.SharpDevelop.Services.CSharpAmbience " />
        
< Class id     =   " VB.NET "
               
class   =   " ICSharpCode.SharpDevelop.Services.VBAmbience " />
    
</ Extension >
</ AddIn >

每个Extension节点就是一个Codon对象,在程序中抽象为ICodon:
AddIn插件体系                      AddIn插件体系


ICodon的属性就是Xml中的实体映射,AbstractCodon抽象类提供了属性的实现(BulidItem()方法在最底层实现)


BulidItem()方法很重要,签名为:
        public override object BuildItem(object owner, ArrayList subItems, ConditionFailedAction action)

Codon的生成由CodonBuilder和CodonFactory协作完成。



你可能感兴趣的:(add)