简体   繁体   English

设置Eclipse首选项页面的属性值

[英]set the property value for eclipse preference page

There is a property "show line number" in (windows->preferences->editor->text editor) eclipse which i want to tick by java code. 在(windows-> preferences-> editor-> text editor) eclipse中有一个属性“ show line number” ,我想通过Java代码进行勾选。 so how i fetch the key of that property and set the value in preference page. 所以我如何获取该属性的键并在首选项页面中设置值。

Note: I need to set the "show line number" option by default true. 注意:默认情况下,我需要将“显示行号”选项设置为true。

This tutorial shows how to access preferences from code. 教程显示了如何从代码访问首选项。 Try to search the property "show line numbers" and try to edit it. 尝试搜索“显示行号”属性并尝试对其进行编辑。

this will be correct solution for requirement: 这将是满足要求的正确解决方案:

String lineNumbers = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER; 字符串lineNumbers = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER; EditorsUI.getPreferenceStore().setValue(lineNumbers, true); EditorsUI.getPreferenceStore()。setValue(lineNumbers,true);

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

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