沙漠中的魚

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

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

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

                      }

                  }

              }
          主站蜘蛛池模板: 简阳市| 玉环县| 赤水市| 安岳县| 鸡泽县| 曲松县| 漯河市| 同江市| 三门峡市| 铅山县| 炎陵县| 前郭尔| 安吉县| 徐闻县| 元江| 务川| 平舆县| 三亚市| 绥江县| 抚宁县| 桐乡市| 积石山| 周宁县| 汝州市| 霍山县| 鲜城| 平果县| 张家港市| 阿坝| 柘荣县| 额尔古纳市| 桐乡市| 贵阳市| 北京市| 通城县| 文化| 方正县| 新化县| 肃南| 循化| 奎屯市|