Skip to content

Conversation

@vogella
Copy link
Member

@vogella vogella commented Nov 11, 2025

Summary

  • Replace hardcoded property key strings with constants from ICompareUIConstants interface
  • Improves code maintainability and reduces risk of typos in property keys
  • Adds import for org.eclipse.compare.ICompareUIConstants

Changes

  • AsciidocMergeViewer.java: Use ICompareUIConstants.INCOMING_COLOR and ICompareUIConstants.OUTGOING_COLOR constants instead of string literals

Test plan

  • Verify the AsciiDoc merge viewer still works correctly
  • Check that incoming/outgoing colors are displayed properly in compare mode
  • Run existing tests to ensure no regressions

🤖 Generated with Claude Code

@gemini-code-assist
Copy link

Summary of Changes

Hello @vogella, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request enhances code maintainability by refactoring the AsciidocMergeViewer to utilize symbolic constants for compare UI color properties, specifically for incoming and outgoing changes. Concurrently, it streamlines the repository's AI agent guidance by replacing the previous Copilot instructions with a unified AGENTS.md file, improving clarity and consistency for various AI tools.

Highlights

  • Refactored Compare UI Constants: Replaced hardcoded string literals for INCOMING_COLOR and OUTGOING_COLOR property keys with symbolic constants from ICompareUIConstants in AsciidocMergeViewer.java, enhancing code readability and maintainability.
  • Improved AI Agent Guidance: The .github/copilot-instructions.md file has been removed and replaced with a new AGENTS.md file, providing comprehensive guidance for various AI coding assistants, with CLAUDE.md symlinking to it for specific tool integration.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully refactors the code to use constants from ICompareUIConstants, which improves maintainability. It also includes a significant update to the repository's AI agent instructions, making them more comprehensive and generic. My main feedback concerns the hardcoding of colors in the AsciidocMergeViewer. While the intent is likely to provide specific styling, it overrides user-configured preferences and can negatively impact accessibility. I've suggested removing the hardcoded colors to allow the viewer to inherit the standard, user-configurable Eclipse compare colors.

Comment on lines 13 to 14
configuration.setProperty(ICompareUIConstants.INCOMING_COLOR, new RGB(0, 255, 0));
configuration.setProperty(ICompareUIConstants.OUTGOING_COLOR, new RGB(255, 0, 0));

Choose a reason for hiding this comment

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

medium

While using constants for property keys is a good practice, hardcoding the RGB color values here overrides any user-defined color preferences for the compare editor. This can lead to an inconsistent user experience and may cause accessibility issues (e.g., for users with color blindness who have configured specific high-contrast colors).

It's generally better to let the TextMergeViewer use the default colors provided by the Eclipse platform, which are derived from the current theme and can be configured by the user in the preferences.

I recommend removing these lines to ensure your merge viewer respects the user's color settings.

vogella and others added 2 commits November 12, 2025 10:48
Replace hardcoded property key strings with constants from
ICompareUIConstants interface for better maintainability and
to avoid typos in property keys.

Changes:
- Add import for org.eclipse.compare.ICompareUIConstants
- Use ICompareUIConstants.INCOMING_COLOR instead of string literal
- Use ICompareUIConstants.OUTGOING_COLOR instead of string literal

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
Remove hardcoded RGB color values for incoming/outgoing changes to
respect user-configured color preferences and theme settings. This
improves accessibility and maintains consistency with Eclipse platform
conventions.

Changes:
- Remove setProperty calls for INCOMING_COLOR and OUTGOING_COLOR
- Remove unused ICompareUIConstants and RGB imports
- Let TextMergeViewer use default platform colors

Addresses review feedback from gemini-code-assist regarding
accessibility concerns and user preference overrides.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@vogella vogella force-pushed the refactor/use-compare-ui-constants branch from 6dfdc84 to 38bc9c6 Compare November 12, 2025 09:50
@vogella
Copy link
Member Author

vogella commented Nov 12, 2025

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request aims to refactor magic strings by using constants from ICompareUIConstants. However, the current implementation incorrectly removes the functionality for setting custom colors in the AsciidocMergeViewer instead of refactoring it. This introduces a functional regression. My review includes a critical comment with a code suggestion to correctly implement the intended refactoring. Please address this to ensure the custom colors are still applied using the proper constants.

public class AsciidocMergeViewer extends TextMergeViewer {

public AsciidocMergeViewer(Composite parent, int style, CompareConfiguration configuration) {
super(parent, style, configuration);

Choose a reason for hiding this comment

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

critical

The pull request description states that the goal is to replace magic strings with constants from ICompareUIConstants. However, the implementation removes the lines that set the custom colors for the merge viewer entirely. This results in a functional regression, as the custom colors will no longer be applied.

To fix this, you should re-add the property setting logic, but use the constants from ICompareUIConstants as intended. Please note that you will also need to add the necessary imports for ICompareUIConstants and RGB.

        super(parent, style, configuration);
        configuration.setProperty(org.eclipse.compare.ICompareUIConstants.INCOMING_COLOR, new org.eclipse.swt.graphics.RGB(0, 255, 0));
        configuration.setProperty(org.eclipse.compare.ICompareUIConstants.OUTGOING_COLOR, new org.eclipse.swt.graphics.RGB(255, 0, 0));

This commit fixes a regression introduced in the previous commit. The functionality for setting custom colors in the AsciidocMergeViewer was incorrectly removed. This change restores the functionality by using the constants from ICompareUIConstants.
This commit reverts the usage of the internal class ICompareUIConstants and uses string literals instead. This fixes the build failure.
@vogella vogella merged commit a4773ad into main Nov 18, 2025
1 check passed
@vogella vogella deleted the refactor/use-compare-ui-constants branch November 18, 2025 10:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants