2013-10-11 65 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

相关问题