Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Themes extension point(Problem in getting updating color setting)
Themes extension point [message #726319] Sat, 17 September 2011 10:00 Go to next message
M.Faisal Hameed is currently offline M.Faisal Hameed
Messages: 5
Registered: December 2010
Junior Member
Hi everey one i am using eclipse Version: 3.6.2 Build id: M20110210-1200

I am using "org.eclipse.ui.themes" extension point to customize colors in my views with the follwing theme category structure.

Watchlist
>>Table Layout
>>>>TABLE_FOREGROUND = "0,224,0"
>>Box Layout
>>>>BOX_FOREGROUND = "0,0,0"

<extension point="org.eclipse.ui.themes">
<themeElementCategory
id="watchlist"
label="Watchlist"/>
<themeElementCategory
class="TableViewerThemePreview"
id="tableLayout"
label="Table Layout"
parentId="watchlist"/>
<colorDefinition
categoryId="tableLayout"
id="TABLE_FOREGROUND"
label="Table Foregrount"
value="0,224,0"/>

<themeElementCategory
class="BoxViewerThemePreview"
id="box"
label="Box Layout"
parentId="watchlist"/>
<colorDefinition
categoryId="box"
id="BOX_FOREGROUND"
label="Box Foregrount"
value="0,0,0"/>
</extension>


I also added an extension point "org.eclipse.ui.preferencePages" to change colors
<extension
point="org.eclipse.ui.preferencePages">
<page
class="org.eclipse.ui.ExtensionFactory:appearancePreferencePage"
id="org.eclipse.ui.preferencePages.Appearance"
name="Appearance"/>
<page
category="org.eclipse.ui.preferencePages.Appearance"
class="org.eclipse.ui.ExtensionFactory:colorsAndFontsPreferencePage"
id="org.eclipse.ui.preferencePages.ColorsAndFonts"
name="Color Setting"/>
</extension>

I am getting this color setting in my view by

Color tableForegrount = null;
IPropertyChangeListener themeChangeListener = new IPropertyChangeListener() {
public void propertyChange(PropertyChangeEvent event) {
	IThemeManager themeManager = PlatformUI.getWorkbench().getThemeManager();
	ITheme theme = themeManager.getCurrentTheme();
	if (event.getProperty().equals("TABLE_FOREGROUND"))
		tableForegrount = theme.getColorRegistry().get(event.getProperty());
	}
};


when i change my colors setting with preference page, it immediately reflect on my view and also saved in property file named
\.metadata\.plugins\org.eclipse.core.runtime\.settings\org.eclipse.ui.workbench.prefs
ColorsAndFontsPreferencePage.expandedCategories=Twatchlist\tTtableLayout
ColorsAndFontsPreferencePage.selectedElement=TABLE_FOREGROUND
eclipse.preferences.version=1
TABLE_FOREGROUND=0,64,64

My problems is

1.When i run my application again i get the default value of TABLE_FOREGROUND=0,224,0 every time.
How i can get the updated colors setting????


How i can get rid from it?
I also tried suggesions of this post but no use.
//bugs.eclipse.org/bugs/show_bug.cgi?id=101474
Re: Themes extension point [message #726789 is a reply to message #726319] Mon, 19 September 2011 15:00 Go to previous message
Jeeeyul Lee is currently offline Jeeeyul Lee
Messages: 111
Registered: July 2009
Location: Seoul
Senior Member

I can't sure theme extension allows custom preference page.
I mean, ColorRegistry from ITheme may intended to read-only use.

As far as I know, a theme extension automatically shown in [Appearance / Color and Fonts]. So you don't have to provide custom preference page node. You can contribute custom preview by implementing IThemePreview in category element.

If you want to create just new custom preference page node than just eclipse standard one, I suggest, do not use theme extension. Just use normal preference page and preference initializer.

And how theme extension point serializes their client data is not an API. So you should not inspect, don't assert result from that.

[Updated on: Mon, 19 September 2011 15:02]

Report message to a moderator

Previous Topic:RCP export into product
Next Topic:ActiveMenuSelection and keybindings question/problem
Goto Forum:
  


Current Time: Thu Oct 30 18:27:21 GMT 2014

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

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