Bug 133731 - [Field Assist] -Platform UI should define preferences for content assist colors
Summary: [Field Assist] -Platform UI should define preferences for content assist colors
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.2   Edit
Hardware: All All
: P5 enhancement (vote)
Target Milestone: 3.4 M7   Edit
Assignee: Susan McCourt CLA
QA Contact:
URL:
Whiteboard:
Keywords: api
: 195955 (view as bug list)
Depends on:
Blocks: 223251 223551 225345
  Show dependency tree
 
Reported: 2006-03-28 17:16 EST by Susan McCourt CLA
Modified: 2008-04-08 02:55 EDT (History)
8 users (show)

See Also:


Attachments
patches to restore content assist colors to workbench theme (5.50 KB, application/octet-stream)
2008-03-20 15:18 EDT, Susan McCourt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Susan McCourt CLA 2006-03-28 17:16:11 EST
JDT currently provides preferences for content assist popup colors, auto-activation delay time, etc.
Platform Text implementations typically hard-coded these values (such as auto-activation delay).

The new field assist support generally attempted to mimic the defaults used by platform text.  However it is reasonable in the long run to provide preferences for these values.  Examples include:

- main popup color
- secondary popup color
- autoactivation delay

When this is investigated, check for the state of the art in JDT prefs.
Comment 1 Susan McCourt CLA 2007-07-01 10:39:36 EDT
This message is part of a mass update...the bug is likely legitimate, but not a priority. Marking P5.  Patches would be entertained.
Comment 2 Dani Megert CLA 2007-07-02 06:50:26 EDT
As a first step we could "move" the color definitions from JDT UI to Platform UI or IDE and use the 'Colors and Fonts' preference page.

Adding a new General > 'Content Assist' page might be an overkill at this point.

If you agree I can come up with a patch.
Comment 3 Susan McCourt CLA 2007-07-02 14:16:28 EDT
I think that's a good start.  Thanks, Dani...
Comment 4 Dani Megert CLA 2007-08-02 11:18:39 EDT
Providing the preferences wouldn't help much as JFace can't access those and even worse there's no API which clients could use to set them. Something like ContentAssistCommandAdapter could initialize the color but this clas also in the wrong layer. We would need to put e.g. DefaultContentAssistAdapter or WorkbenchContentAssistAdapter into org.eclipse.ui.

ContentAssistCommandAdapter should be changed to allow subclassing so that the new content assist adapter can inherit from it.

Moving back to inbox as Platform UI should decide how they want to expose the new API(s).
Comment 5 Susan McCourt CLA 2007-08-02 11:59:35 EDT
I'll look at this during M2
Comment 6 Susan McCourt CLA 2007-09-06 12:06:57 EDT
moving to M3, I'm busy with some other items for M2. 
Comment 7 Susan McCourt CLA 2007-09-26 13:22:05 EDT
*** Bug 195955 has been marked as a duplicate of this bug. ***
Comment 8 Susan McCourt CLA 2007-10-29 15:10:48 EDT
did not make it into M3.
Comment 9 Susan McCourt CLA 2008-01-16 14:32:12 EST
This should be straightforward, I'm just not so familiar with the theme/color stuff.  Kevin, can you provide some guidance as to how/where the actual prefs are defined?  I could do whatever restructure in the field assist code was necessary to have a platform UI class that honors those colors.
Comment 10 Susan McCourt CLA 2008-03-19 16:55:01 EDT
Fixed in HEAD.
Dani, sorry this is coming in so late in M6, but I had to squeeze it in for API freeze.  Hopefully you'll have time to adapt to these preferences for M6.

JFacePreferences now defines colors for:
CONTENT_ASSIST_FOREGROUND_COLOR
CONTENT_ASSIST_BACKGROUND_COLOR
CONTENT_ASSIST_INFO_FOREGROUND_COLOR
CONTENT_ASSIST_INFO_BACKGROUND_COLOR

These colors are initialized in the JFace color registry by the current theme and appear alongside the other misc. workbench colors on the Appearance pref page.  They can be accessed from JFace code using:

JFaceResources.getColorRegistry().
  get(JFacePreferences.CONTENT_ASSIST_FOREGROUND_COLOR);

ContentProposalPopup uses CONTENT_ASSIST_FOREGROUND_COLOR and CONTENT_ASSIST_BACKGROUND_COLOR.  PopupDialog, and therefore the secondary content assist info popup, use CONTENT_ASSIST_INFO_FOREGROUNDCOLOR, etc.

Consumers of these classes such as the find/replace regexp fields will honor the prefs for free.  However, platform text content assist will need to be changed to consult these prefs.

Kim/Tod - I assume there is no need for a high contrast override to these colors because they are using system colors (list foreground/background and info foreground/background) for the defaults.

ThemesTestSuite still passing.

I opened bug # 223251 to track the lack of a content assist delay preference.
Comment 11 Dani Megert CLA 2008-03-20 05:42:48 EDT
A PopupDialog is not tied to content assist. Either remove the code that uses that color or rename those preference constants to something more generic (preferred), e.g.:
  JFacePreferences.INFO_FOREGROUND_COLOR
  JFacePreferences.INFO_INFO_BACKGROUND_COLOR

The content assist bg label should be without "text":
==> Content Assist background color

Another question is whether we also want to use the info color for hovers (tool tips). In that case the description should be adapted.

Also, could you remove the preference UI for M6 as several plug-ins are affected and clients won't have time to updated all their code for M6.
Comment 12 Susan McCourt CLA 2008-03-20 15:11:17 EDT
>A PopupDialog is not tied to content assist. Either remove the code that uses
>that color or rename those preference constants to something more generic
>(preferred), e.g.:
>  JFacePreferences.INFO_FOREGROUND_COLOR
>  JFacePreferences.INFO_INFO_BACKGROUND_COLOR

I originally agreed with your preferred suggestion - rename to be more generic, 
as my intention was to apply the color to all info popups.  

But after setting the colors set to something extremely bright, it emphasized for me that it's a bit random to have some things popping up in my bright color, and other things not.  I think it's better to direct these color preferences only at content assist.  The problem I see is that not every info popup is implemented with PopupDialog, and some of the popup dialog implementations (like the key assist dialog, quick type hierarchy, etc.) are heavyweight enough that they don't necessarily feel like info popups.  I think it would be kind of random that some of the popups use the pref color, and some don't, depending on how they are implemented.  And as you mention, then we have to decide about hovers, find the various private implementations of hovers and use the color, etc. etc.  

So...I've kept the preference names as is and changed the code so that PopupDialog continues to use the SWT.INFO_* colors for the default rather than the content assist preference, and only the secondary content proposal popup uses the CONTENT_ASSIST_INFO_* pref colors (which default to the SWT.INFO_*).

>Also, could you remove the preference UI for M6 as several plug-ins are
>affected and clients won't have time to updated all their code for M6.

The UI in the preference page is "free" if you define the colors in the workbench theme.  So what I've done to buy clients time to adapt is add temporary code in JFaceResources to initialize the colors when the color registry is created.  This code will be removed as soon as M7 ships and the colors returned to the theme.  I'll attach the patch to this bug and revisit in M7.

>The content assist bg label should be without "text":
>==> Content Assist background color

This was intentional to keep the colors sorted together, otherwise the content assist info colors and regular colors were separated in the list.  In the patch I'll address this a different way.
Comment 13 Susan McCourt CLA 2008-03-20 15:18:31 EDT
Created attachment 93061 [details]
patches to restore content assist colors to workbench theme

This patch will be applied early M7.
Comment 14 Dani Megert CLA 2008-03-20 16:05:26 EDT
>The UI in the preference page is "free" if you define the colors in the
>workbench theme. 
No need for hacks/workarounds. Simply add isEditable="false" to the contribution in the plugin.xml.
Comment 15 Dani Megert CLA 2008-03-20 16:06:20 EDT
>So...I've kept the preference names as is and changed the code so that
>PopupDialog continues to use the SWT.INFO_* colors 
Fine with me. I will adopt the prefs in M7 and inform the other clients.
Comment 16 Susan McCourt CLA 2008-03-31 17:58:14 EDT
The content assist colors have been added back to the pref page >20080331.
Marking this fixed.
Comment 17 Dani Megert CLA 2008-04-02 10:56:31 EDT
This fix misses to set good colors for the 'Reduced Palette' theme. Filed bug
225303 for that.

Verified that this bug here is fixed.
Comment 18 Dani Megert CLA 2008-04-08 02:55:49 EDT
For those listening to this bug: the new color constants for the additional info colors:
    JFacePreferences.CONTENT_ASSIST_INFO_FOREGROUND_COLOR
    JFacePreferences.CONTENT_ASSIST_INFO_BACKGROUND_COLOR
have been removed during M7 (see bug 225718 for details).