Skip to content

Commit

Permalink
waitForJdtIndex also in SyncUtil
Browse files Browse the repository at this point in the history
  • Loading branch information
LorenzoBettini committed Jan 21, 2025
1 parent 48183de commit 2f2fe5d
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.internal.core.JavaModelManager;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IEditorPart;
Expand Down Expand Up @@ -148,12 +149,18 @@ public void process(XtextResource state) throws Exception {

public void waitForBuild(IProgressMonitor monitor) {
try {
waitForJdtIndex(monitor);
workspace.build(IncrementalProjectBuilder.INCREMENTAL_BUILD, monitor);
} catch (CoreException e) {
throw new OperationCanceledException(e.getMessage());
}
}


@SuppressWarnings("restriction")
public void waitForJdtIndex(IProgressMonitor monitor) {
JavaModelManager.getIndexManager().waitForIndex(true, monitor);
}

/**
* @deprecated we should not rely on auto build to be triggered. Use {@link #waitForBuild(IProgressMonitor)}
* instead.
Expand Down

0 comments on commit 2f2fe5d

Please sign in to comment.