Bug 564970 - Tree size via CSS resetted by EGit
Summary: Tree size via CSS resetted by EGit
Status: RESOLVED FIXED
Alias: None
Product: EGit
Classification: Technology
Component: UI (show other bugs)
Version: 5.8   Edit
Hardware: PC Windows 10
: P3 normal (vote)
Target Milestone: 5.9   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-06 09:08 EDT by Lars Vogel CLA
Modified: 2020-07-23 08:44 EDT (History)
3 users (show)

See Also:


Attachments
Screenshot (30.34 KB, image/png)
2020-07-06 09:08 EDT, Lars Vogel CLA
no flags Details
Git History view with Tree/Table font preference modified (83.96 KB, image/png)
2020-07-06 12:57 EDT, Andrew Obuchowicz CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lars Vogel CLA 2020-07-06 09:08:19 EDT
Created attachment 283521 [details]
Screenshot

The EGit decorators seem to reset the tree and table size settings from the CSS. See screenshot.
Comment 1 Andrew Obuchowicz CLA 2020-07-06 11:21:14 EDT
Maybe a preference listener should be created in EGit to listen for the Tree/Table views font preference change, get the size of the font and apply it to egit's uncommitted change font?
Comment 2 Thomas Wolf CLA 2020-07-06 12:37:22 EDT
Additionally, the IgnoredResourceFont and UncommittedChangeFont have no default set. Shouldn't they default to whatever the default font for trees is?
Comment 3 Andrew Obuchowicz CLA 2020-07-06 12:39:32 EDT
@Thomas maybe the lack of default font is the root cause of this bug? I'm +1 for including that in the scope of the bug fix.
Comment 4 Thomas Wolf CLA 2020-07-06 12:41:51 EDT
@Andrew: what would I have to use as default font reference in plugin.xml? org.eclipse.jface.dialogfont? Or what is the default font for trees?
Comment 5 Thomas Wolf CLA 2020-07-06 12:48:02 EDT
BTW, @Lars: does it work in the Git history view? That one also has its own font preference, defaulting to org.eclipse.jface.dialogfont. And it lacks a preference listener to react on changes to the preferences related to the commit table.
Comment 6 Andrew Obuchowicz CLA 2020-07-06 12:48:58 EDT
(In reply to Thomas Wolf from comment #4)
> @Andrew: what would I have to use as default font reference in plugin.xml?
> org.eclipse.jface.dialogfont? Or what is the default font for trees?

The new font for Tree's/Table's was introduced in https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/154839/

The font to use should be org.eclipse.ui.workbench.TREE_TABLE_FONT. Are the IgnoredResourceFont and UncommittedChangeFont only being used in Tree's & Tables? Otherwise there might be a bug where the font is not sized correctly in some areas.
Comment 7 Andrew Obuchowicz CLA 2020-07-06 12:57:38 EDT
Created attachment 283522 [details]
Git History view with Tree/Table font preference modified

@Thomas here's what the git history view looks like when the Tree/Table view font preference is changed. Almost all of the font's are modified except for the commit message.
Comment 8 Thomas Wolf CLA 2020-07-06 13:12:32 EDT
(In reply to Andrew Obuchowicz from comment #6)
> (In reply to Thomas Wolf from comment #4)
> > @Andrew: what would I have to use as default font reference in plugin.xml?
> > org.eclipse.jface.dialogfont? Or what is the default font for trees?
> 
> The new font for Tree's/Table's was introduced in
> https://git.eclipse.org/r/c/platform/eclipse.platform.ui/+/154839/
> 
> The font to use should be org.eclipse.ui.workbench.TREE_TABLE_FONT. Are the
> IgnoredResourceFont and UncommittedChangeFont only being used in Tree's &
> Tables? Otherwise there might be a bug where the font is not sized correctly
> in some areas.

Hmmm... will have to see what happens if I use that as default on an Eclipse that doesn't have it yet.
Comment 9 Thomas Wolf CLA 2020-07-06 13:14:29 EDT
(In reply to Andrew Obuchowicz from comment #7)
> Created attachment 283522 [details]
> Git History view with Tree/Table font preference modified
> 
> @Thomas here's what the git history view looks like when the Tree/Table view
> font preference is changed. Almost all of the font's are modified except for
> the commit message.

So that means no extra listener would be needed to pick up the change, at least not if the font is unchanged from the default. The table font defaults to org.eclipse.jface.dialogfont.

The commit message would need some work, this is an owner-drawn column.
Comment 10 Andrew Obuchowicz CLA 2020-07-06 13:24:26 EDT
> Hmmm... will have to see what happens if I use that as default on an Eclipse
> that doesn't have it yet.

Good point, please let me know what happens in this case.
Comment 11 Andrew Obuchowicz CLA 2020-07-06 13:26:36 EDT
(In reply to Thomas Wolf from comment #9)
> (In reply to Andrew Obuchowicz from comment #7)
> > Created attachment 283522 [details]
> > Git History view with Tree/Table font preference modified
> > 
> > @Thomas here's what the git history view looks like when the Tree/Table view
> > font preference is changed. Almost all of the font's are modified except for
> > the commit message.
> 
> So that means no extra listener would be needed to pick up the change, at
> least not if the font is unchanged from the default. The table font defaults
> to org.eclipse.jface.dialogfont.

OK good to know

> The commit message would need some work, this is an owner-drawn column.

Ahh I see. Alternatively (might be easier but less ideal) the font used in the Git history view could differ from the Tree & Table view font. Although I have a feeling a followup bug would be created about this, if this direction is taken for the moment.
Comment 12 Thomas Wolf CLA 2020-07-06 14:21:34 EDT
(In reply to Andrew Obuchowicz from comment #10)
> > Hmmm... will have to see what happens if I use that as default on an Eclipse
> > that doesn't have it yet.
> 
> Good point, please let me know what happens in this case.

!ENTRY org.eclipse.ui 4 0 2020-07-06 20:05:51.543
!MESSAGE Unhandled event loop exception
!STACK 0
java.lang.NullPointerException
	at org.eclipse.ui.internal.themes.ColorsAndFontsPreferencePage$PresentationLabelProvider.getText(ColorsAndFontsPreferencePage.java:520)
	at org.eclipse.jface.viewers.ViewerComparator.getLabel(ViewerComparator.java:160)
	at org.eclipse.jface.viewers.ViewerComparator.compare(ViewerComparator.java:136)
	at org.eclipse.jface.viewers.ViewerComparator.lambda$0(ViewerComparator.java:205)

So we can't use that org.eclipse.ui.workbench.TREE_TABLE_FONT. EGit can perhaps use org.eclipse.jface.dialogfont, like it does for the commit table.
Comment 13 Thomas Wolf CLA 2020-07-06 14:22:16 EDT
(In reply to Thomas Wolf from comment #12)
> !ENTRY org.eclipse.ui 4 0 2020-07-06 20:05:51.543
> !MESSAGE Unhandled event loop exception
> !STACK 0
> java.lang.NullPointerException

When opening Colors & Fonts preferences and trying to expand the Git node.
Comment 14 Andrew Obuchowicz CLA 2020-07-06 14:47:46 EDT
> 
> So we can't use that org.eclipse.ui.workbench.TREE_TABLE_FONT. EGit can
> perhaps use org.eclipse.jface.dialogfont, like it does for the commit table.

This seems okay to me :) Thanks for checking that
Comment 15 Thomas Wolf CLA 2020-07-06 15:27:42 EDT
(In reply to Andrew Obuchowicz from comment #14)
> > 
> > So we can't use that org.eclipse.ui.workbench.TREE_TABLE_FONT. EGit can
> > perhaps use org.eclipse.jface.dialogfont, like it does for the commit table.
> 
> This seems okay to me :)

No, not OK. When the user changes the dialog font, the uncommitted and ignored resources pick up that change, but of course all other resources in the package explorer keep using the tree font.

In the history table, using the dialog font is already questionable, but kinda work (if I add a listener to catch preference changes for the EGit font preference). At least the whole table follows suit.

Is there a way to conditionally figure out whether that TREE_TABLE_FONT exists and change the font definition (maybe programmatically) such that the EGit fonts set that as default only if it exists?
Comment 16 Eclipse Genie CLA 2020-07-06 15:39:02 EDT
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/165922
Comment 17 Thomas Wolf CLA 2020-07-06 15:44:14 EDT
(In reply to Eclipse Genie from comment #16)
> New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/165922

This should make the whole commit table in the history view react on font changes.

Not sure what we could do with the tree fonts if we can't use TREE_TABLE_FONT as default.
Comment 18 Eclipse Genie CLA 2020-07-11 12:40:56 EDT
New Gerrit change created: https://git.eclipse.org/r/c/egit/egit/+/166185
Comment 19 Andrew Obuchowicz CLA 2020-07-12 01:30:38 EDT
> 
> No, not OK. When the user changes the dialog font, the uncommitted and
> ignored resources pick up that change, but of course all other resources in
> the package explorer keep using the tree font.
> 
> In the history table, using the dialog font is already questionable, but
> kinda work (if I add a listener to catch preference changes for the EGit
> font preference). At least the whole table follows suit.


OK understood, thank you for the additional investigation on the issue.

> Is there a way to conditionally figure out whether that TREE_TABLE_FONT
> exists and change the font definition (maybe programmatically) such that the
> EGit fonts set that as default only if it exists?

I'll try to figure something out this coming week & review your patch.