Skip to content

Reuse the platform syntax colors in the Ant editor - #2920

Merged
vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:vogella/shared-markup-colors
Sep 15, 2026
Merged

vogella merged 1 commit into
eclipse-platform:masterfrom
vogella:vogella/shared-markup-colors

Conversation

@vogella

@vogella vogella commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

The Ant editor kept its syntax colors in the Ant preference store, with a Syntax tab on the Ant > Editor preference page, per token bold and italic flags and a dark palette of its own. It now reads the shared colors from eclipse-platform/eclipse.platform.ui#4372, which removes about 600 lines and puts Ant under the same "Syntax coloring" entry as the other editors. Attribute names now get the shared attribute name color, as in the PDE XML editors.

Worth review attention: the Syntax tab and the per token font styles are gone, the XML declaration and the DTD now share the one directive color instead of two, unstyled text follows the editor foreground color, and old Ant customizations are not migrated. Colors come from the theme color registry rather than the preference store, because a non default theme prefixes the preference key with the theme id and a lookup by bare id would silently miss it.

@vogella
vogella force-pushed the vogella/shared-markup-colors branch from c7fee4b to 212a431 Compare September 10, 2026 20:54
@github-actions

github-actions Bot commented Sep 10, 2026

Copy link
Copy Markdown
Contributor

Test Results

    54 files  ±0      54 suites  ±0   57m 39s ⏱️ + 2m 11s
 4 810 tests ±0   4 788 ✅ ±0   22 💤 ±0  0 ❌ ±0 
12 321 runs  ±0  12 168 ✅ ±0  153 💤 ±0  0 ❌ ±0 

Results for commit 83835c4. ± Comparison against base commit 4d0839d.

♻️ This comment has been updated with latest results.

@vogella
vogella force-pushed the vogella/shared-markup-colors branch 2 times, most recently from 06c1833 to 7342ee8 Compare September 14, 2026 08:46
@vogella
vogella marked this pull request as ready for review September 14, 2026 13:43
@vogella

vogella commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author
ant-dark-compare-attr ant-light-compare-attr

@vogella
vogella force-pushed the vogella/shared-markup-colors branch 2 times, most recently from c55b216 to 403018f Compare September 14, 2026 14:40
The Ant editor kept its own syntax colors in the Ant preference store,
with a Syntax tab on the Ant > Editor preference page, per token bold and
italic flags and a dark palette of its own. It now reads the shared colors
that org.eclipse.ui.editors provides, so all editors are configured in one
place, under Colors and Fonts.

Attribute names get the shared attribute name color instead of the tag
color, as in the other XML editors. The Syntax tab and the per token font
styles are gone, unstyled text follows the editor foreground color, and
existing customizations of the old Ant keys are not migrated. Colors come
from the theme color registry rather than the preference store, because a
non default theme prefixes the preference key with the theme id. The
workbench store is chained into the Ant one so that the editor still
repaints when a theme color changes.

Contributes to eclipse-platform/eclipse.platform.ui#4291

Assisted-by: multiple AI agents and layers of automated tooling 🤖
@vogella
vogella force-pushed the vogella/shared-markup-colors branch from 403018f to 83835c4 Compare September 14, 2026 16:15
@vogella

vogella commented Sep 14, 2026

Copy link
Copy Markdown
Contributor Author

This also fixes an existing DataFormatException during theme switch, if an Ant editor is open during that switch as it removes the extra logic with the error. To test, open Ant editor and afterwards switch from light to dark or vice versa.

org.eclipse.jface.resource.DataFormatException
	at org.eclipse.jface.resource.StringConverter.asRGB(StringConverter.java:568)
	at org.eclipse.ant.internal.ui.editor.text.AbstractAntEditorScanner.adaptToColorChange(AbstractAntEditorScanner.java:38)
	at org.eclipse.ant.internal.ui.editor.text.AntEditorProcInstrScanner.adaptToPreferenceChange(AntEditorProcInstrScanner.java:69)
	at org.eclipse.ant.internal.ui.AntSourceViewerConfiguration.adaptToPreferenceChange(AntSourceViewerConfiguration.java:112)
	at org.eclipse.ant.internal.ui.editor.AntEditor.handlePreferenceStoreChanged(AntEditor.java:716)
	at org.eclipse.ui.texteditor.AbstractTextEditor$PropertyChangeListener.propertyChange(AbstractTextEditor.java:764)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore.firePropertyChangeEvent(ChainedPreferenceStore.java:156)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore.handlePropertyChangeEvent(ChainedPreferenceStore.java:383)
	at org.eclipse.ui.texteditor.ChainedPreferenceStore$PropertyChangeListener.propertyChange(ChainedPreferenceStore.java:70)
	at org.eclipse.jface.preference.ScopedPreferenceStore$1.run(ScopedPreferenceStore.java:297)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.jface.preference.ScopedPreferenceStore.firePropertyChangeEvent(ScopedPreferenceStore.java:294)
	at org.eclipse.jface.preference.ScopedPreferenceStore$EclipsePreferencesListener.preferenceChange(ScopedPreferenceStore.java:664)
	at org.eclipse.core.internal.preferences.EclipsePreferences.lambda$2(EclipsePreferences.java:833)
	at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:47)
	at org.eclipse.core.internal.preferences.EclipsePreferences.firePreferenceEvent(EclipsePreferences.java:833)
	at org.eclipse.core.internal.preferences.EclipsePreferences.remove(EclipsePreferences.java:892)
	at org.eclipse.e4.ui.css.swt.helpers.EclipsePreferencesHelper.resetOverriddenDefaults(EclipsePreferencesHelper.java:177)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$StylingPreferencesHandler.resetOverriddenPreferences(PartRenderingEngine.java:1446)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$StylingPreferencesHandler.resetOverriddenPreferences(PartRenderingEngine.java:1441)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$StylingPreferencesHandler.handleEvent(PartRenderingEngine.java:1435)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.subscribeCssThemeChanged(PartRenderingEngine.java:380)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58)
	at org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler.handleEvent(EventObjectSupplier.java:92)
	at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:206)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:201)
	at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1)
	at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
	at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151)
	at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132)
	at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:73)
	at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:48)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.sendThemeChangeEvent(ThemeEngine.java:572)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:551)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:479)
	at org.eclipse.e4.ui.css.swt.internal.theme.ThemeEngine.setTheme(ThemeEngine.java:460)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at com.vogella.eclipse.mcp.ui.internal.CssStyling.switchTheme(CssStyling.java:511)
	at com.vogella.eclipse.mcp.ui.internal.ThemeTools$SetTheme.lambda$0(ThemeTools.java:94)
	at com.vogella.eclipse.mcp.ui.internal.UiThread.completeFrom(UiThread.java:118)
	at com.vogella.eclipse.mcp.ui.internal.UiThread.lambda$0(UiThread.java:101)
	at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
	at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:131)
	at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:5078)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4534)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1160)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1051)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:153)
	at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:678)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:339)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:581)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:173)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:193)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:219)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:149)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:115)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:467)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:298)
	at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
	at java.base/java.lang.reflect.Method.invoke(Method.java:565)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:615)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:563)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1415)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1387)

@vogella
vogella merged commit 2d15cf3 into eclipse-platform:master Sep 15, 2026
18 checks passed
@vogella
vogella deleted the vogella/shared-markup-colors branch September 15, 2026 07:24
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.

1 participant