[英]How to Pass parameters to context.xml file in eclipse plugin?
我有一个eclipse插件,它的扩展名为:
<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:我不想从用户那里获取输入,而是将信息存储在一个从文件中获取的变量中。
您似乎想根据配置文件提供不同搜索引擎的集合。
正如“ dgolovin”所指出的那样,“ org.eclipse.help.ui.searchEngine”可能具有您正在寻找的功能。 从Eclipse 3.1开始,可以定义各种风格的本地搜索引擎(本地搜索,信息中心和Web搜索)
我主要看到两个选择:
您想在不同的站点中进行搜索,则可以在站点上定义多个Web引擎。
%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文档中,您可以阅读:
Web搜索引擎类型的引擎ID为org.eclipse.help.ui.web,并接受一个参数url,该参数代表用实际的搜索字符串替换为替换符号“ {expression}”的具体搜索查询,如以下示例所示:
http://eclipse.org/search/search.cgi?q= {expression}&ul =&ps = 20&m =所有Web搜索结果都显示为一个链接,该链接将打开Web浏览器,并用url参数替换搜索字符串。
另一种选择是通过实现“ 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
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.