Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVivian Kong2009-05-12 11:01:03 -0400
committerVivian Kong2009-05-12 11:01:03 -0400
commit18250db2050ec4d8f3c3fb60e66cb55514711ba7 (patch)
treebd668984a423d48ffdec49f91dfd0dd4fa2a89cf
parent9e62905032b90008992bcae79750fc4b7573ef54 (diff)
downloadorg.eclipse.cdt-18250db2050ec4d8f3c3fb60e66cb55514711ba7.tar.gz
org.eclipse.cdt-18250db2050ec4d8f3c3fb60e66cb55514711ba7.tar.xz
org.eclipse.cdt-18250db2050ec4d8f3c3fb60e66cb55514711ba7.zip
bug 268840
-rw-r--r--build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java56
1 files changed, 42 insertions, 14 deletions
diff --git a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
index 0f52988d3c..5d82155895 100644
--- a/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
+++ b/build/org.eclipse.cdt.make.core/src/org/eclipse/cdt/make/internal/core/scannerconfig2/SCMarkerGenerator.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2008 IBM Corporation and others.
+ * Copyright (c) 2004, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,10 +17,16 @@ import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.core.IMarkerGenerator;
import org.eclipse.cdt.core.ProblemMarkerInfo;
import org.eclipse.cdt.core.model.ICModelMarker;
+import org.eclipse.cdt.make.core.MakeCorePlugin;
+import org.eclipse.cdt.make.core.messages.Messages;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
/**
* Scanner config discovery related marker generator
@@ -49,7 +55,7 @@ public class SCMarkerGenerator implements IMarkerGenerator {
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
*/
- public void addMarker(ProblemMarkerInfo problemMarkerInfo) {
+ public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
try {
IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
/*
@@ -65,19 +71,41 @@ public class SCMarkerGenerator implements IMarkerGenerator {
}
}
}
+
+ // we have to add the marker in the job or we can deadlock other
+ // threads that are responding to a resource delta by doing something
+ // that accesses the project description
+ Job markerJob = new Job(Messages.SCMarkerGenerator_0) {
- IMarker marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
- marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
- marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
- marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
- marker.setAttribute(IMarker.CHAR_START, -1);
- marker.setAttribute(IMarker.CHAR_END, -1);
- if (problemMarkerInfo.variableName != null) {
- marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
- }
- if (problemMarkerInfo.externalPath != null) {
- marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString());
- }
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ IMarker marker;
+ try {
+ marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
+ marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
+ marker.setAttribute(IMarker.SEVERITY, mapMarkerSeverity(problemMarkerInfo.severity));
+ marker.setAttribute(IMarker.LINE_NUMBER, problemMarkerInfo.lineNumber);
+ marker.setAttribute(IMarker.CHAR_START, -1);
+ marker.setAttribute(IMarker.CHAR_END, -1);
+
+ if (problemMarkerInfo.variableName != null) {
+ marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
+ }
+ if (problemMarkerInfo.externalPath != null) {
+ marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString());
+ }
+ } catch (CoreException e) {
+ return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_1, e);
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ };
+
+ markerJob.setRule(problemMarkerInfo.file);
+ markerJob.schedule();
+
}
catch (CoreException e) {
CCorePlugin.log(e.getStatus());

Back to the top