Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » How to best define static color constants
How to best define static color constants [message #662084] Tue, 29 March 2011 08:26
Jan Mauersberger is currently offline Jan MauersbergerFriend
Messages: 120
Registered: July 2009
Senior Member
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
example.

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?

Thanks Jan
Previous Topic:On "Save All" operation, message on status bar is not being displayed
Next Topic:Browser, XULRunner, and client SSL certificates
Goto Forum:
  


Current Time: Sat Feb 27 19:44:11 GMT 2021

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

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

Back to the top