Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/xml/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在eclipse插件中将参数传递到context.xml文件?_Java_Xml_Eclipse_Eclipse Plugin - Fatal编程技术网

Java 如何在eclipse插件中将参数传递到context.xml文件?

Java 如何在eclipse插件中将参数传递到context.xml文件?,java,xml,eclipse,eclipse-plugin,Java,Xml,Eclipse,Eclipse Plugin,我有一个eclipse插件,它有一个扩展名: <extension point="org.eclipse.help.contexts"> <contexts file="contexts.xml" plugin="my.plugin.id"> </contexts> </extension> 一切正常,但现在我想向contexts.xml传递一个参数

我有一个eclipse插件,它有一个扩展名:

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

一切正常,但现在我想向contexts.xml传递一个参数,以便在此基础上更改href。 例如,现在它是www.google.com,通过传递参数,我想将其更改为www.yahoo.com,并且我想在java代码中传递参数。 这可能吗?如果是,怎么做?

PS:我不想从用户那里获取输入,而是将信息放在一个变量中,从文件中获取。

看起来您希望基于配置文件提供不同搜索引擎的集合

正如“dgolovin”所指出的,“org.eclipse.help.ui.searchEngine”可能具有您想要的功能。自Eclipse3.1以来,您可以在各种风格(本地搜索、信息中心和Web搜索)中定义自己的搜索引擎

我主要看到两种选择:

  • 如果你想在不同的网站上搜索,你可以定义 多个web引擎,每个引擎都在站点上

    %search.Eclipse.desc

  • 有关此功能的更多信息,请访问:

    在eclipse文档中,您可以阅读:

    Web搜索引擎类型具有引擎id org.eclipse.help.ui.Web和 接受一个参数url,该url表示具有 用替换符号替换的实际搜索字符串 “{expression}”,如下例所示:

    {expression}&ul=&ps=20&m=all Web搜索结果显示为打开Web的一个链接 在url参数中替换搜索字符串的浏览器

  • 另一个选项是通过实现“org.eclipse.help.search.ISearchEngine”创建您自己的引擎类型,并使用“org.eclipse.help.ui.searchEngine”扩展点对其进行贡献

    XYZ搜索的实例搜索XYZ站点。

  • 有关此功能的更多信息,请访问:

    您可能需要查看org.eclipse.help.ui.searchEngine扩展点,它似乎非常接近您要查找的内容。
    <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");