Skip to content

Commit 188807e

Browse files
committed
Ensure forceReconciling is called after initialProcess if it was ignored
#2074
1 parent e6b6ecb commit 188807e

1 file changed

Lines changed: 39 additions & 2 deletions

File tree

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

Lines changed: 39 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,9 @@ public void resourceChanged(IResourceChangeEvent e) {
281281
*/
282282
private IPropertyChangeListener fPropertyChangeListener;
283283

284-
private boolean fIninitalProcessDone= false;
284+
private boolean fIninitalProcessDone;
285+
286+
private boolean fDeferForceReconcile;
285287

286288
/**
287289
* The element that this reconciler reconciles.
@@ -382,7 +384,7 @@ public void uninstall() {
382384
*/
383385
@Override
384386
protected void forceReconciling() {
385-
if (!fIninitalProcessDone)
387+
if (!isInitialProcessDone())
386388
return;
387389

388390
super.forceReconciling();
@@ -420,9 +422,44 @@ protected void initialProcess() {
420422
synchronized (fMutex) {
421423
super.initialProcess();
422424
}
425+
if (initialProcessDone()) {
426+
forceReconciling();
427+
}
428+
}
429+
430+
/**
431+
* This is called by {@link #initialProcess()} to indicate that it is has finished and returns
432+
* true if a call to {@link #forceReconciling()} is necessary because it was previously ignored.
433+
*
434+
* @return whether there has been a call to {@link #forceReconciling()} that was ignored because
435+
* {@link #fIninitalProcessDone} was false.
436+
*/
437+
private synchronized boolean initialProcessDone() {
423438
fIninitalProcessDone= true;
439+
if (fDeferForceReconcile) {
440+
fDeferForceReconcile= false;
441+
return true;
442+
}
443+
return false;
424444
}
425445

446+
/**
447+
* This is called by {@link #forceReconciling()} to determine whether
448+
* {@link #initialProcessDone()} has completed. It sets {@link #fDeferForceReconcile} to true if
449+
* {@link #fIninitalProcessDone} is false so that {@link #initialProcessDone()} will return
450+
* true and will subsequently call {@link #forceReconciling()} again.
451+
*
452+
* @return whether {@link #initialProcessDone()} has completed.
453+
*/
454+
private synchronized boolean isInitialProcessDone() {
455+
if (!fIninitalProcessDone) {
456+
fDeferForceReconcile= true;
457+
return false;
458+
}
459+
return true;
460+
}
461+
462+
426463
/**
427464
* Tells whether the Java Model has changed or not.
428465
*

0 commit comments

Comments
 (0)