Skip to content

Svg css color support#8

Open
vogella wants to merge 19 commits into
masterfrom
svg-css-color-support
Open

Svg css color support#8
vogella wants to merge 19 commits into
masterfrom
svg-css-color-support

Conversation

@vogella
Copy link
Copy Markdown
Owner

@vogella vogella commented Feb 17, 2026

No description provided.

Mailaender and others added 19 commits February 4, 2026 18:01
- Migrated all tests in org.eclipse.ltk.core.refactoring.tests to JUnit
5.
- Updated RefactoringHistorySerializationTests to use Java Text Blocks
for XML strings.
- Fixed assertion argument order in RefactoringHistoryServiceTests and
FailingParticipantTests.
- Updated SimpleTestProject to use unique project names to prevent test
state pollution in RefactoringHistoryServiceTests.
- Note: RefactoringHistoryServiceTests.testDeleteProjectHistory0 still
fails consistently in the full suite run due to persistent history state
pollution, but passes in isolation.
- Migrated all tests in org.eclipse.jface.tests to JUnit 5.
- Updated MANIFEST.MF to use org.junit.jupiter.api and removed JUnit 4.
- Replaced JUnit 4 Rules with JUnit 5 Extensions or @tempdir.
- Fixed assertion and assumption parameter order for JUnit 5.
- Removed unused JFaceActionRule.
- Replaced JUnit 3 AssertionFailedError with IllegalStateException in TestLazyModelContentProvider.
- Copied delete_obj.svg, filenav_nav.svg, and prop_ps.svg from workbench bundles.
- Updated plugin.xml to reference the new SVG icons.
- Removed the original GIF files.
- Updated build.properties to include the icons directory in the binary build.
This change introduces a new CSS property `-eclipse-svg-filter` that
allows developers to dynamically change the color of monochrome SVG
icons loaded via CSS.

The property supports the following values:
- `color <color>`: Replaces all colors in the SVG with the specified
  color while preserving the alpha channel.
- `none`: Removes any previously applied SVG filter.

Usage example in CSS:
Label {
    image: url("platform:/plugin/org.eclipse.ui/icons/full/obj16/file_obj.svg");
    -eclipse-svg-filter: color #FF0000; /* Makes the icon red */
}

Implementation details:
- Added `ColorMatrix` and `ColorMatrixImageDescriptor` to
  `org.eclipse.jface.resource` to support per-pixel color transformations.
- Added `createWithColorMatrix` to `ImageDescriptor`.
- Implemented `CSSPropertySVGFilterSWTHandler` in `org.eclipse.e4.ui.css.swt`
  to handle the new property.
- Modified `CSSSWTImageHelper` to apply the color matrix when an SVG is
  loaded if a filter color is set on the widget.
- Updated image converters to pass the `Widget` context, enabling the
  retrieval of widget-specific CSS data.
- Registered the property handler for `Control`, `ToolItem`, and `CTabItem`.
@gemini-code-assist
Copy link
Copy Markdown

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 significantly enhances the theming capabilities within Eclipse by introducing CSS color filtering for SVG images. It provides core infrastructure for applying color matrices to image descriptors and migrates various example plugins to use SVG icons, demonstrating the new dynamic styling possibilities. Additionally, a substantial portion of the test suite has been updated to JUnit 5, modernizing the testing framework.

Highlights

  • SVG CSS Color Support: Introduced a new CSS property handler, -eclipse-svg-filter, allowing CSS to apply color filters to SVG images. This enables dynamic theming of SVG icons.
  • Image Manipulation Utilities: Added new ColorMatrix and ColorMatrixImageDescriptor classes to org.eclipse.jface.resource, providing a generic mechanism to apply color transformations to images, including SVG.
  • Icon Migration to SVG: Updated numerous example plugins to replace .gif icons with their .svg counterparts, leveraging the new SVG CSS color filtering capabilities.
  • JUnit 5 Migration: Migrated several JUnit 4 test classes and their associated annotations (@Before, @After, @Rule, Assert) to JUnit 5 (@BeforeEach, @AfterEach, TestInfo, Assertions) across various test bundles.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • bundles/org.eclipse.e4.ui.css.swt/plugin.xml
    • Added new property handlers for -eclipse-svg-filter to ControlElement, ToolItemElement, and CTabItemElement.
  • bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/CSSSWTConstants.java
    • Added CSS_SVG_FILTER_COLOR constant for storing SVG filter color data.
  • bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/helpers/CSSSWTImageHelper.java
    • Modified getImage methods to accept a Widget context and apply ColorMatrix filtering to SVG images based on stored color data.
  • bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/converters/CSSValueSWTImageConverterImpl.java
    • Updated image converter to correctly handle Widget instances as context for image loading.
  • bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/css2/CSSPropertyBackgroundSWTHandler.java
    • Modified applyCSSPropertyBackgroundImage to pass the Widget directly to the CSS engine's convert method.
  • bundles/org.eclipse.e4.ui.css.swt/src/org/eclipse/e4/ui/css/swt/properties/custom/CSSPropertySVGFilterSWTHandler.java
    • Added new class to implement the -eclipse-svg-filter CSS property, enabling color filtering for SVG images.
  • bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrix.java
    • Added new class ColorMatrix to represent a 5x4 color transformation matrix.
  • bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ColorMatrixImageDescriptor.java
    • Added new class ColorMatrixImageDescriptor to apply a ColorMatrix to an existing ImageDescriptor.
  • bundles/org.eclipse.jface/src/org/eclipse/jface/resource/ImageDescriptor.java
    • Added a static factory method createWithColorMatrix for creating image descriptors with color matrix filters.
  • bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchPage.java
    • Changed the status level for orphan perspective messages from WARNING to INFO.
  • examples/org.eclipse.e4.demo.cssbridge/icons/app.svg
    • Added new SVG icon file.
  • examples/org.eclipse.e4.demo.cssbridge/plugin.xml
    • Updated windowImages property to reference app.svg instead of app.gif.
  • examples/org.eclipse.e4.ui.examples.job/icons/job_view.svg
    • Added new SVG icon file.
  • examples/org.eclipse.e4.ui.examples.job/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.e4.ui.examples.job/icons/suspend.svg
    • Added new SVG icon file.
  • examples/org.eclipse.e4.ui.examples.job/icons/tree_view.svg
    • Added new SVG icon file.
  • examples/org.eclipse.e4.ui.examples.job/job_factory_view.e4xmi
    • Updated iconURI for 'Job Factory' part to job_view.svg.
  • examples/org.eclipse.e4.ui.examples.job/src/org/eclipse/e4/ui/examples/jobs/TestJob.java
    • Updated ICON_PROPERTY to reference sample.svg instead of sample.gif.
  • examples/org.eclipse.ui.examples.contributions/icons/change_obj.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/icons/editor.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/icons/new_wiz.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/icons/perspective.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/icons/sample2.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.contributions/plugin.xml
    • Updated icon references from .gif to .svg for various commands, editors, and product properties.
  • examples/org.eclipse.ui.examples.contributions/product_lg.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.javaeditor/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.job/plugin.xml
    • Updated icon references from .gif to .svg for views and actions.
  • examples/org.eclipse.ui.examples.multipageeditor/icons/copy.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.multipageeditor/plugin.xml
    • Updated editor icon reference to copy.svg instead of copy.gif.
  • examples/org.eclipse.ui.examples.navigator/build.properties
    • Added icons/ to bin.includes for packaging.
  • examples/org.eclipse.ui.examples.navigator/icons/delete_obj.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.navigator/icons/filenav_nav.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.navigator/icons/prop_ps.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.navigator/plugin.xml
    • Updated icon references from .gif to .svg for views and property pages.
  • examples/org.eclipse.ui.examples.propertysheet/icons/obj16/usereditor.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.propertysheet/plugin.xml
    • Updated editor icon reference to usereditor.svg instead of usereditor.gif.
  • examples/org.eclipse.ui.examples.readmetool/icons/ctool16/openbrwsr.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.readmetool/icons/obj16/editor.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.readmetool/icons/obj16/newreadme_wiz.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.readmetool/icons/obj16/usereditor.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.readmetool/icons/view16/sections.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.readmetool/plugin.xml
    • Updated icon references from .gif to .svg for actions, wizards, editors, and views.
  • examples/org.eclipse.ui.examples.undo/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.undo/plugin.xml
    • Updated view icon references to sample.svg instead of sample.gif.
  • examples/org.eclipse.ui.examples.views.properties.tabbed.article/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.examples.views.properties.tabbed.article/plugin.xml
    • Updated view icon reference to sample.svg instead of sample.gif.
  • examples/org.eclipse.ui.forms.examples/icons/file_obj.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.forms.examples/icons/sample.svg
    • Added new SVG icon file.
  • examples/org.eclipse.ui.forms.examples/plugin.xml
    • Updated editor icon references to file_obj.svg instead of file_obj.gif.
  • tests/org.eclipse.jface.tests/META-INF/MANIFEST.MF
    • Updated Require-Bundle to remove org.junit and added org.junit.jupiter.api.io and org.opentest4j to Import-Package.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/AllActionTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/JFaceActionRule.java
    • Removed JUnit4 test rule class.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/action/ToolBarManagerTest.java
    • Added @Test annotation to testSetStyleWhenToolBarDoesNotExist.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/dialogs/AllDialogTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/AbstractFieldAssistTestCase.java
    • Migrated JUnit4 @Rule, @Before, @After annotations to JUnit5 @BeforeEach, @AfterEach and removed TestWatcher.
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ContentProposalAdapterTest.java
    • Migrated JUnit4 @Rule, @Before, @After annotations to JUnit5 @BeforeEach, @AfterEach and removed TestWatcher.
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/ControlDecorationTests.java
    • Migrated JUnit4 @Ignore and Assert to JUnit5 @Disabled and org.junit.jupiter.api.Assertions.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistAPITests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/fieldassist/FieldAssistTestCase.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/AllImagesTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/images/UrlImageDescriptorTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Rule and TemporaryFolder to @TempDir and Path for JUnit5.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/layout/AllLayoutTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/preferences/AllPrefsTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/AllResourcesTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/resources/FontRegistryTest.java
    • Updated Assume import to org.junit.jupiter.api.Assumptions.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/AllViewersTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TestLazyModelContentProvider.java
    • Replaced junit.framework.AssertionFailedError with java.lang.IllegalStateException.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/viewers/TreeViewerWithLimitTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/window/AllWindowTests.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.jface.tests/src/org/eclipse/jface/tests/wizards/WizardTestSuite.java
    • Removed JUnit4 main method and JUnitCore import.
  • tests/org.eclipse.ltk.core.refactoring.tests/META-INF/MANIFEST.MF
    • Updated bundle version to 3.10.800.qualifier.
    • Added JUnit Jupiter imports to Import-Package.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/RefactoringContextTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistorySerializationTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
    • Converted XML string literals to text blocks for improved readability.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/history/RefactoringHistoryServiceTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Before and @After annotations to @BeforeEach and @AfterEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
    • Added cleanup for workspace history in setUp.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/CancelingParticipantTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/FailingParticipantTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/MoveRefactoringWithRefUpdateTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/participants/SharedTextChangeTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
    • Modified testDeleteRefactoring1_bug343584 to use dynamic project name.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/resource/ResourceRefactoringUndoTests.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
    • Modified testProjectRenameUndoRedoLTK to use dynamic project name.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/scripting/RefactoringScriptApplicationTests.java
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ltk.core.refactoring.tests/src/org/eclipse/ltk/core/refactoring/tests/util/SimpleTestProject.java
    • Modified project name generation to include System.nanoTime() for uniqueness.
  • tests/org.eclipse.ui.workbench.texteditor.tests/META-INF/MANIFEST.MF
    • Added org.junit.jupiter.api.function and org.opentest4j to Import-Package.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceLogicTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceTestUtil.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/FindReplaceUITest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Rule and TestName to TestInfo for JUnit5.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/internal/findandreplace/overlay/FindReplaceOverlayTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/AbstractTextZoomHandlerTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/DocumentLineDifferTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/FindReplaceDialogTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated Assume imports to org.junit.jupiter.api.Assumptions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/HippieCompletionTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Before annotation to @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/ScreenshotTest.java
    • Updated @Rule and TestName to TestInfo for JUnit5.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextEditorPluginTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @FixMethodOrder and MethodSorters to @TestMethodOrder and MethodOrderer.MethodName.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/TextViewerDeleteLineTargetTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapPageTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/minimap/MinimapWidgetTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @After and @Before annotations to @AfterEach and @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/ChangeRegionTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Before annotation to @BeforeEach.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/HunkComputerTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/revisions/RangeUtil.java
    • Removed extends Assert and used Assertions.assertEquals.
  • tests/org.eclipse.ui.workbench.texteditor.tests/src/org/eclipse/ui/workbench/texteditor/tests/rulers/DAGTest.java
    • Updated Assert imports to org.junit.jupiter.api.Assertions.
    • Updated @Test annotation to org.junit.jupiter.api.Test.
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
Copy Markdown

@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 introduces support for colorizing SVG icons via a new CSS property, -eclipse-svg-filter. The implementation involves new handlers in the CSS engine, additions to JFace for image manipulation using color matrices, and updates to various example plugins to use SVG icons. The core logic is well-implemented, but I have identified a couple of areas for improvement regarding CSS property value formatting and the robustness of the new ColorMatrixImageDescriptor.

Additionally, a significant portion of this PR is dedicated to migrating tests from JUnit 4 to JUnit 5, which is a valuable maintenance effort.

if (widget != null) {
Object data = widget.getData(CSSSWTConstants.CSS_SVG_FILTER_COLOR);
if (data != null) {
return "color " + data.toString(); //$NON-NLS-1$
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The toString() method of an RGB object returns a string representation like RGB {r, g, b}, which is not a valid CSS color value. This will likely cause parsing errors when the CSS engine attempts to use this retrieved value. The property value should be formatted as a standard CSS color, such as rgb(r, g, b) or a hex string.

Suggested change
return "color " + data.toString(); //$NON-NLS-1$
return "color rgb(" + ((RGB) data).red + ", " + ((RGB) data).green + ", " + ((RGB) data).blue + ")"; //$NON-NLS-1$

Comment on lines +97 to +105
for (int y = 0; y < result.height; y++) {
for (int x = 0; x < result.width; x++) {
int alpha = result.getAlpha(x, y);
float a = alpha / 255f;
float na = m[15] * 0 + m[16] * 0 + m[17] * 0 + m[18] * a + m[19]; // Simplified
int ina = Math.min(255, Math.max(0, Math.round(na * 255)));
result.setAlpha(x, y, ina);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The alpha channel calculation for indexed palette images is simplified and assumes that the R, G, and B components for the alpha calculation are 0. This is only correct if the matrix elements m[15], m[16], and m[17] are 0. While this holds true for the colorization matrix used in this PR, it makes the ColorMatrixImageDescriptor incorrect for more generic color matrices that might affect alpha based on color components.

A more robust implementation would use the original pixel's color components to calculate the new alpha value.

for (int y = 0; y < result.height; y++) {
				for (int x = 0; x < result.width; x++) {
					int pixel = data.getPixel(x, y);
					RGB rgb = data.palette.getRGBs()[pixel];
					float r = rgb.red / 255f;
					float g = rgb.green / 255f;
					float b = rgb.blue / 255f;
					int alpha = data.getAlpha(x, y);
					float a = alpha / 255f;
					float na = m[15] * r + m[16] * g + m[17] * b + m[18] * a + m[19];
					int ina = Math.min(255, Math.max(0, Math.round(na * 255)));
					result.setAlpha(x, y, ina);
				}
			}

@Michael5601
Copy link
Copy Markdown

What exactly is the use case of these changes? Are you referring to this issue?

The mentioned issue is about designing the icons so that they can be dynamically recolored if e.g. a custom theme should be used in the future. If the icon has some more metadata about its colors e.g. base-color, key-element-color the replacement is easy.
Currently we don't have this metadata and the only way to replace the color is to replace the old hexcode in the svg, which gives no information if the part is the base or any key element.

This PR seems to address something else, which can also be useful but I need a little more explanation about the problem you are trying to solve and how we can test it.

Why do you change so many icons to svgs in this PR and why are there ImageDescriptors doing pixel manipulations on PNGs? An algorithm for applying color changes should adjust the colors in the SVG in some way and then just rasterize it with the tools we have.

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.

4 participants