Bug 476037 - Some commands (+shortcuts) to Increase/decrease font size
Summary: Some commands (+shortcuts) to Increase/decrease font size
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 4.5   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.6 M4   Edit
Assignee: Mickael Istria CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 192391 196957 421929 (view as bug list)
Depends on:
Blocks: 84776 469918 482913 483472 483877 492202 483645 483939 484157 485757 502201
  Show dependency tree
 
Reported: 2015-08-27 08:32 EDT by Mickael Istria CLA
Modified: 2016-11-07 12:14 EST (History)
12 users (show)

See Also:


Attachments
Test case showing issue between ThemeAPI vs PreferencePage (4.47 KB, text/plain)
2015-11-27 10:14 EST, Mickael Istria CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mickael Istria CLA 2015-08-27 08:32:42 EDT
A followup of discussions on bug 469918.
In order to easily provide zoom-like operations for text editors, pretty useful when doing presentations, or when often changing screen resolution, Platform/Text should provide commands to increase/decrease font sizes, typically bound to the common Ctrl+ and Ctrl- shortcuts,
Comment 1 Mickael Istria CLA 2015-08-27 09:18:09 EDT
Targetting as 4.6.M2, since patch is already available.
Comment 2 Brian de Alwis CLA 2015-08-27 09:27:56 EDT
I'd suggest the commands be 'org.eclipse.ui.internal.X' or .experimental just to ensure that we can rename them later.
Comment 3 Mickael Istria CLA 2015-08-28 10:52:46 EDT
@Brian: thanks for the command. I added "internal" to commandid on a newer version of the patch (tracked in same Gerrit review)
Comment 4 Mickael Istria CLA 2015-11-27 10:14:15 EST
Created attachment 258322 [details]
Test case showing issue between ThemeAPI vs PreferencePage

This JUnit tests shows how using the Theme API fontRegistry doesn't work well with the preferenceStore using in ColorsAndFontsPreferencePage.
It's an issue that was detected by Dani. The tests highlights that with the following failure:

java.lang.AssertionError: expected:<10> but was:<17>
	at org.junit.Assert.fail(Assert.java:88)
	at org.junit.Assert.failNotEquals(Assert.java:834)
	at org.junit.Assert.assertEquals(Assert.java:645)
	at org.junit.Assert.assertEquals(Assert.java:631)
	at org.eclipse.ui.tests.preferences.ZoomAndPreferencesFontTest.restoreAndCheckDefaults(ZoomAndPreferencesFontTest.java:86)
	at org.eclipse.ui.tests.preferences.ZoomAndPreferencesFontTest.testThemeAPIvsPreferences(ZoomAndPreferencesFontTest.java:99)
...

The issue is that the PreferencePage uses its preferenceStore to store a copy of the theme elements. When using PrefrencePage only, there is consistency between the current theme FontRegistry and the preferenceStore.
However, when updating via FontRegistry, the preferenceStore is not modified and still believes the font is default. Then the change that restore to defaults doesn't appear to be a modification and isn't propagated to Theme.
Keeping both FontRegistry and PreferenceStore for these data is the source of the problems. IMO, the PreferencePage should only deal with the registry directly.
As a workaround, there can be many things:
* Reconcile on opening of the ColorsAndFontsPreferencePage (ie update preferenceStore with fresh data from current theme)
* Reconcile before applying the operation
* Put a listener on the fontRegistry when loading the Workbench. That listener would propagate changes applied via FontRegistry to the preferenceStore.
Comment 6 Dani Megert CLA 2015-12-02 08:25:07 EST
*** Bug 192391 has been marked as a duplicate of this bug. ***
Comment 7 Dani Megert CLA 2015-12-02 08:25:23 EST
*** Bug 196957 has been marked as a duplicate of this bug. ***
Comment 8 Dani Megert CLA 2015-12-02 08:26:04 EST
*** Bug 421929 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2015-12-02 08:33:55 EST
Zooming for Compare editors is tracked by bug 483472.
Comment 11 Eclipse Genie CLA 2015-12-02 09:17:17 EST
New Gerrit change created: https://git.eclipse.org/r/61778
Comment 13 Lars Vogel CLA 2015-12-02 10:10:00 EST
Awesome Mickael and thanks to Dani for the intensive review.
Comment 14 Lars Vogel CLA 2015-12-04 04:57:37 EST
Validated in 4.6.0.I20151203-1230
Comment 15 Martin Oberhuber CLA 2015-12-04 06:27:39 EST
So I haven't followed the size/complexity of the code changes for this, but I'm wondering ... is this change a possible candidate for Mars.2 ?
Comment 16 Lars Vogel CLA 2015-12-04 06:32:54 EST
(In reply to Martin Oberhuber from comment #15)
> So I haven't followed the size/complexity of the code changes for this, but
> I'm wondering ... is this change a possible candidate for Mars.2 ?

No, in platform we downport only bugfixes. But you can use http://saneclipse.vogella.com/download.html for Eclipse 4.5.