|
22 | 22 | import org.eclipse.swt.widgets.Shell; |
23 | 23 |
|
24 | 24 | import org.eclipse.core.runtime.Assert; |
| 25 | +import org.eclipse.core.runtime.ICoreRunnable; |
| 26 | +import org.eclipse.core.runtime.jobs.Job; |
25 | 27 |
|
26 | 28 | import org.eclipse.core.resources.IMarker; |
27 | 29 | import org.eclipse.core.resources.IMarkerDelta; |
@@ -281,7 +283,9 @@ public void resourceChanged(IResourceChangeEvent e) { |
281 | 283 | */ |
282 | 284 | private IPropertyChangeListener fPropertyChangeListener; |
283 | 285 |
|
284 | | - private boolean fIninitalProcessDone= false; |
| 286 | + private boolean fIninitalProcessDone; |
| 287 | + |
| 288 | + private boolean fDeferForceReconcile; |
285 | 289 |
|
286 | 290 | /** |
287 | 291 | * The element that this reconciler reconciles. |
@@ -382,7 +386,7 @@ public void uninstall() { |
382 | 386 | */ |
383 | 387 | @Override |
384 | 388 | protected void forceReconciling() { |
385 | | - if (!fIninitalProcessDone) |
| 389 | + if (!isInitialProcessDone()) |
386 | 390 | return; |
387 | 391 |
|
388 | 392 | super.forceReconciling(); |
@@ -420,9 +424,44 @@ protected void initialProcess() { |
420 | 424 | synchronized (fMutex) { |
421 | 425 | super.initialProcess(); |
422 | 426 | } |
| 427 | + if (initialProcessDone()) { |
| 428 | + Job.createSystem("Reconciler init", (ICoreRunnable) monitor -> forceReconciling()).schedule(); //$NON-NLS-1$ |
| 429 | + } |
| 430 | + } |
| 431 | + |
| 432 | + /** |
| 433 | + * This is called by {@link #initialProcess()} to indicate that it is has finished and returns |
| 434 | + * true if a call to {@link #forceReconciling()} is necessary because it was previously ignored. |
| 435 | + * |
| 436 | + * @return whether there has been a call to {@link #forceReconciling()} that was ignored because |
| 437 | + * {@link #fIninitalProcessDone} was false. |
| 438 | + */ |
| 439 | + private synchronized boolean initialProcessDone() { |
423 | 440 | fIninitalProcessDone= true; |
| 441 | + if (fDeferForceReconcile) { |
| 442 | + fDeferForceReconcile= false; |
| 443 | + return true; |
| 444 | + } |
| 445 | + return false; |
424 | 446 | } |
425 | 447 |
|
| 448 | + /** |
| 449 | + * This is called by {@link #forceReconciling()} to determine whether |
| 450 | + * {@link #initialProcessDone()} has completed. It sets {@link #fDeferForceReconcile} to true if |
| 451 | + * {@link #fIninitalProcessDone} is false so that {@link #initialProcessDone()} will return |
| 452 | + * true and will subsequently call {@link #forceReconciling()} again. |
| 453 | + * |
| 454 | + * @return whether {@link #initialProcessDone()} has completed. |
| 455 | + */ |
| 456 | + private synchronized boolean isInitialProcessDone() { |
| 457 | + if (!fIninitalProcessDone) { |
| 458 | + fDeferForceReconcile= true; |
| 459 | + return false; |
| 460 | + } |
| 461 | + return true; |
| 462 | + } |
| 463 | + |
| 464 | + |
426 | 465 | /** |
427 | 466 | * Tells whether the Java Model has changed or not. |
428 | 467 | * |
|
0 commit comments