3636 */
3737public class RCPTestWorkbenchAdvisor extends WorkbenchAdvisor {
3838
39- public static Boolean asyncDuringStartup = null ;
39+ public Boolean asyncDuringStartup = null ;
4040
4141 // the following fields are set by the threads that attempt sync/asyncs
4242 // during startup.
43- public static volatile Boolean syncWithDisplayAccess = null ;
44- public static volatile Boolean asyncWithDisplayAccess = null ;
45- public static volatile Boolean syncWithoutDisplayAccess = null ;
46- public static volatile Boolean asyncWithoutDisplayAccess = null ;
43+ public volatile Boolean syncWithDisplayAccess = null ;
44+ public volatile Boolean asyncWithDisplayAccess = null ;
45+ public volatile Boolean syncWithoutDisplayAccess = null ;
46+ public volatile Boolean asyncWithoutDisplayAccess = null ;
4747
48- private static boolean started = false ;
48+ private boolean started = false ;
4949
5050 // CountDownLatch to wait for async/sync operations with DisplayAccess to complete
5151 // We need to wait for 2 operations: asyncWithDisplayAccess and syncWithDisplayAccess
52- private static CountDownLatch displayAccessLatch = null ;
52+ private CountDownLatch displayAccessLatch = null ;
5353
54- public static boolean isSTARTED () {
55- synchronized (RCPTestWorkbenchAdvisor .class ) {
56- return started ;
57- }
54+ public synchronized boolean isStarted () {
55+ return started ;
5856 }
5957
6058 /** Default value of -1 causes the option to be ignored. */
@@ -66,7 +64,7 @@ public static boolean isSTARTED() {
6664 * Traps whether or not calls to displayAccess in the UI thread resulted in
6765 * an exception. Should be false.
6866 */
69- public static boolean displayAccessInUIThreadAllowed ;
67+ public boolean displayAccessInUIThreadAllowed ;
7068
7169 public RCPTestWorkbenchAdvisor () {
7270 // default value means the advisor will not trigger the workbench to
@@ -127,15 +125,6 @@ public void eventLoopIdle(final Display display) {
127125
128126 @ Override
129127 public void preStartup () {
130- synchronized (RCPTestWorkbenchAdvisor .class ) {
131- started = false ;
132- }
133- asyncDuringStartup = null ;
134- syncWithDisplayAccess = null ;
135- asyncWithDisplayAccess = null ;
136- syncWithoutDisplayAccess = null ;
137- asyncWithoutDisplayAccess = null ;
138-
139128 super .preStartup ();
140129 final Display display = Display .getCurrent ();
141130
@@ -144,14 +133,14 @@ public void preStartup() {
144133
145134 if (display != null ) {
146135 display .asyncExec (() -> {
147- asyncDuringStartup = !isSTARTED ();
136+ asyncDuringStartup = !isStarted ();
148137 });
149138 }
150139
151140 // start a bunch of threads that are going to do a/sync execs. For some
152141 // of them, call DisplayAccess.accessDisplayDuringStartup. For others,
153142 // dont. Those that call this method should have their runnables invoked
154- // prior to the method isSTARTED returning true.
143+ // prior to the method isStarted returning true.
155144
156145 setupAsyncDisplayThread (true , display );
157146 setupSyncDisplayThread (true , display );
@@ -176,13 +165,13 @@ public void run() {
176165 try {
177166 display .syncExec (() -> {
178167 if (callDisplayAccess ) {
179- syncWithDisplayAccess = !isSTARTED ();
168+ syncWithDisplayAccess = !isStarted ();
180169 // Count down after the runnable executes
181170 if (displayAccessLatch != null ) {
182171 displayAccessLatch .countDown ();
183172 }
184173 } else {
185- syncWithoutDisplayAccess = !isSTARTED ();
174+ syncWithoutDisplayAccess = !isStarted ();
186175 }
187176 });
188177 } catch (SWTException e ) {
@@ -207,13 +196,13 @@ public void run() {
207196 DisplayAccess .accessDisplayDuringStartup ();
208197 display .asyncExec (() -> {
209198 if (callDisplayAccess ) {
210- asyncWithDisplayAccess = !isSTARTED ();
199+ asyncWithDisplayAccess = !isStarted ();
211200 // Count down after the runnable executes
212201 if (displayAccessLatch != null ) {
213202 displayAccessLatch .countDown ();
214203 }
215204 } else {
216- asyncWithoutDisplayAccess = !isSTARTED ();
205+ asyncWithoutDisplayAccess = !isStarted ();
217206 }
218207 });
219208 }
@@ -243,8 +232,8 @@ public void postStartup() {
243232
244233 // Now mark as started - operations with DisplayAccess should have completed
245234 // Operations without DisplayAccess should still be pending (deferred)
246- synchronized (RCPTestWorkbenchAdvisor . class ) {
235+ synchronized (this ) {
247236 started = true ;
248237 }
249238 }
250- }
239+ }
0 commit comments