2013-10-11 120 views
0

我有一個Eclipse插件,它具有一個擴展爲:如何將參數傳遞給eclipse插件中的context.xml文件?

<extension 
     point="org.eclipse.help.contexts"> 
     <contexts 
      file="contexts.xml" 
      plugin="my.plugin.id"> 
     </contexts> 
    </extension> 

contexts.xml有:

<contexts> 
    <context id="test_context" title="About Contexts"> 
     <description>This is written by me.</description> 
     <topic href="http://www.google.com" label="Search about me" /> 
    </context> 
</contexts> 

,我使用它作爲:

PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, "my.plugin.id.test_context"); 


一切正常,,但現在我想傳遞一個參數contexts.xml,這樣基於此我可以改變href。 例如,現在它是www.google.com,通過傳遞參數我想將其更改爲www.yahoo.com,並且我想在java代碼中傳遞參數。 這可能嗎?如果是這樣如何?
PS:我不想從用戶那裏獲得輸入,而是將信息存入從文件中獲得的變量中。

+0

你可能要檢查org.eclipse.help.ui.searchEngine擴展點,它似乎非常接近你在找什麼。 – dgolovin

回答

0

It's看起來像你想提供基於配置文件不同的搜索引擎的集合。

爲「dgolovin」指出「org.eclipse.help.ui.searchEngine」有可能是您正在尋找的功能。由於Eclipse 3.1 it's可以在各種不同口味的(本地搜索,信息中心和Web搜索)

來定義自己的搜索引擎我認爲主要有兩個選項:

  1. 而要在不同的網站搜索,你可以定義多個網絡引擎,每個網站都有它的現場。這個在

    %search.Eclipse.desc

的更多信息: http://help.eclipse.org/juno/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Freference%2Fextension-points%2Forg_eclipse_help_ui_searchEngine.html

在Eclipse的文檔,你可以閱讀:

網站SE拱發動機類型具有引擎ID org.eclipse.help.ui.web和 接受了表示與 實際搜索字符串的具體的搜索查詢具有取代符號 「{}表達」替換一個參數的URL,如在下面的例子中:

http://eclipse.org/search/search.cgi?q= {表達} & UL = & PS = 20 & M =所有 網絡搜索結果顯示爲一個鏈接,該鏈接將打開網頁瀏覽器 與在url參數取代的搜索字符串。

  1. 其他選項是通過實施「org.eclipse.help.search.ISearchEngine」創建自己的發動機類型,與「org.eclipse.help.ui.searchEngine」擴展點貢獻它。

    XYZ搜索的實例搜索XYZ站點。這個在

的更多信息: http://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.platform.doc.isv%2Fguide%2Fua_help_search_types.htm

相關問題