简体   繁体   English

如何在Eclipse的侧边栏中更改突出显示的颜色?

[英]How to change highlighted occurrences color in Eclipse's sidebar?

When you have "Mark occurrences" enabled in Eclipse, placing the cursor on any type/variable/method/etc will highlight all occurrences in the text editor and place a faint bar in the right ruler to show you the location of other occurrences in the file. 当您在Eclipse中启用“标记出现”时,将光标放在任何类型/变量/方法/等上将突出显示文本编辑器中的所有实例,并在右侧标尺中放置一个模糊条,以显示其中出现的位置。文件。

Does anyone know where in the Preferences you can change what color is used to highlight the other occurrences in the side ruler? 有没有人知道在首选项中你可以改变用什么颜色突出显示侧标尺中的其他事件? The color is way too faint for me with my current monitor/Windows Aero theme. 使用我当前的显示器/ Windows Aero主题,颜色对我来说太微弱了。

I tried to go into Preferences > General > Appearance > Color and Fonts change the color for "Color labels - match highlight" but this didn't seem to apply. 我尝试进入首选项>常规>外观>颜色和字体更改“颜色标签 - 匹配突出显示”的颜色,但这似乎不适用。

Here is a screenshot with what I am talking about: 这是我正在谈论的截图:

Eclipse截图

The color in the bar is the same as the color the text is highlighted with in the editor. 栏中的颜色与编辑器中突出显示文本的颜色相同。 It is set by going to 它是通过去设定的

Window > Preferences > General > Editors > Text Editors > Annotations 窗口>首选项>常规>编辑器>文本编辑器>注释

and changing the Occurrences and Write Occurrences colors. 并更改出现次数和写入次数颜色。

Right click on the marker and select the only menu item "preferences", this opens the preferences dialog: General/Editors/text Editor/Annotation. 右键单击标记并选择唯一的菜单项“首选项”,这将打开首选项对话框:常规/编辑器/文本编辑器/注释。

  • The color of "occurances" is used for the matching items, “出现”的颜色用于匹配项目,

  • "write occurances" for item selected by you. 为您选择的项目“写入发生”。

The updates do not apply immediatly after using the Apply button, only after closing with OK and eventually reselect. 使用“应用”按钮后,更新不会立即应用,仅在关闭后使用“确定”并最终重新选择。

The bar is called the Overview Bar or Overview Ruler (in case you need to reference it) and, as has been mentioned, the color of occurences can be changed by navigating to: 该栏称为概览栏或概述标尺(如果您需要引用它),并且如上所述,可以通过导航到以下内容来更改出现的颜色:

Window > Preferences > General > Editors > Text Editors > Annotations

and changing the color for Occurrences. 并改变出现的颜色。

One difference to note in Eclipse Juno (most other responses seem to refer to Indigo) is that the change won't take effect until you restart the program. Eclipse Juno中的一个不同之处(大多数其他响应似乎都指Indigo)是在重新启动程序之前更改不会生效。

You'll want to change the "Occurrences" and "Write Occurrences" colors. 您将要更改“出现次数”和“写入次数”颜色。 This can be done in the Annotations menu, which is located — as Colin said — in the Preferences menu under the path 这可以在Annotations菜单中完成,该菜单位于 - 如Colin所说 - 位于路径下的Preferences菜单中

Window > Preferences > General > Editors > Text Editors > Annotations 窗口 > 首选项 > 常规 > 编辑器 > 文本编辑器 > 注释

If you have an occurrence marked in the overview ruler (the column to the right of the scrollbar), you can open the Annotations menu directly by right-clicking on the occurrence and selecting "Preferences" from the context menu. 如果在概览标尺(滚动条右侧的列)中标记了一个事件,则可以通过右键单击该事件并从上下文菜单中选择“首选项”来直接打开“注释”菜单。

Occurences have two color options: Occurence有两种颜色可供选择:

  1. The color of " Occurrences " is used for instances where the variable is being read, but not modified, in the code (eg k in if(k > 1) ). Occurrences ”的颜色用于在代码中读取变量但未修改变量的实例(例如, k in if(k > 1) )。
  2. The color of " Write Occurrences " is used where the variable gets modified/written to in the code (eg k in k = k + 1 ). 的“ 写入出现次数 ”的颜色被用于其中变量被修饰/中的代码写入到(例如kk = k + 1 )。

See also the official Eclipse documentation , about halfway down the page, under the sections "Locate variables and their read/write access" and "Mark occurrences" (link is for Eclipse "Indigo" version, but should be good for other recent versions as well). 另请参阅官方Eclipse文档 ,大约在页面的中间部分,“查找变量及其读/写访问权限”和“标记出现”部分(链接用于Eclipse“Indigo”版本,但应该适用于其他最新版本,如好)。

转到Windows / Preferences / Java / Editor / Mark Occurrences并选中“在当前文件中标记所选元素的出现次数”框。

更改“occurrence”的颜色后,重新启动Eclipse IDE

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

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