向Eclipse编程重启中添加额外的系统属性 [英] Adding extra system properties to an Eclipse programmatic restart

查看:46
本文介绍了向Eclipse编程重启中添加额外的系统属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用以下命令强制重新启动Eclipse的插件:

I have a plugin that forces a restart of Eclipse by using:

Workbench.getInstance().restart();

但是,我需要重新启动以包括新的环境变量:

However, I need this restart to include a new environment variable:

eclipse.refreshBundles=true

是否有任何方法可以仅在下次重新启动Eclipse时添加这样的环境变量?

Is there any way to add such an environment variable for this next restart of Eclipse only?

推荐答案

Eclipse有2种重新启动模式:使用上一个命令行重新启动"或使用新命令行重新启动".启动器本身会记住上一个命令行,因此,要添加新的系统属性,您将需要重新启动.

Eclipse has 2 modes for restarting: "restart" using the previous command line, or "relaunch" using a new command line. The launcher itself will remember the previous command line, so in order to add a new system property, you will need to do the relaunch.

重新启动/重新启动是IApplication API的一部分,如果您设置系统属性 eclipse.exitcode = 24 ,Workbench.restart()将使IDEApplication返回重新启动.

The restart/relaunch is part of the IApplication API, the Workbench.restart() will cause the IDEApplication to return relaunch if you set the system property eclipse.exitcode=24.

要重新启动,您需要在 eclipse.exitdata 系统属性中放入新的命令行.您将需要使用 eclipse.commands eclipse.vmargs 系统属性来重建命令行,并添加 -Declipse.refreshBundles = true vm参数.例如,请看一下org.eclipse.ui.ide中的 OpenWorkspaceAction ,它使用重新启动来切换工作区.

For the relaunch, you need to put the new command line in the eclipse.exitdata system property. You will need to reconstruct the command line using the eclipse.commands and eclipse.vmargs system properties, and add a -Declipse.refreshBundles=true vm argument. For an example of this, take a look at OpenWorkspaceAction in org.eclipse.ui.ide which uses the relaunch to switch workspaces.

请注意,在重新启动的Eclipse中,eclipse.refreshBundles将成为命令行的一部分,并且将保留在那里以便进一步重新启动,除非您修改系统属性.如果您完全退出并重新开始,它将消失.

Note that in the restarted eclipse, the eclipse.refreshBundles will be part of the command line, and will remain there for further restarts unless you modify the system properties. It will be gone if you exit fully and start again.

这篇关于向Eclipse编程重启中添加额外的系统属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆