Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » How to specify default fonts in an RCP app
How to specify default fonts in an RCP app [message #507392] Wed, 13 January 2010 10:53 Go to next message
Peter Kullmann is currently offline Peter Kullmann
Messages: 199
Registered: July 2009
Senior Member
Hi, I'm trying to change some of the default fonts in our rcp app: For
example "org.eclipse.jface.dialogfont" (aka JFaceResources.DIALOG_FONT).
How can I ship our application with a different default dialog font?

I have tried this:
In plugin_customization.ini having an entry like this works:
org.eclipse.ui.workbench/org.eclipse.jface.dialogfont=1|Papy rus|13.0|0|COCOA|1|Papyrus;

But the format for the value seems to be undocumented (if not, can you
give me a pointer?). Is it safe to use it? How can I set different fonts
for different platforms?

Is it better (or even possible) to use code (in
WorkbenchAdvisor.preStartup() for example) to set the defaults?

Is there a way to define these fonts through extension points? I have
looked at the org.eclipse.ui.themes extension point but do not
understand how to overwrite a definition from another plugin.

Thanks for any help
Peter
Re: How to specify default fonts in an RCP app [message #507404 is a reply to message #507392] Wed, 13 January 2010 11:41 Go to previous messageGo to next message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
Hi Peter

I have used the following to get font definitions into my RCP app. These were to define fonts for appplication parts and not to override defaults. I used the WorkbenchWindowAdvisor, you might have to use the WorkbenchAdvisor to be earlier in the cycle.

In a 'branding' plugin, I defined a default theme:
<theme
id="uk.co.rcp.ui.branding.theme"
name="RCP Theme">

In my plugin_customization.ini I specified this as the default theme:
# Workbench CURRENT Theme (see extension-point: org.eclipse.ui.themes
org.eclipse.ui/CURRENT_THEME_ID=uk.co.rcp.ui.branding.theme

In my case, I used the constructor of the WorkbenchWindowAdvisor to get the theme and values that I wanted:

ITheme currentTheme = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme( );

Font details can then be obtained using:
currentTheme.getFontRegistry().getFontData(<symbolicName>);

Regards, John
Re: How to specify default fonts in an RCP app [message #507426 is a reply to message #507404] Wed, 13 January 2010 12:59 Go to previous messageGo to next message
Peter Kullmann is currently offline Peter Kullmann
Messages: 199
Registered: July 2009
Senior Member
Thanks John

I re-read the explanation of the <theme> element and saw that its
purpose is exactly to overwrite defaults for fonts and colors. What kept
me from using it in the past was that the value attribute seemd not to
allow platform specific overrides, but I have now seen that a
<fontOverride> element allows many <fontValue> elements where one can
specify platform specific fonts.

Regards,
Peter

John Ormerod schrieb:
> Hi Peter
>
> I have used the following to get font definitions into my RCP app. These
> were to define fonts for appplication parts and not to override
> defaults. I used the WorkbenchWindowAdvisor, you might have to use the
> WorkbenchAdvisor to be earlier in the cycle.
>
> In a 'branding' plugin, I defined a default theme:
> <theme
> id="uk.co.rcp.ui.branding.theme"
> name="RCP Theme">
>
> In my plugin_customization.ini I specified this as the default theme:
> # Workbench CURRENT Theme (see extension-point: org.eclipse.ui.themes
> org.eclipse.ui/CURRENT_THEME_ID=uk.co.rcp.ui.branding.theme
>
> In my case, I used the constructor of the WorkbenchWindowAdvisor to get
> the theme and values that I wanted:
>
> ITheme currentTheme =
> PlatformUI.getWorkbench().getThemeManager().getCurrentTheme( );
>
> Font details can then be obtained using:
> currentTheme.getFontRegistry().getFontData(<symbolicName>);
>
> Regards, John
>
Re: How to specify default fonts in an RCP app [message #507439 is a reply to message #507426] Wed, 13 January 2010 14:12 Go to previous message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
Peter
"I re-read the explanation..."
I often do that - and more than once - sometimes I get it and sometimes I don't ! Smile

John
Previous Topic:Product export problem
Next Topic:Problem with understanding on Action Sets DefinitionID┬┤s and classes.
Goto Forum:
  


Current Time: Thu Sep 18 01:54:02 GMT 2014

Powered by FUDForum. Page generated in 0.05712 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software