1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-06-09 10:46:02 +02:00

Bug 282894: [Scanner Discovery] duplicate "Error launching external scanner info generator" warning

This commit is contained in:
Andrew Gvozdev 2011-04-23 22:03:13 +00:00
parent 8f6af04d2a
commit 850a56e5d7
3 changed files with 104 additions and 110 deletions

View file

@ -18,8 +18,9 @@ import org.eclipse.osgi.util.NLS;
*/
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.cdt.make.core.messages.messages"; //$NON-NLS-1$
public static String SCMarkerGenerator_0;
public static String SCMarkerGenerator_1;
public static String SCMarkerGenerator_Add_Markers;
public static String SCMarkerGenerator_Error_Adding_Markers;
public static String SCMarkerGenerator_Discovery_Options_Page;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);

View file

@ -8,5 +8,6 @@
# Contributors:
# IBM Corporation - initial API and implementation
###############################################################################
SCMarkerGenerator_0=Add markers to project
SCMarkerGenerator_1=Error adding markers.
SCMarkerGenerator_Add_Markers=Add Scanner Discovery markers
SCMarkerGenerator_Error_Adding_Markers=Error adding markers.
SCMarkerGenerator_Discovery_Options_Page=[Discovery Options] page in project properties

View file

@ -49,12 +49,18 @@ public class SCMarkerGenerator implements IMarkerGenerator {
addMarker(info);
}
/* (non-Javadoc)
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
*/
public void addMarker(final ProblemMarkerInfo problemMarkerInfo) {
// 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_Add_Markers) {
@Override
protected IStatus run(IProgressMonitor monitor) {
IMarker marker;
try {
IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
/*
@ -66,19 +72,14 @@ public class SCMarkerGenerator implements IMarkerGenerator {
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
return;
return Status.OK_STATUS;
}
}
}
} catch (CoreException e) {
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
}
// 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) {
@Override
protected IStatus run(IProgressMonitor monitor) {
IMarker marker;
try {
marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
@ -90,26 +91,17 @@ public class SCMarkerGenerator implements IMarkerGenerator {
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());
}
marker.setAttribute(IMarker.LOCATION, Messages.SCMarkerGenerator_Discovery_Options_Page);
} catch (CoreException e) {
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_1, e);
return new Status(Status.ERROR, MakeCorePlugin.getUniqueIdentifier(), Messages.SCMarkerGenerator_Error_Adding_Markers, e);
}
return Status.OK_STATUS;
}
};
markerJob.setRule(problemMarkerInfo.file);
markerJob.schedule();
}
catch (CoreException e) {
MakeCorePlugin.log(e.getStatus());
}
}
public void removeMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {