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.

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.

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 screenshot

41296 次浏览

条形图中的颜色与文本在编辑器中突出显示的颜色相同。它是通过去设置的

窗口 > 参数设置 > 常规 > 编辑器 > 文本编辑器 > 注释

并更改“出现”和“写入出现”颜色。

右键单击标记并选择唯一的菜单项“首选项”,这将打开首选项对话框: General/Editor/text Editor/Annote。

  • 匹配项使用“匹配”颜色,

  • 为您选择的项目“写入事件”。

更新不会在使用 Apply 按钮后立即应用,只有在使用 OK 关闭并最终重新选择之后才会应用。

您需要更改“出现”和“写入出现”的颜色。这可以在“注释”菜单中完成,该菜单位于“路径”下的“首选项”菜单中

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

如果在概览标尺(滚动条右侧的列)中标记了一个匹配项,可以通过右键单击匹配项并从上下文菜单中选择“首选项”直接打开“注释”菜单。

出现有两种颜色选项:

  1. Occurrences”的颜色用于在代码中读取变量但不修改变量的实例(例如 if(k > 1)中的 k)。
  2. 写出事件”的颜色用于在代码中修改/写入变量(例如 k = k + 1中的 k)。

See also the Eclipse 官方文档, 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).

转到 Windows/Preferences/Java/Editor/Mark Occurrences,并选中“ Mark Occurrences of the select element in the current file”框

这个工具条被称为 Overview Bar 或 Overview Ruler (如果你需要参考它的话) ,如前所述,可以通过导航到:

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

and changing the color for Occurrences.

Eclipse Juno 中需要注意的一个不同之处(其他大多数响应似乎都指向靛蓝)是,在重新启动程序之前,更改不会生效。

更改“匹配项”的颜色后,重新启动 Eclipse IDE