简体   繁体   English

如何通过代码创建扩展点扩展,而不是在plugin.xml中进行修改

[英]How to create extensions for extension point by code instead of modifying in plugin.xml

I want to add my own consoles in Console View , then I added extension for extension point org.eclipse.ui.console.consoleFactories in plugin.xml , then create a class which extends IConsoleFactory (just following instruction of eclipse). 我想在Console View添加自己的控制台,然后在plugin.xml为扩展点org.eclipse.ui.console.consoleFactories添加了扩展名,然后创建了一个扩展IConsoleFactory的类(仅遵循eclipse的说明)。

It works fine. 工作正常。

But now I want to create many consoles in Console View based on my input parameters. 但是现在我想根据我的输入参数在Console View创建许多控制台。

Can anyone help me to create the consoles by code instead of modifying plugin.xml ? 谁能帮助我通过代码创建控制台,而不用修改plugin.xml Please help me on the code and where should we put these codes? 请帮助我编写代码,我们应该将这些代码放在哪里? Is it at Activator.java ? Activator.java吗?

You can add the code anywhere depending on when you want your contributions to be added. 您可以在任何位置添加代码,具体取决于您希望添加贡献的时间。 Putting it in the Activator ensures that it is done when your plugin is starting up. 将其放在Activator中可确保在插件启动时完成。

For the other part of your question goto http://www.ibm.com/developerworks/opensource/library/os-ecl-dynext/ and read Listing 2. How an extension can be added through the addContribution() API 对于您问题的另一部分,请转到http://www.ibm.com/developerworks/opensource/library/os-ecl-dynext/,并阅读清单2。如何通过addContribution()API添加扩展

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM