Eclipse Java模板在重启时重置 [英] Eclipse Java templates reset on restart

查看:34
本文介绍了Eclipse Java模板在重启时重置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

一旦我需要在控制台中输入很多文本,所以我将"sysout"模板更改为

Once I needed to enter a lot of text into console, so I changed the "sysout" template to be

System.out.println("${word_selection}${}");${cursor}

代替

System.out.println(${word_selection}${});${cursor}

但是现在我不再想要这个了.但是,每次在将Eclipse设置为普通模板后重新启动Eclipse时,它都会变回原样,并且再次获得引号.

But now I don't want this anymore. However, every time I restart Eclipse after setting it to the normal template, it changes back and I get the quotes again.

我还尝试另外设置其他设置以触发"Oomph首选项记录器",但是模板没有出现在其中.

I also tried additionally setting another setting to trigger the "Oomph preference recorder", but the template doesn't appear there.

我尽了最大的努力来附加我的eclipse配置,但是即使Pastebin也无法使用这些> 3MB的文本.这至少是插件列表的屏幕截图:

I tried my best to attach my eclipse configuration, but even Pastebin times out from these >3MB of text. Here's at least a screenshot of the plugin list:

推荐答案

我设法通过使用 Oomph 重现了您的问题,解决该问题的方法是停止使用 Oomph !既然您已经在OP中提到了它的用途,所以我进入了 Windows->首选项-> Oomph->首选项记录器,并选中了记录到用户中.

I managed to reproduce your problem by using Oomph, and the way to solve the problem is to stop using Oomph! Since you had mentioned its use in the OP I went to Windows -> Preferences -> Oomph -> Preference Recorder and checked Record into User.

接下来,我将 sysout 的模板更改为调用 print()而不是 println().更改立即生效,并且(如预期的那样)在重新启动Eclipse之后也生效.

Next I changed the template for sysout to call print() instead of println(). The change was immediately effective, and (as expected) it was also effective after restarting Eclipse.

然后,我通过单击还原为默认来还原 sysout 的模板,并且(如预期的那样)该模板立即生效并 sysout 生成了 println().但是,在重新启动Eclipse之后,撤消了更改,并且 sysout 再次生成了 print()而不是 println()!您在操作说明中也报告了这种行为.

Then I reverted the template for sysout by clicking Revert to Default, and (as expected) it was immediately effective and sysout generated println(). However, after restarting Eclipse the change was undone, and sysout was once again generating print() instead of println()! That behavior is what you had also reported in the comments for the OP.

再次查看 Preference Recorder 设置时,我注意到即使我没有明确地检查 custom_templates 的偏好设置,也是如此:

On reviewing the Preference Recorder settings again I noticed that the preference for custom_templates had been checked even though I had not explicitly done that:

显然,这是导致用户设置在启动时实现的原因.我取消选中所有首选项,取消选中记录到用户,然后重新启动Eclipse,然后选择 sysout ,然后正确使用 println()的默认值.因此,我认为为您解决的方法是取消选中首选项记录器记录到复选框.

Apparently this is what was causing the user setting to be implemented on startup. I unchecked all the preferences, unchecked Record into User and restarted Eclipse, and sysout then correctly used the default value of println(). So I think the solution for you is uncheck that Record into checkbox for Preference Recorder.

最后一点是,Oomph准确地记录了Eclipse启动期间的操作,并将其记录在Eclipse安装目录下的 \ eclipse \ configuration \ org.eclipse.oomph.setup \ setup.log 中./p>

One final point is that Oomph logs exactly what it is doing during Eclipse's startup to file \eclipse\configuration\org.eclipse.oomph.setup\setup.log under the Eclipse installation directory:

[2018-01-24 10:45:03] Workspace D:\OxygenWorkspace
[2018-01-24 10:45:03] Bundle org.eclipse.oomph.setup 1.9.0.v20171202-1121, build=3282, branch=f99b41819cc9f86beec6b54bf453173fc2d4acef
[2018-01-24 10:45:03] Bundle org.eclipse.oomph.setup.core 1.9.0.v20171202-1121, build=3282, branch=f99b41819cc9f86beec6b54bf453173fc2d4acef
[2018-01-24 10:45:03] Bundle org.eclipse.oomph.setup.p2 1.9.0.v20171202-1121, build=3282, branch=f99b41819cc9f86beec6b54bf453173fc2d4acef
[2018-01-24 10:45:03] Performing Preference /instance/org.eclipse.jdt.ui/org.eclipse.jdt.ui.text.custom_templates = <?xml version="1.0" encoding="UTF-8" standalone="no"?><templates><template autoinsert="true" context="java-statements" deleted="false" description="print to standard out" enabled="true" id="org.eclipse.jdt.ui.templates.sysout" name="sysout">System.out.print(${word_selection}${});${cursor}</template></templates>

请注意,以上最后一行显示了正在设置的用户定义模板.

Note that the final line above shows the user defined template being set.

这篇关于Eclipse Java模板在重启时重置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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