定制p2设置动作的工作示例

问题描述

| 我正在尝试编写自定义的p2设置操作,以在安装功能部件时执行自己的代码。使用UpdateHandler的installHandler进行此操作很容易,但是对于p2,在网络上绝对没有关于此主题的文档,大多数时候eclispe只是默默地忽略了我(即使在日志中),这是我发现的唯一示例不管用。 因此,如果有人可以向我介绍自定义设置操作的有效示例,那将有助于我理解整个过程。 谢谢。     

解决方法

        最后,我以某种方式使它起作用: example_plugin: plugin.xml:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<?eclipse version=\"3.5\"?>
<plugin>
  <extension point=\"org.eclipse.equinox.p2.engine.touchpoints\" id=\"example\" name=\"Eclipse Touchpoint\">
    <touchpoint type=\"com.company.example.plugin\" class=\"org.eclipse.equinox.internal.p2.touchpoint.eclipse.EclipseTouchpoint\" version=\"1.0\"/>
  </extension>

  <extension point=\"org.eclipse.equinox.p2.engine.actions\">
    <action
      class=\"com.company.example.plugin.CustomAction\"
      name=\"do_custom_action\"
      touchpointType=\"com.company.example.plugin\"
      touchpointVersion=\"1.0\"          
      version=\"1.0\">
    </action>
  </extension>
</plugin>
META-INF \\ p2.xml:
provides.0.namespace=com.company.example.plugin
provides.0.name=do_custom_action
provides.0.version=1.0
example_feature: feature.xml:
<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<feature id=\"com.company.example.feature\" label=\"Maven installer feature\" version=\"2.2.1.qualifier\">
  <description url=\"http://www.example.com/description\">[Enter Feature Description here.]</description>
  <copyright url=\"http://www.example.com/copyright\">[Enter Copyright Description here.]</copyright>
  <license url=\"http://www.example.com/license\">[Enter License Description here.]</license>

 <requires>
   <import plugin=\"com.company.example.plugin\"/>
 </requires>

 <plugin
   id=\"com.company.example.plugin\"
   download-size=\"0\"
   install-size=\"0\"
   version=\"0.0.0\"
   unpack=\"false\"/>
</feature>
p2.inf:
metaRequirements.0.namespace=com.company.example.plugin
metaRequirements.0.name=do_custom_action
metaRequirements.0.range=1.0

instructions.configure = com.company.example.plugin.do_custom_action();
普通的留言: 自定义接触点操作作为常规类存储在插件中。 更新站点必须包含适当的artifacts.jar / content.jar(不知道为什么,调试花费了很多时间)。     ,        如果您想让接触点动作起作用,有两种方法, 首先安装提供新接触点操作的插件。然后使用新的接触点操作从存储库安装内容。 根据新接触点操作的需要,iu会要求捆绑软件提供新接触点操作,它与您发现的内容完全一样。参见Simon Kaegi随附的示例代码     

相关问答

依赖报错 idea导入项目后依赖报错,解决方案:https://blog....
错误1:代码生成器依赖和mybatis依赖冲突 启动项目时报错如下...
错误1:gradle项目控制台输出为乱码 # 解决方案:https://bl...
错误还原:在查询的过程中,传入的workType为0时,该条件不起...
报错如下,gcc版本太低 ^ server.c:5346:31: 错误:‘struct...