|How to best define static color constants [message #662084]
||Tue, 29 March 2011 08:26
| Jan Mauersberger
Registered: July 2009
Typically color constants are defined as static field in interfaces as |
for example in ColorConstants (draw2d). However, the initialization code
must be executed in the UI thread and it is usually not guaranteed that
the class is loaded in the UI thread. I have seen code (in exactly that
ColorConstants interface) that, depending on the calling thread, is
doing a typical display.syncExec() to get access to system colors for
I want to have similar constants but I'm a bit worried that such a code
my result in deadlocks in case the class is loaded by non-UI thread that
is self is blocking the UI thread or something similar.
Any hint to a better solution or any arguments to allay my concerns?
Powered by FUDForum
. Page generated in 0.01875 seconds