2010-11-09 62 views
1

是否有可能使用eclipse PDE API讀取可能的插件讀取功能?目前我讀插件使用:如何讀取已安裝的功能(eclipse PDE)?

 Bundle[] bundles = Platform.getBundles(name, version); 
     if (bundles == null) { 
      throw new NullPointerException("No bundle found with ID: " + name 
       + " and version: " + version); 

     } else { 
      for (Bundle bundle : bundles) { 
      System.out.println(bundle.getSymbolicName()); 

      } 

     } 

但是,如果我指定一個已安裝功能的名稱,我只是空。有沒有其他方法可以讀取這些功能?

而且當我閱讀了這個特性之後,我想迭代它引用的所有插件。

+1

捆綁包是指插件,而不是特徵。功能是用於安裝的邏輯單元。 – zvikico 2010-11-09 07:54:50

回答

0

您可以嘗試使用p2 API來查詢已安裝的功能。 P2是eclipse安裝的管理者。

// IProvisioningAgent is a OSGi service 
IProvisioningAgent agent = ...; 
IProfileRegistry profileRegistry = (IProfileRegistry) agent.getService(IProfileRegistry.SERVICE_NAME); 
IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF); 
IQueryResult rt = profile.query(QueryUtil.createIUPropertyQuery("org.eclipse.equinox.p2.eclipse.type", "feature"), null); 
相關問題