Search in sources :

Example 1 with ProblemRequester

use of org.eclipse.che.ide.ext.java.client.editor.ProblemRequester in project che by eclipse.

the class PomReconcilingStrategy method doReconcile.

private void doReconcile(final List<Problem> problems) {
    if (this.annotationModel == null) {
        return;
    }
    ProblemRequester problemRequester;
    if (this.annotationModel instanceof ProblemRequester) {
        problemRequester = (ProblemRequester) this.annotationModel;
        problemRequester.beginReporting();
    } else {
        editor.setErrorState(EditorWithErrors.EditorState.NONE);
        return;
    }
    try {
        boolean error = false;
        boolean warning = false;
        for (Problem problem : problems) {
            if (!error) {
                error = problem.isError();
            }
            if (!warning) {
                warning = problem.isWarning();
            }
            problemRequester.acceptProblem(problem);
        }
        if (error) {
            editor.setErrorState(EditorWithErrors.EditorState.ERROR);
        } else if (warning) {
            editor.setErrorState(EditorWithErrors.EditorState.WARNING);
        } else {
            editor.setErrorState(EditorWithErrors.EditorState.NONE);
        }
    } catch (final Exception e) {
        Log.error(getClass(), e);
    } finally {
        problemRequester.endReporting();
    }
}
Also used : ProblemRequester(org.eclipse.che.ide.ext.java.client.editor.ProblemRequester) Problem(org.eclipse.che.ide.ext.java.shared.dto.Problem) OperationException(org.eclipse.che.api.promises.client.OperationException)

Aggregations

OperationException (org.eclipse.che.api.promises.client.OperationException)1 ProblemRequester (org.eclipse.che.ide.ext.java.client.editor.ProblemRequester)1 Problem (org.eclipse.che.ide.ext.java.shared.dto.Problem)1