Skip to content

Commit ac0a503

Browse files
merksiloveeclipse
authored andcommitted
Ensure forceReconciling is called after initialProcess if it was ignored
#2074
1 parent e6b6ecb commit ac0a503

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/JavaReconciler.java

+41-2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
import org.eclipse.swt.widgets.Shell;
2323

2424
import org.eclipse.core.runtime.Assert;
25+
import org.eclipse.core.runtime.ICoreRunnable;
26+
import org.eclipse.core.runtime.jobs.Job;
2527

2628
import org.eclipse.core.resources.IMarker;
2729
import org.eclipse.core.resources.IMarkerDelta;
@@ -281,7 +283,9 @@ public void resourceChanged(IResourceChangeEvent e) {
281283
*/
282284
private IPropertyChangeListener fPropertyChangeListener;
283285

284-
private boolean fIninitalProcessDone= false;
286+
private boolean fIninitalProcessDone;
287+
288+
private boolean fDeferForceReconcile;
285289

286290
/**
287291
* The element that this reconciler reconciles.
@@ -382,7 +386,7 @@ public void uninstall() {
382386
*/
383387
@Override
384388
protected void forceReconciling() {
385-
if (!fIninitalProcessDone)
389+
if (!isInitialProcessDone())
386390
return;
387391

388392
super.forceReconciling();
@@ -420,9 +424,44 @@ protected void initialProcess() {
420424
synchronized (fMutex) {
421425
super.initialProcess();
422426
}
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() {
423440
fIninitalProcessDone= true;
441+
if (fDeferForceReconcile) {
442+
fDeferForceReconcile= false;
443+
return true;
444+
}
445+
return false;
424446
}
425447

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+
426465
/**
427466
* Tells whether the Java Model has changed or not.
428467
*

0 commit comments

Comments
 (0)