aboutsummaryrefslogtreecommitdiffstats
path: root/eclipse
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@google.com>2014-01-14 14:16:42 -0800
committerXavier Ducrohet <xav@google.com>2014-01-14 16:20:34 -0800
commit3e5cb17a93b22c5466e10d953233ee371032932f (patch)
tree349d389e995c9f0a5398cb59308a49fb9cd892a4 /eclipse
parent4d45727bf60a12eeb64cbf377bf903248852df8d (diff)
downloadsdk-3e5cb17a93b22c5466e10d953233ee371032932f.zip
sdk-3e5cb17a93b22c5466e10d953233ee371032932f.tar.gz
sdk-3e5cb17a93b22c5466e10d953233ee371032932f.tar.bz2
Always change markers in a job when initializing classpath.
This should prevent a possible deadlock. Change-Id: I7f36dae8a906ce9e6fdfa2d223e44a191e3564ed
Diffstat (limited to 'eclipse')
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java97
1 files changed, 41 insertions, 56 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
index 362fe28..a58f27d 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
@@ -51,68 +51,53 @@ abstract class BaseClasspathContainerInitializer extends ClasspathContainerIniti
AdtPlugin.printErrorToConsole(project, errorMessage);
}
- try {
- BaseProjectHelper.markProject(project, markerType,
- errorMessage, IMarker.SEVERITY_ERROR, IMarker.PRIORITY_HIGH);
- } catch (CoreException e) {
- // In some cases, the workspace may be locked for modification when we
- // pass here.
- // We schedule a new job to put the marker after.
- final String fmessage = errorMessage;
- Job markerJob = new Job("Android SDK: Resolving error markers") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- BaseProjectHelper.markProject(project,
- markerType,
- fmessage, IMarker.SEVERITY_ERROR,
- IMarker.PRIORITY_HIGH);
- } catch (CoreException e2) {
- AdtPlugin.log(e2, null);
- // Don't return e2.getStatus(); the job control will then produce
- // a popup with this error, which isn't very interesting for the
- // user.
- }
-
- return Status.OK_STATUS;
+ // Use a job to prevent requiring a workspace lock in this thread.
+ final String fmessage = errorMessage;
+ Job markerJob = new Job("Android SDK: Resolving error markers") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ BaseProjectHelper.markProject(project,
+ markerType,
+ fmessage, IMarker.SEVERITY_ERROR,
+ IMarker.PRIORITY_HIGH);
+ } catch (CoreException e2) {
+ AdtPlugin.log(e2, null);
+ // Don't return e2.getStatus(); the job control will then produce
+ // a popup with this error, which isn't very interesting for the
+ // user.
}
- };
- // build jobs are run after other interactive jobs
- markerJob.setPriority(Job.BUILD);
- markerJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
- markerJob.schedule();
- }
- } else {
- // no error, remove existing markers.
- try {
- if (project.isAccessible()) {
- project.deleteMarkers(markerType, true,
- IResource.DEPTH_INFINITE);
+ return Status.OK_STATUS;
}
- } catch (CoreException ce) {
- // In some cases, the workspace may be locked for modification when we pass
- // here, so we schedule a new job to put the marker after.
- Job markerJob = new Job("Android SDK: Resolving error markers") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- try {
- if (project.isAccessible()) {
- project.deleteMarkers(markerType, true,
- IResource.DEPTH_INFINITE);
- }
- } catch (CoreException e2) {
- AdtPlugin.log(e2, null);
- }
+ };
- return Status.OK_STATUS;
+ // build jobs are run after other interactive jobs
+ markerJob.setPriority(Job.BUILD);
+ markerJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ markerJob.schedule();
+ } else {
+ // Use a job to prevent requiring a workspace lock in this thread.
+ Job markerJob = new Job("Android SDK: Resolving error markers") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ if (project.isAccessible()) {
+ project.deleteMarkers(markerType, true,
+ IResource.DEPTH_INFINITE);
+ }
+ } catch (CoreException e2) {
+ AdtPlugin.log(e2, null);
}
- };
- // build jobs are run after other interactive jobs
- markerJob.setPriority(Job.BUILD);
- markerJob.schedule();
- }
+ return Status.OK_STATUS;
+ }
+ };
+
+ // build jobs are run after other interactive jobs
+ markerJob.setPriority(Job.BUILD);
+ markerJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ markerJob.schedule();
}
}
}