Skip to content

Commit

Permalink
Always run asnyc if the workspace tree is locked
Browse files Browse the repository at this point in the history
Setting a classpath container to a project while the workspace tree is
locked has the effect that the container is updated but the project is
not build at all.

This overrides the hint to run async in such case to make sure the
project is build appropriately.
  • Loading branch information
laeubi committed May 7, 2024
1 parent 8046286 commit 5e1125c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Adapters;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.MultiStatus;
Expand Down Expand Up @@ -384,7 +385,7 @@ private void updateAffectedEntries(StateDelta delta, boolean runAsynch) {
index++;
}
// TODO Consider always running in a job - better reporting and cancellation options
if (runAsynch) {
if (runAsynch || ResourcesPlugin.getWorkspace().isTreeLocked()) {
// We may be in the UI thread, so the classpath is updated in a job to avoid blocking (bug 376135)
fUpdateJob.add(projects, containers);
fUpdateJob.schedule();
Expand All @@ -393,6 +394,7 @@ private void updateAffectedEntries(StateDelta delta, boolean runAsynch) {
try {
JavaCore.setClasspathContainer(PDECore.REQUIRED_PLUGINS_CONTAINER_PATH, projects, containers, null);
} catch (JavaModelException e) {
ILog.get().error("Setting classpath containers failed!", e); //$NON-NLS-1$
}
}
}
Expand Down

0 comments on commit 5e1125c

Please sign in to comment.