SWT color disposal.

2 messages Options
Embed this post
Permalink
gm-mrktc

SWT color disposal.

Reply Threaded More More options
Print post
Permalink
Recently we found a Photon test that was failing on the Mac platform, but nowhere else.  We traced it to a prematurely disposed Color resource.  According to this article, http://www.eclipse.org/articles/Article-SWT-Color-Model/swt-color-model.htm , colors returned from Display.getSystemColor() should not be disposed explicitly.  So for now, we have removed the explicit dispose calls.  However we need to make sure that we do dispose colors that we allocate in other ways.  Does anyone know of a good way to distinguish between the two?

graham



--
Marketcetera Trading Platform
download.run.trade.
www.marketcetera.org
_______________________________________________
m-etc-dev mailing list
[hidden email]
http://lists.marketcetera.org/cgi-bin/mailman/listinfo/m-etc-dev
Andrei Lissovski

Re: SWT color disposal.

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)
Graham,

I don't know of a way to distinguish between the system colors furnished by Display.getSystemColor() from the colors created by the application code.

One way that color management could be made more robust in an RCP application is by resorting to using themes. The Eclipse framework defines the org.eclipse.ui.themes extension point (http://help.eclipse.org/help32/topic/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_themes.html) that allows to declaratively define colors and fonts that can then be reused across the application. This rids the client code from color management concerns for the common application colors as the framework then takes care of the disposal. A particular declared color can be obtained with the following chain of calls:
    workbench.getThemeManager().getTheme({application theme id}).getColorRegistry().get({color id})

Hope this helps.

-Andrei

--
Eclipse platform specialists.
softwaregoodness.com




----- Original Message ----
From: Graham Miller <[hidden email]>
To: Marketcetera dev <[hidden email]>
Sent: Thursday, June 28, 2007 7:18:51 AM
Subject: [m-etc-dev] SWT color disposal.

Recently we found a Photon test that was failing on the Mac platform, but nowhere else.  We traced it to a prematurely disposed Color resource.  According to this article, http://www.eclipse.org/articles/Article-SWT-Color-Model/swt-color-model.htm , colors returned from Display.getSystemColor() should not be disposed explicitly.  So for now, we have removed the explicit dispose calls.  However we need to make sure that we do dispose colors that we allocate in other ways.  Does anyone know of a good way to distinguish between the two?

graham



--
Marketcetera Trading Platform
download.run.trade.
www.marketcetera.org
_______________________________________________
m-etc-dev mailing list
[hidden email]
http://lists.marketcetera.org/cgi-bin/mailman/listinfo/m-etc-dev


_______________________________________________
m-etc-dev mailing list
[hidden email]
http://lists.marketcetera.org/cgi-bin/mailman/listinfo/m-etc-dev