Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 39089 Details for
Bug 135344
ColorConstants colors are initialized using Display.getCurrent().getSystemColor()
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
updated patch
colorpatch.txt (text/plain), 6.58 KB, created by
Steven R. Shaw
on 2006-04-20 15:03:12 EDT
(
hide
)
Description:
updated patch
Filename:
MIME Type:
Creator:
Steven R. Shaw
Created:
2006-04-20 15:03:12 EDT
Size:
6.58 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.draw2d >Index: src/org/eclipse/draw2d/ColorConstants.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.draw2d/src/org/eclipse/draw2d/ColorConstants.java,v >retrieving revision 1.12 >diff -u -r1.12 ColorConstants.java >--- src/org/eclipse/draw2d/ColorConstants.java 10 Apr 2006 20:43:30 -0000 1.12 >+++ src/org/eclipse/draw2d/ColorConstants.java 20 Apr 2006 18:51:00 -0000 >@@ -19,100 +19,120 @@ > */ > public interface ColorConstants { > >+class SystemColorFactory { >+ private static Color getColor(final int which) { >+ Display display = Display.getCurrent(); >+ if (display != null) >+ return display.getSystemColor(which); >+ display = Display.getDefault(); >+ final Color result[] = new Color[1]; >+ display.syncExec(new Runnable() { >+ public void run() { >+ synchronized (result) { >+ result[0] = Display.getCurrent().getSystemColor(which); >+ } >+ } >+ }); >+ synchronized (result) { >+ return result[0]; >+ } >+ } >+} >+ > /** > * @see SWT#COLOR_WIDGET_HIGHLIGHT_SHADOW > */ > Color buttonLightest >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_HIGHLIGHT_SHADOW); > /** > * @see SWT#COLOR_WIDGET_BACKGROUND > */ > Color button >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_BACKGROUND); > /** > * @see SWT#COLOR_WIDGET_NORMAL_SHADOW > */ > Color buttonDarker >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_NORMAL_SHADOW); > /** > * @see SWT#COLOR_WIDGET_DARK_SHADOW > */ > Color buttonDarkest >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_DARK_SHADOW); > > /** > * @see SWT#COLOR_LIST_BACKGROUND > */ > Color listBackground >- = Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_LIST_BACKGROUND); > /** > * @see SWT#COLOR_LIST_FOREGROUND > */ > Color listForeground >- = Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_LIST_FOREGROUND); > > /** > * @see SWT#COLOR_WIDGET_BACKGROUND > */ > Color menuBackground >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_BACKGROUND); > /** > * @see SWT#COLOR_WIDGET_FOREGROUND > */ > Color menuForeground >- = Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_WIDGET_FOREGROUND); > /** > * @see SWT#COLOR_LIST_SELECTION > */ > Color menuBackgroundSelected >- = Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION); >+ = SystemColorFactory.getColor(SWT.COLOR_LIST_SELECTION); > /** > * @see SWT#COLOR_LIST_SELECTION_TEXT > */ > Color menuForegroundSelected >- = Display.getDefault().getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT); >+ = SystemColorFactory.getColor(SWT.COLOR_LIST_SELECTION_TEXT); > > /** > * @see SWT#COLOR_TITLE_BACKGROUND > */ > Color titleBackground >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_BACKGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_BACKGROUND); > /** > * @see SWT#COLOR_TITLE_BACKGROUND_GRADIENT > */ > Color titleGradient >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_BACKGROUND_GRADIENT); > /** > * @see SWT#COLOR_TITLE_FOREGROUND > */ > Color titleForeground >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_FOREGROUND); > /** > * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND > */ > Color titleInactiveForeground >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); > /** > * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND > */ > Color titleInactiveBackground >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); > /** > * @see SWT#COLOR_TITLE_INACTIVE_FOREGROUND > */ > Color titleInactiveGradient >- = Display.getDefault().getSystemColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_TITLE_INACTIVE_FOREGROUND); > > /** > * @see SWT#COLOR_INFO_FOREGROUND > */ > Color tooltipForeground >- = Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_INFO_FOREGROUND); > /** > * @see SWT#COLOR_INFO_BACKGROUND > */ > Color tooltipBackground >- = Display.getDefault().getSystemColor(SWT.COLOR_INFO_BACKGROUND); >+ = SystemColorFactory.getColor(SWT.COLOR_INFO_BACKGROUND); > > /* > * Misc. colors >#P org.eclipse.draw2d.test >Index: src/org/eclipse/draw2d/test/ColorConstantTest.java >=================================================================== >RCS file: src/org/eclipse/draw2d/test/ColorConstantTest.java >diff -N src/org/eclipse/draw2d/test/ColorConstantTest.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/draw2d/test/ColorConstantTest.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,53 @@ >+package org.eclipse.draw2d.test; >+ >+import junit.framework.TestCase; >+ >+import org.eclipse.swt.widgets.Display; >+ >+public class ColorConstantTest extends TestCase { >+ /** >+ * @see TestCase#setUp() >+ */ >+ protected void setUp() throws Exception { >+ super.setUp(); >+ } >+ >+ /** >+ * @see TestCase#tearDown() >+ */ >+ protected void tearDown() throws Exception { >+ super.tearDown(); >+ } >+ >+ public void test_ColorConstantInit() { >+ final Boolean result[] = new Boolean[2]; >+ result[0] = Boolean.FALSE; >+ result[1] = Boolean.FALSE; >+ >+ Thread testThread = new Thread() { >+ public void run() { >+ try { >+ Class.forName("org.eclipse.draw2d.ColorConstants"); >+ result[0] = Boolean.TRUE; >+ } catch (Error e) { >+ result[0] = Boolean.FALSE; >+ } catch (Exception ex) { >+ result[0] = Boolean.FALSE; >+ } >+ >+ result[1] = Boolean.TRUE; >+ } >+ }; >+ >+ testThread.start(); >+ >+ while (!result[1].booleanValue()) { >+ Display.getCurrent().readAndDispatch(); >+ } >+ >+ testThread.stop(); >+ >+ assertTrue(result[0].booleanValue()); >+ >+ } >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 135344
:
39070
| 39089