mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Bug 282894: [Scanner Discovery] duplicate "Error launching external scanner info generator" warning
This commit is contained in:
parent
8f6af04d2a
commit
850a56e5d7
3 changed files with 104 additions and 110 deletions
|
@ -18,8 +18,9 @@ import org.eclipse.osgi.util.NLS;
|
||||||
*/
|
*/
|
||||||
public class Messages extends NLS {
|
public class Messages extends NLS {
|
||||||
private static final String BUNDLE_NAME = "org.eclipse.cdt.make.core.messages.messages"; //$NON-NLS-1$
|
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_Add_Markers;
|
||||||
public static String SCMarkerGenerator_1;
|
public static String SCMarkerGenerator_Error_Adding_Markers;
|
||||||
|
public static String SCMarkerGenerator_Discovery_Options_Page;
|
||||||
static {
|
static {
|
||||||
// initialize resource bundle
|
// initialize resource bundle
|
||||||
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
|
||||||
|
|
|
@ -8,5 +8,6 @@
|
||||||
# Contributors:
|
# Contributors:
|
||||||
# IBM Corporation - initial API and implementation
|
# IBM Corporation - initial API and implementation
|
||||||
###############################################################################
|
###############################################################################
|
||||||
SCMarkerGenerator_0=Add markers to project
|
SCMarkerGenerator_Add_Markers=Add Scanner Discovery markers
|
||||||
SCMarkerGenerator_1=Error adding markers.
|
SCMarkerGenerator_Error_Adding_Markers=Error adding markers.
|
||||||
|
SCMarkerGenerator_Discovery_Options_Page=[Discovery Options] page in project properties
|
||||||
|
|
|
@ -49,12 +49,18 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
||||||
addMarker(info);
|
addMarker(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
|
* @see org.eclipse.cdt.core.IMarkerGenerator#addMarker(org.eclipse.cdt.core.ProblemMarkerInfo)
|
||||||
*/
|
*/
|
||||||
public void addMarker(final ProblemMarkerInfo 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 {
|
try {
|
||||||
IMarker[] cur = problemMarkerInfo.file.findMarkers(ICModelMarker.C_MODEL_PROBLEM_MARKER, false, IResource.DEPTH_ONE);
|
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();
|
int sev = ((Integer) cur[i].getAttribute(IMarker.SEVERITY)).intValue();
|
||||||
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
String mesg = (String) cur[i].getAttribute(IMarker.MESSAGE);
|
||||||
if (line == problemMarkerInfo.lineNumber && sev == mapMarkerSeverity(problemMarkerInfo.severity) && mesg.equals(problemMarkerInfo.description)) {
|
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 {
|
try {
|
||||||
marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
marker = problemMarkerInfo.file.createMarker(ICModelMarker.C_MODEL_PROBLEM_MARKER);
|
||||||
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
marker.setAttribute(IMarker.MESSAGE, problemMarkerInfo.description);
|
||||||
|
@ -90,26 +91,17 @@ public class SCMarkerGenerator implements IMarkerGenerator {
|
||||||
if (problemMarkerInfo.variableName != null) {
|
if (problemMarkerInfo.variableName != null) {
|
||||||
marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
|
marker.setAttribute(ICModelMarker.C_MODEL_MARKER_VARIABLE, problemMarkerInfo.variableName);
|
||||||
}
|
}
|
||||||
if (problemMarkerInfo.externalPath != null) {
|
marker.setAttribute(IMarker.LOCATION, Messages.SCMarkerGenerator_Discovery_Options_Page);
|
||||||
marker.setAttribute(ICModelMarker.C_MODEL_MARKER_EXTERNAL_LOCATION, problemMarkerInfo.externalPath.toOSString());
|
|
||||||
}
|
|
||||||
} catch (CoreException e) {
|
} 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;
|
return Status.OK_STATUS;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
markerJob.setRule(problemMarkerInfo.file);
|
markerJob.setRule(problemMarkerInfo.file);
|
||||||
markerJob.schedule();
|
markerJob.schedule();
|
||||||
|
|
||||||
}
|
|
||||||
catch (CoreException e) {
|
|
||||||
MakeCorePlugin.log(e.getStatus());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void removeMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
public void removeMarker(IResource file, int lineNumber, String errorDesc, int severity, String errorVar) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue