Bug 4729 - PreferenceConverter#setValue does not check for "underline" or "strikeout" (1GFJ5UF)
Summary: PreferenceConverter#setValue does not check for "underline" or "strikeout" (1...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 2.0   Edit
Hardware: All Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ian Petersen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2001-10-11 14:22 EDT by Mike Wilson CLA
Modified: 2002-01-29 15:51 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mike Wilson CLA 2001-10-11 14:22:00 EDT
When two font data objects are being compared, the FontData.getStyle() method compares only on BOLD and ITALIC. 
Therefore, if two font data objects are the same except one has underline (or strikeout) turned on and the other has it turned off, then 
the #getStyle won't be able to make the difference. In this case, the method #equals should then be used.

I found a bug while I was playing with the font chooser in the debug>console preference page: 
1- click on "change..." and modify the font by setting "underline" on
2- click "ok" in the font chooser and save the preference by clicking on "OK"
3- then come again to the preference page, click again on "change..." and  set "underline" off
4- click "ok" in the font chooser and save the preference by clicking on "OK"
5- if you come again to the preference page and check the state of the font in the file chooser, you will notice that "underline" is still on...

Actually, the PreferenceConverter.setValue(IPreferenceStore store, String name, FontData value) checks if the new and the old fonts are different,
and if they are different, then it sets the new values.
However, PreferenceConverter is using #getStyle to compare the 2 FontData, whereas it should use #equals to see that there is actually a difference.



NOTES:

KH (9/17/2001 12:45:35 PM)
	Moving to SWT for comment.
Comment 1 DJ Houghton CLA 2001-10-29 16:34:18 EST
PRODUCT VERSION:
Eclipse 0.125


Comment 2 Mike Wilson CLA 2001-12-10 13:14:00 EST
getStyle is performing as expected.
Comment 3 Ian Petersen CLA 2002-01-21 15:02:39 EST
It looks to me like this bug has disappeared.  I'm running build 20020115 and I 
can't reproduce it.  Any comments?
Comment 4 Randy Giffen CLA 2002-01-29 15:51:40 EST
Changed code to use FontData.equals