Java Code Examples for org.eclipse.jdt.core.compiler.IProblem#Task

The following examples show how to use org.eclipse.jdt.core.compiler.IProblem#Task . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompilationUnitDocumentProvider.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public ProblemAnnotation(IProblem problem, ICompilationUnit cu) {

			fProblem= problem;
			fCompilationUnit= cu;

			if (JavaSpellingReconcileStrategy.SPELLING_PROBLEM_ID == fProblem.getID()) {
				setType(SPELLING_ANNOTATION_TYPE);
				fLayer= WARNING_LAYER;
			} else if (IProblem.Task == fProblem.getID()) {
				setType(JavaMarkerAnnotation.TASK_ANNOTATION_TYPE);
				fLayer= TASK_LAYER;
			} else if (fProblem.isWarning()) {
				setType(JavaMarkerAnnotation.WARNING_ANNOTATION_TYPE);
				fLayer= WARNING_LAYER;
			} else if (fProblem.isError()) {
				setType(JavaMarkerAnnotation.ERROR_ANNOTATION_TYPE);
				fLayer= ERROR_LAYER;
			} else {
				setType(JavaMarkerAnnotation.INFO_ANNOTATION_TYPE);
				fLayer= INFO_LAYER;
			}
		}
 
Example 2
Source File: CompilationResult.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public void record(CategorizedProblem newProblem, ReferenceContext referenceContext, boolean mandatoryError) {
	//new Exception("VERBOSE PROBLEM REPORTING").printStackTrace();
	if(newProblem.getID() == IProblem.Task) {
		recordTask(newProblem);
		return;
	}
	if (this.problemCount == 0) {
		this.problems = new CategorizedProblem[5];
	} else if (this.problemCount == this.problems.length) {
		System.arraycopy(this.problems, 0, (this.problems = new CategorizedProblem[this.problemCount * 2]), 0, this.problemCount);
	}
	this.problems[this.problemCount++] = newProblem;
	if (referenceContext != null){
		if (this.problemsMap == null) this.problemsMap = new HashMap(5);
		if (this.firstErrors == null) this.firstErrors = new HashSet(5);
		if (newProblem.isError() && !referenceContext.hasErrors()) this.firstErrors.add(newProblem);
		this.problemsMap.put(newProblem, referenceContext);
	}
	if (newProblem.isError()) {
		this.numberOfErrors++;
		if (mandatoryError) this.hasMandatoryErrors = true;
		if ((newProblem.getID() & IProblem.Syntax) != 0) {
			this.hasSyntaxError = true;
		}
	}
}
 
Example 3
Source File: Compiler.java    From APDE with GNU General Public License v2.0 6 votes vote down vote up
@Override
public int logProblems(CategorizedProblem[] problems, char[] unitSource, Main currentMain) {
	int localErrorCount = 0;
	
	for (CategorizedProblem problem : problems) {
		if (problem != null) {
			handleProblem(problem);
			
			// These counters are necessary for ECJ to function properly
			if (problem.isError()) {
				localErrorCount++;
				currentMain.globalErrorsCount++;
			} else if (problem.getID() == IProblem.Task) {
				currentMain.globalTasksCount++;
			} else {
				currentMain.globalWarningsCount++;
			}
		}
	}
	
	return localErrorCount;
}
 
Example 4
Source File: BaseDiagnosticsHandler.java    From eclipse.jdt.ls with Eclipse Public License 2.0 5 votes vote down vote up
private static DiagnosticSeverity convertSeverity(IProblem problem) {
	if (problem.isError()) {
		return DiagnosticSeverity.Error;
	}
	if (problem.isWarning() && (problem.getID() != IProblem.Task)) {
		return DiagnosticSeverity.Warning;
	}
	return DiagnosticSeverity.Information;
}
 
Example 5
Source File: DefaultProblem.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Returns the marker type associated to this problem.
 * @see org.eclipse.jdt.core.compiler.CategorizedProblem#getMarkerType()
 */
public String getMarkerType() {
	return this.id == IProblem.Task
		? MARKER_TYPE_TASK
		: MARKER_TYPE_PROBLEM;
}