2626 */
2727public abstract class DecoratorTestPart extends ViewPart {
2828
29- private static final int INITIAL_DELAY_TIME = 500 ;// Initial wait time in milliseconds
30- private static final int MAX_WAIT_TIME = 10000 ;// Maximum wait time (10 seconds)
31- private static final int IDLE_TIME = 200 ;// Time to wait after last update
32-
3329 public boolean waitingForDecoration = true ;
3430
35- private volatile long lastUpdateTime ;
36- private long startTime ;
37-
3831 private ILabelProviderListener listener ;
3932
4033 public DecoratorTestPart () {
@@ -57,55 +50,40 @@ protected DecoratingLabelProvider getLabelProvider() {
5750 * Get the listener for the suite.
5851 */
5952 private ILabelProviderListener getDecoratorManagerListener () {
60- // Record the time each time we get an update
61- listener = event -> lastUpdateTime = System .currentTimeMillis ();
53+ // Listener for decorator manager events
54+ listener = event -> {
55+ // Decorator update occurred
56+ };
6257
6358 return listener ;
6459 }
6560
6661 /**
67- * Process events until decorations are applied. This waits for updates to settle
68- * by ensuring no new updates occur for IDLE_TIME milliseconds, with a maximum
69- * wait of MAX_WAIT_TIME.
62+ * Process events until decorations are applied. Uses a fixed delay
63+ * to allow time for decorator updates to be processed.
7064 */
7165 public void readAndDispatchForUpdates () {
7266 Display display = Display .getCurrent ();
73- long elapsed = System .currentTimeMillis () - startTime ;
74-
75- // Process events and wait for updates to settle
76- while (elapsed < MAX_WAIT_TIME ) {
77- // Process any pending UI events
67+ // Process events for 1 second with regular intervals
68+ for (int i = 0 ; i < 20 ; i ++) {
7869 while (display .readAndDispatch ()) {
79- // Keep processing
80- }
81-
82- long timeSinceLastUpdate = System .currentTimeMillis () - lastUpdateTime ;
83-
84- // If we haven't received an update in IDLE_TIME, we're done
85- if (timeSinceLastUpdate >= IDLE_TIME && elapsed >= INITIAL_DELAY_TIME ) {
86- break ;
70+ // Process all pending events
8771 }
88-
89- // Small sleep to avoid busy waiting
9072 try {
9173 Thread .sleep (50 );
9274 } catch (InterruptedException e ) {
9375 Thread .currentThread ().interrupt ();
94- break ;
76+ return ;
9577 }
96-
97- elapsed = System .currentTimeMillis () - startTime ;
9878 }
99-
100- // Final event processing pass
79+ // Final pass to process any remaining events
10180 while (display .readAndDispatch ()) {
10281 // Keep processing
10382 }
10483 }
10584
10685 public void setUpForDecorators () {
107- startTime = System .currentTimeMillis ();
108- lastUpdateTime = System .currentTimeMillis ();
86+ // No initialization needed for simple fixed delay approach
10987 }
11088
11189 @ Override
0 commit comments