沙漠中的魚

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

          Eclipse-RCP中讀取插件注冊擴展點信息

          Posted on 2012-02-15 17:25 沙漠中的魚 閱讀(617) 評論(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");
                          }

                      }

                  }

              }
          主站蜘蛛池模板: 施秉县| 平凉市| 襄汾县| 北流市| 元氏县| 伊宁县| 榕江县| 英德市| 镇赉县| 东阳市| 元朗区| 汉阴县| 绥棱县| 濮阳市| 镇雄县| 历史| 长沙市| 迭部县| 灵寿县| 黑龙江省| 三台县| 宁南县| 遂溪县| 白水县| 黔西县| 城固县| 陇川县| 佛山市| 浏阳市| 鹰潭市| 双城市| 兴城市| 平顺县| 司法| 成都市| 金华市| 榆中县| 黄梅县| 图片| 广饶县| 华坪县|