Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 26987 - Search dialogs do not honour the dialog font
Summary: Search dialogs do not honour the dialog font
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Search (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 2.1 RC3   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: 19346
  Show dependency tree
 
Reported: 2002-11-22 12:27 EST by Tod Creasey CLA
Modified: 2003-08-07 07:27 EDT (History)
2 users (show)

See Also:


Attachments
fixes dialogs (14.00 KB, patch)
2002-11-28 15:24 EST, Sebastian Davids CLA
no flags Details | Diff
fixes ReplaceDialog (1.99 KB, patch)
2002-11-28 19:58 EST, Sebastian Davids CLA
no flags Details | Diff
fixes dialogs and pref page (17.51 KB, patch)
2002-11-29 17:21 EST, Sebastian Davids CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Tod Creasey CLA 2002-11-22 12:27:43 EST
20021115

The dialog font is not honoured by the search preference page or main dialog. 
Preference pages have the dialog font set as the font of the control sent to 
createContents - you can just copy the font from the parent to the children 
you create. Other dialogs can get it by calling JFaceResources.getDialogFont().
Comment 1 Dani Megert CLA 2002-11-25 04:26:22 EST
Do I have to apply the font to all the widgets i.e. text, combos, radios... or
only to the page and the dialog?
Comment 2 Tod Creasey CLA 2002-11-25 08:17:25 EST
To all of widgets. The easiest way to do this is is use setFont(parent.getFont
()) - we already propogate this font as far as we can for you.

BTW the search page is already halfway there as all of the JFace components 
give you this for free - only the radios and the combo boxes need this. The 
easiest way to test is to set the dialog font in the fonts preference page 
(will be in tomorrows integration build)and see what doesn't change.
Comment 3 Dani Megert CLA 2002-11-28 09:22:17 EST
I changed the font and looked at the search preference page: can you please
explain why some of the field editor fonts (e.g. checkbox) are set and some are not?

What would be the code to set the font on a field editor - there is no setFont
API and boolEditor.getLabelControl(parent) ends in having two widgets/editors.
Comment 4 Tod Creasey CLA 2002-11-28 09:25:52 EST
Please let me know which are not set. If we do not set them this is our bug.
Comment 5 Sebastian Davids CLA 2002-11-28 15:24:47 EST
Created attachment 2569 [details]
fixes dialogs

fixes the following:

SearchDialog
ExtendedDialogWindow
TextSearchPage
ScopePart
TypeFilteringDialog
ListDialog

@@@@

Preference page cannot be changed because there is no way to change the font of
a FieldEditor :(

applyFont() - is called on all FieldEditors but there's no way to set the font

@@@@

Todo:

SearchPreferencePage#createFieldEditors() -- set the font for the FieldEditors
Comment 6 Sebastian Davids CLA 2002-11-28 19:58:02 EST
Created attachment 2573 [details]
fixes ReplaceDialog

forgot that one ;)
Comment 7 Dani Megert CLA 2002-11-29 02:45:34 EST
A solution which needs all other pages (of which I know nothing) to catch-up is
not acceptable.

Imagine this feature when using WSAD and/or other contributed plug-ins: do you
think they will fix all their dialogs? If you look at the current Eclipse SDK UI
with a large dialog font set you'll see how bad it looks if plug-in developers
don't act on the feature: wizards, dialog and preference pages show up with
mixed fonts.

Moving back to JFace/SWT for more support for setting the dialog font 
automatically.

Just out of curiosity: why does a widget not inherit its parent font? What are
the technical and design issues behind the current implementation?

Comment 8 Tod Creasey CLA 2002-11-29 08:15:50 EST
The setting using the parent font is because we try and propogate the font as 
much as we can for you - JFace will give you the font as the font of the 
parent to prevent you having to do the extra work.

If there is JFace support missing on any JFace component we will add it but we 
cannot do the same for SWT components - SWT only gets what the OS will give 
them and that is only one font. This font was added in 1.0 to satisy user 
requirements to have more than one font to choose from for thier dialogs.

We have only exposed it now in the UI as there were higher priority items in 
previous releases.

Please append any missing JFace functionality to PR 19346 and we will provide 
what we can.
Comment 9 Sebastian Davids CLA 2002-11-29 10:01:13 EST
please take a look at bug 27386
Comment 10 Tod Creasey CLA 2002-11-29 14:48:28 EST
Font propogation has now been added to all field editors ars required. Moving 
back to search.
Comment 11 Sebastian Davids CLA 2002-11-29 17:21:13 EST
Created attachment 2588 [details]
fixes dialogs and pref page

pref page now updated also
Comment 12 Dani Megert CLA 2002-12-02 08:45:48 EST
Tod, if you open the Search preference page you'll see that the combobox font of
the ComboFieldEditor is still not updated. Also, the dialog opened by the
ColorFieldEditor doesn't use the dialog fonts (click on the colored button).

NOTE: The bug is currently in search-inbox. Feel free to move it to yours or
create a new PR for above issues.

As you can see it's quite a bit of work and testing involved to correctly set
the dialog font in all our dialogs and wizards. If we could follow Dirk's
suggestion (bug 26990) this would also be appreciated by other plug-in
contributors like WSAD.

For the Search dialog: waiting until a decision is taken in bug 26990.
Comment 13 Tod Creasey CLA 2002-12-02 08:53:26 EST
Danny I am going to answer this in the main PR so that everyone gets the 
message...
Comment 14 Tod Creasey CLA 2002-12-02 09:38:12 EST
public static applyDialogFont(Control control) has been added to Dialog. This 
can be called to apply the dialog font to the tree of a control whose font is 
the default font.

I could not hook this up by default because it causes some layout problems on 
many of the pages and dialogs we have if it is called after widget creation as 
sizing is frequently done in the creation code. We do not wish to generate any 
layout problems by the addition of this API.

I have also changed initializeBounds to use the dialog font for the 
calculations and not the font of the passed control. In the dialog provided by 
the workbench this will not do anything but for those dialogs provided by 
other components this will allow them to do the sizing before applying the 
dialog font.
Comment 15 Tod Creasey CLA 2002-12-02 10:01:11 EST
The ComboFieldEditor is supplied by the search component - I can't do anything 
about it.

Here is the method you need to change in 
org.eclipse.search.internal.ui.util.ComboFieldEditor


public Combo getComboBoxControl(Composite parent) {
		if (fCombo == null) {
			fCombo= new Combo(parent, SWT.READ_ONLY);
			for (int i= 0; i < fEntryNamesAndValues.length; i++) {
				fCombo.add(fEntryNamesAndValues[i][0], i);
			}
			fCombo.setFont(parent.getFont());<*******************>
			
			fCombo.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent evt) 
{
					String oldValue= fValue;
					String name= fCombo.getText();
					fValue= getValueForName(name);
					setPresentsDefaultValue(false);
					fireValueChanged(VALUE, oldValue, 
fValue);					
				}
			});
		}
		return fCombo;
	}
Comment 16 Dani Megert CLA 2002-12-02 10:21:22 EST
Sure. Just forgot that bug 24928 isn't fixed yet ;-)
Fixed ComboFieldEditor.

The comment for ColorFieldDialog is valid - isn't it?
Comment 17 Tod Creasey CLA 2002-12-02 10:28:59 EST
The ColorDialog is supplied by the platform. That is a setting that needs to 
be set in the OS.
Comment 18 Dani Megert CLA 2002-12-18 09:01:09 EST
Removing M5 again. Will be decided soon if (and how) we do it.
Comment 19 Dani Megert CLA 2003-03-25 11:33:44 EST
This has been fixed for RC3 by Dirk