sevMarker = IMarker.SEVERITY_INFO;
// Create the marker
// TODO: create markers according to the type of the analysis
try {
IMarker marker = resource.createMarker(Crystal.MARKER_DEFAULT);
marker.setAttribute(IMarker.CHAR_START, node.getStartPosition());
marker.setAttribute(IMarker.CHAR_END, node.getStartPosition() + node.getLength());
marker.setAttribute(IMarker.MESSAGE, "[" + analysisName + "]: " + problemDescription);
marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_NORMAL);
marker.setAttribute(IMarker.SEVERITY, sevMarker);
marker.setAttribute(Crystal.MARKER_ATTR_ANALYSIS, analysisName);
CompilationUnit cu = (CompilationUnit) node.getRoot();
int line = cu.getLineNumber(node.getStartPosition());
if (line >= 0) // -1 and -2 indicate error conditions
marker.setAttribute(IMarker.LINE_NUMBER, line);
}
catch (CoreException ce) {
logger.log(Level.SEVERE, "CoreException when creating marker", ce);
}
}