沙漠中的魚

          欲上天堂,先下地獄
          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");
                          }

                      }

                  }

              }
          主站蜘蛛池模板: 毕节市| 东乡| 华安县| 双柏县| 揭西县| 平邑县| 镇坪县| 望奎县| 禹州市| 县级市| 成安县| 建瓯市| 辰溪县| 南岸区| 从化市| 永新县| 孟津县| 响水县| 襄汾县| 西藏| 水城县| 赤壁市| 原平市| 西贡区| 宜宾县| 北票市| 岐山县| 顺昌县| 桃园市| 阜宁县| 开平市| 山丹县| 洞头县| 中山市| 巫溪县| 桑日县| 彭阳县| 连山| 久治县| 嘉义市| 禄丰县|