diff options
author | Xavier Ducrohet <xav@google.com> | 2014-01-15 00:22:22 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-01-15 00:22:23 +0000 |
commit | 3d2a602d276f8167f8b7ff9b3ee10ddb0b65cd41 (patch) | |
tree | 349d389e995c9f0a5398cb59308a49fb9cd892a4 /eclipse/plugins | |
parent | 4d45727bf60a12eeb64cbf377bf903248852df8d (diff) | |
parent | 3e5cb17a93b22c5466e10d953233ee371032932f (diff) | |
download | sdk-3d2a602d276f8167f8b7ff9b3ee10ddb0b65cd41.zip sdk-3d2a602d276f8167f8b7ff9b3ee10ddb0b65cd41.tar.gz sdk-3d2a602d276f8167f8b7ff9b3ee10ddb0b65cd41.tar.bz2 |
Merge "Always change markers in a job when initializing classpath." into idea133
Diffstat (limited to 'eclipse/plugins')
-rw-r--r-- | eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java | 97 |
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(); } } } |