Skip to content

Add highlight feature for resources in eclipse explorers - #4414

Open
elsazac wants to merge 1 commit into
eclipse-platform:masterfrom
elsazac:HighlightImarkerImp
Open

elsazac wants to merge 1 commit into
eclipse-platform:masterfrom
elsazac:HighlightImarkerImp

Conversation

@elsazac

@elsazac elsazac commented Sep 28, 2026 •

Copy link
Copy Markdown
Member

Refs: #4336 and eclipse-jdt/eclipse.jdt.ui#3135

This PR adds a new highlight feature to the Eclipse explorers. It allows users to mark individual files with 255,0,0 text color as default foreground color, making important files easier to identify quickly. This also adds a bookmark overlay icon to the resources in order to make it easily recognizable.

In large Eclipse workspaces with many projects and files, it can be difficult to find the files you need.

For example:

  • Files with similar names — for eg, files such as IBreakpointListener.java, IBreakpointManager.java, IBreakpointManagerListener.java, and IBreakpointsListener.java can look very similar and be difficult to distinguish. Highlighting makes the file you need stand out.
  • Files currently being worked on — Highlighting helps users keep track of files that are important for the current task.
  • Important configuration files — Build scripts, deployment files, properties files, and other important configuration files can be highlighted so they are easier to notice.
E1.mov

Project Explorer :
image

Package Explorer :
image

This feature allows to Bookmark resources directly from the explorers context menu using the "Toggle Bookmark" context menu option. Bookmarked resources are visually distinguished in the explorer with a configurable foreground color defined under
Window > Preferences > General > Appearance > Colors and Fonts.

image

To enable the option right click on the resource and click on "Toggle Bookmark". To remove the bookmark, right-click the resource and select it again. The Bookmark is then removed.

image

The bookmarked entries are also available inside the bookmarks view. The resources will also have a bookmark overlay icon to make it visually recognizable.

image

@github-actions

github-actions Bot commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

   867 files  ±0     867 suites  ±0   1h 10m 2s ⏱️ + 3m 29s
 8 463 tests ±0   8 221 ✅ ±0  242 💤 ±0  0 ❌ ±0 
21 267 runs  ±0  20 584 ✅ ±0  683 💤 ±0  0 ❌ ±0 

Results for commit 7ecb072. ± Comparison against base commit 5441e2e.

♻️ This comment has been updated with latest results.

@elsazac
elsazac force-pushed the HighlightImarkerImp branch 3 times, most recently from c24bc83 to f72f72d Compare September 30, 2026 04:21
@elsazac

elsazac commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

@merks Could you check this?

@iloveeclipse

Copy link
Copy Markdown
Member

I wonder whether instead of "Highlight" and "Highlights" view we simply can use "Bookmark" wording and "Bookmarks" view. The proposed feature is "just" extending bookmarks functionality from editors to any resource in the explorers.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Highlighting is invisible by default, and the new view and theme-refresh behavior contain functional issues.

Review effort: Balanced
Findings: 4 Medium severity · 5 Low severity

Open (9)
What changed in this PR

Adds persistent resource highlighting across Eclipse explorers, backed by workspace markers and exposed through a dedicated Highlights view.

Changes:

  • Adds highlight marker management, context-menu toggling, and label decoration.
  • Adds configurable highlight coloring.
  • Adds a marker-based view listing highlighted resources.
File Description
ResourceHighlightManager.java Manages persistent highlight markers.
ResourceHighlightDecorator.java Applies highlight styling and refreshes labels.
ToggleHighlightHandler.java Toggles highlights for selected resources.
org.eclipse.ui.navigator.resources/​plugin.xml Registers commands, menu, decorator, color, and marker.
org.eclipse.ui.navigator.resources/​plugin.properties Adds localized extension labels.
MarkerSupportRegistry.java Defines the Highlights generator ID.
MarkerTypeField.java Special-cases highlight marker display.
HighlightResourceTypeField.java Displays highlighted resource types.
HighlightedResourcesView.java Implements the Highlights view.
org.eclipse.ui.ide/​plugin.xml Registers the view and marker columns.
org.eclipse.ui.ide/​plugin.properties Adds view and field labels.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread bundles/org.eclipse.ui.ide/plugin.xml Outdated
Comment on lines +1654 to +1656
<markerFieldReference
id="org.eclipse.ui.ide.locationField"
visible="true">
Comment on lines 31 to 40
IMarker marker = item.getMarker();
if (marker != null) {
try {
if (HighlightResourceTypeField.HIGHLIGHT_MARKER_TYPE.equals(marker.getType())) {
return HighlightResourceTypeField.getResourceTypeLabel(marker);
}
} catch (org.eclipse.core.runtime.CoreException e) {
}
}
return ((MarkerSupportItem) item).getMarkerTypeName();
Comment thread bundles/org.eclipse.ui.navigator.resources/plugin.xml Outdated
* MarkerField that shows the resource type (e.g. "Java File", "Project",
* "Folder") for a highlighted resource marker.
*
* @since 3.4
Comment on lines +58 to +61
case IResource.FOLDER -> "Folder"; //$NON-NLS-1$
case IResource.PROJECT -> "Project"; //$NON-NLS-1$
case IResource.ROOT -> "Workspace Root"; //$NON-NLS-1$
default -> "Resource"; //$NON-NLS-1$
Comment on lines +68 to +70
return "File"; //$NON-NLS-1$
}
return ext + " file"; //$NON-NLS-1$
/**
* The HighlightedResourcesView displays all highlighted resources.
*
* @since 3.4
* to remove any existing ones
* @throws CoreException if the marker operation fails
*/
public static void setHighlighted(IResource resource, boolean needsHighlight) throws CoreException {
@elsazac

elsazac commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

I wonder whether instead of "Highlight" and "Highlights" view we simply can use "Bookmark" wording and "Bookmarks" view. The proposed feature is "just" extending bookmarks functionality from editors to any resource in the explorers.

@iloveeclipse
Thank you for the review. That could definitely be done. But I was just wondering if, since we already have a Bookmarks view in Eclipse , giving the same name might cause some confusion between the two views for users?.

@iloveeclipse

Copy link
Copy Markdown
Member

I was just wondering if, since we already have a Bookmarks view in Eclipse , giving the same name might cause some confusion between the two views for users?.

Not same name, same view. Just use same view to manage bookmarks, independently whether they are created for a text editor or for a resource in explorer.

@merks

merks commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

It seems an appealing suggestion. Less is more...

@elsazac

elsazac commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

Not same name, same view. Just use same view to manage bookmarks, independently whether they are created for a text editor or for a resource in explorer.

Yes, that's possible. I will update the PR accordingly.

@iloveeclipse

Copy link
Copy Markdown
Member

Also I wonder if the "highlight" which is currently shown only as color could be changed and additionally provide a "bookmark" overlay in the top right corner of the element in the explorers. In your video where just color is used, it is barely different from the rest. Also consider color blind people here which might not notice color if set anyway.

@elsazac

elsazac commented Sep 30, 2026

Copy link
Copy Markdown
Member Author

Also I wonder if the "highlight" which is currently shown only as color could be changed and additionally provide a "bookmark" overlay in the top right corner of the element in the explorers. In your video where just color is used, it is barely different from the rest. Also consider color blind people here which might not notice color if set anyway.

Just to make sure I understand correctly, by “top right corner of the element,” do you mean the top-right of the file/folder icon in explorers? something like below?
image

@iloveeclipse

Copy link
Copy Markdown
Member

Yes

@merks

merks commented Sep 30, 2026

Copy link
Copy Markdown
Contributor

@BeckerWdf

Maybe design experts have advice to share?

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 79ce847 to 05692fe Compare October 5, 2026 06:38
@elsazac

elsazac commented Oct 5, 2026 •

Copy link
Copy Markdown
Member Author

I have removed the dedicated view that was created earlier and integrated this into the Bookmarks view in Eclipse. I also added an overlay icon to the resources so they can be easily identified in the explorers.

By Default :
image

If a specific foreground color applied :
image

So now one can highlight resources directly from the context menu also they can select a foreground color of their choice. The selected resource will be highlighted with that color and will display an overlay bookmarks icon, along with a corresponding entry in the Bookmarks view.

image

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 05692fe to ef254e1 Compare October 8, 2026 05:27
@MohananRahul MohananRahul added the noteworthy Noteworthy feature label Oct 8, 2026
@elsazac

elsazac commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

@iloveeclipse any more suggestions or changes on this?

@iloveeclipse

Copy link
Copy Markdown
Member

I just checked the behavior, not the code. Few points:

  1. I believe the new menu is too far down in the menu. What about to move it below "Show In"?
image
  1. The "Bookmark" menu is also used to remove bookmark. Should it be named "Toggle Bookmark" instead?
  2. The color coding is removed completely?

Beside this, it seem to work as expected, at least for me.
Not sure about others.
@BeckerWdf, @HeikoKlare WDYT about the UX here?

@iloveeclipse

Copy link
Copy Markdown
Member

Yet another point: now I see that only bookmarks created by the new method are shown in the explorer. But bookmarks added from the editor aren't shown in the explorer. I assume they should be shown now?
This would be more consistent.

image

@SougandhS

SougandhS commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

@iloveeclipse @elsazac
Nice feature! Could we use a more distinguishable default foreground colour for highlighted resources (e.g. red or a similarly strong colours like in jdt objects, breakpoints label.. That way a highlighted item stands out right away

image

@elsazac

elsazac commented Oct 8, 2026

Copy link
Copy Markdown
Member Author
  1. I believe the new menu is too far down in the menu. What about to move it below "Show In"?

Sure. I will bring the content menu to the top, below "Show In".

  1. The "Bookmark" menu is also used to remove bookmark. Should it be named "Toggle Bookmark" instead?

I will rename it.

Yet another point: now I see that only bookmarks created by the new method are shown in the explorer. But bookmarks added from the editor aren't shown in the explorer. I assume they should be shown now? This would be more consistent.

The original code for bookmarks added from the editor did not include the overlay icon, and I haven’t made any changes to that existing functionality. However, I agree that displaying the icon consistently across all bookmark entries, regardless of how they were added, makes it more consistent. I will make those changes as well.

@elsazac

elsazac commented Oct 8, 2026

Copy link
Copy Markdown
Member Author

Could we use a more distinguishable default foreground colour for highlighted resources (e.g. red or a similarly strong colours like in jdt objects, breakpoints label.. That way a highlighted item stands out right away

Yes, I think using a more prominent color, like the one in Variables view, would make it much more recognizable and easier to distinguish.

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from ef254e1 to 2c6f26b Compare October 9, 2026 14:39
@elsazac

elsazac commented Oct 9, 2026 •

Copy link
Copy Markdown
Member Author

I have updated the code with below changes :

  1. Renamed the name of the feature in context ment
  2. Added the same overlay icon to normal std bookmarks as well.
  3. Gave default foreground color as 255,0,0.
  4. Placed the option at the top of the context menu
image image

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 2c6f26b to 272261a Compare October 12, 2026 18:00
@elsazac

elsazac commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

@iloveeclipse Is this good to go?

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 272261a to fe23a60 Compare October 12, 2026 18:07
@iloveeclipse

Copy link
Copy Markdown
Member

Last time I've checked, I wasn't able to configure color - I've missed preference for that. Is this added back?

Unfortunately I have no time to review this PR code. I also see that PR description is still describing original proposal and showing original screenshots and video.

Would you update everything to better explain proposed feature?

Once you are done with that, I hope to get some more opinions (and code reviews?) from @eclipse-platform/eclipse-platform-committers community.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Class name doesn't match implementation. There is no "highlight" to toggle.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here and in messages above. Could you please make everything consistently named?

@elsazac

elsazac commented Oct 12, 2026

Copy link
Copy Markdown
Member Author

Last time I've checked, I wasn't able to configure color - I've missed preference for that. Is this added back?

Last time I added COLOR_LIST foreground color. After the new suggestions I felt it would be better to have a more prominent foreground color, hence changed default foreground color to 255,0,0.

Would you update everything to better explain proposed feature?

Sure, will update that.

@iloveeclipse

Copy link
Copy Markdown
Member

Last time I've checked, I wasn't able to configure color - I've missed preference for that. Is this added back?

Last time I added COLOR_LIST foreground color. After the new suggestions I felt it would be better to have a more prominent foreground color, hence changed default foreground color to 255,0,0.

I've missed the way to change color preference on the preferences page UI.

@elsazac

elsazac commented Oct 12, 2026 •

Copy link
Copy Markdown
Member Author

I've missed the way to change color preference on the preferences page UI.

That option was never removed. There is this option in colors and font preference page, where you can change the default color to user preference :

image

@elsazac

elsazac commented Oct 14, 2026 •

Copy link
Copy Markdown
Member Author

The overall changes are :

  1. There is a "Toggle Bookmark" option in the context menu. Upon selection the resource in the explorers will be highlighted wth a foreground color and bookmark overlay icon.
  2. when selected again, the bookmark will be removed.
  3. There is a default foreground color of 255,0,0.
  4. The foreground color can also be changed optionally from the colors and font preference page.
  5. The bookmarked resources will have a bookmark overlay icon to distinguish it easily.
  6. The bookmarked resources will be available in the bookmarks view along with other standard bookmarks added via editor.
  7. With this commit, the standard bookmarks added via editor will also now have an overlay icon over in the explorers.

I have also updated the description and Screenshots with the latest updates.

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from fe23a60 to 1f36079 Compare October 14, 2026 12:14
@merks

merks commented Oct 14, 2026

Copy link
Copy Markdown
Contributor

The intense red is really screamingly loud. To me it's so loud it's probably the very first thing I would try to change, hopefully finding the preference, which is generally a "find Waldo exercise". I wonder if @jasmin261098 and @vogella have any thoughts about this.

I feel stupid asking, but I assume the menu item is one with a check state...

@iloveeclipse

Copy link
Copy Markdown
Member

The intense red is really screamingly loud.

If it would always work, yes, it would be too loud.

I don't see the color changed at all on files. It only works on folders:

image

What about the font style (bold) by default and not changing default color but let the possibility to change to the user?

Beside this, can the label decoration preferences (and anything else I've missed) be reworded to consistently use "bookmark" instead of the "highlight" wording?

@jensli

jensli commented Oct 14, 2026 •

Copy link
Copy Markdown
Contributor

What a nice little feature. :)

I really like how this adds functionality to a new domain by extending an existing feature. No new views or new concepts or other things that increase the UI surface area and complexity that users must learn. Just generalisation of something already existing.

@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 1f36079 to 974aa94 Compare October 14, 2026 17:43
@elsazac

elsazac commented Oct 14, 2026

Copy link
Copy Markdown
Member Author

I don't see the color changed at all on files. It only works on folders:

Can you apply latest changes? It works for me as shown below :

E2.mov

Beside this, can the label decoration preferences (and anything else I've missed) be reworded to consistently use "bookmark" instead of the "highlight" wording?

Yes I have updated it to "Bookmark" everywhere.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment thread bundles/org.eclipse.ui.ide/plugin.xml Outdated
Comment on lines +1623 to +1628
<markerTypeReference
id="org.eclipse.core.resources.bookmark">
</markerTypeReference>
<markerTypeReference
id="org.eclipse.ui.navigator.resources.highlightMarker">
</markerTypeReference>
Comment on lines +46 to +54
decorator.bookmark.name=Bookmark Resource
decorator.bookmark.description=Bookmarks resources using a dedicated font color.
command.toggleBookmark.name=Toggle Bookmark
command.toggleBookmark.label=Toggle Bookmark

colorDefinition.bookmarkColor.label=Bookmarked Resource Font Color
colorDefinition.bookmarkColor.description=The foreground color used to bookmark resources in different explorers.

marker.bookmark.name=Bookmark

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why copilot is flagging this. It is already been renamed to "Bookmark" and all %key references in plugin.xml have matching definitions in plugin.properties

Comment on lines +127 to +130
if (Thread.currentThread() == display.getThread()) {
fetcher.run();
} else {
display.syncExec(fetcher);
/**
* enables or removes the highlight state of the resource.
*/
public static void setHighlighted(IResource resource, boolean needsHighlight, String name) throws CoreException {
This commit introduces a feature to highlight a resource by applying a
configurable theme foreground color to resources in the explorer.These
highlighted resources also has entries in the Eclipse Marker's view with
Resource, Path, Location, and Type columns.
@elsazac
elsazac force-pushed the HighlightImarkerImp branch from 974aa94 to 7ecb072 Compare October 15, 2026 09:46
if (alreadyHighlighted) {
runMarkerOp(resource, false, null);
} else {
InputDialog dialog = new InputDialog(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Showing dialog inside cycle does not look very user-friendly.

boolean alreadyHighlighted = ResourceBookmarkManager.isHighlighted(resource);

if (alreadyHighlighted) {
runMarkerOp(resource, false, null);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running individual resource operation for each cycle step may lead to performance degradation.

/**
* For managing the highlight markers on resources.
*/
public final class ResourceBookmarkManager {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The whole class looks questionable: "manager" with two static methods only. One of them later wrapped by anonymous IWorkspaceOperation, another is used more like predicate. It does not "manage" anything, may be it is better to have two separate classes with more clear contsract.

* Label decorator that highlights resources with a foreground color when marked
* with a highlight marker.
*/
public class ResourceBookmarkDecorator implements ILightweightLabelDecorator {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it should be final

@elsazac

elsazac commented Oct 15, 2026 •

Copy link
Copy Markdown
Member Author

Once the UI part is fixed, I can work on the code changes.

Few suggestions regarding the color and font:

  1. A distinguished foreground color+ Bold font (red would be ideal, but since the earlier red is bit too bright, it could be changed ) few suggestions below which is a combination of color and bold font :

a.
image

b.
image

c.
image

  1. A color_List foreground + bold font. eg :Like in the below. Not sure on how this works on other OS (I am on Mac) and different themes (for some reason, switching the theme of the launched eclipse doesn't render the UI properly for me due to which I couldn't test on light theme) .
image
  1. The RGB (255,0,0) + bold font just like how it is in breakpoints label
image

This is perhaps the breakpoints label view where the same color is the default color :

image

If any of these options work, we can go ahead with that. Otherwise, we could explore other ideas as well. open to any suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

noteworthy Noteworthy feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants