沙漠中的鱼

欲上天堂,先下地狱
posts - 0, comments - 56, trackbacks - 0, articles - 119
  BlogJava :: 首页 ::  :: 联系 :: 聚合  :: 管理

Eclipse-RCP中读取插件注册扩展点信息

Posted on 2012-02-15 17:25 沙漠中的鱼 阅读(567) 评论(0)  编辑  收藏 所属分类: RCP开发
    private void loadExtensionRegistry(){
        
//获取扩展点注册管理对象
        IExtensionRegistry extReg = Platform.getExtensionRegistry();    
        
//获取某种注册扩展点
        IExtensionPoint ExtPoint = extReg.getExtensionPoint(PLUGIN_ID ,"ExtensionPointId");
        
//获取扩展点包的有扩展信息
        IExtension[] exts = ExtPoint.getExtensions();
        
for(IExtension ext : exts){
            
//读取扩展点中的元数信息
            IConfigurationElement[] configElements = ext.getConfigurationElements();
            
for (IConfigurationElement element : configElements) {
                
//读取元素中的每一个属性信息
                
//读取可执行类
                UBPAction action = (UBPAction)element.createExecutableExtension("ClassTag");
                
                
//读取属性
                String iconPath = element.getAttribute(BusinessDefine.TAG_ICON);
                
if (iconPath != null{
                    
//转为化图标对象
                    ImageDescriptor icon = imageDescriptorFromPlugin(pluginId, iconPath);
                }

                
                
//读取子元素信息
                IConfigurationElement[] children = element.getChildren("child");
                
for (IConfigurationElement child : children){
                    
//读取子元素的属性
                    child.getAttribute("AttributeId");
                }

            }

        }

    }

只有注册用户登录后才能发表评论。


网站导航: