Java Code Examples for org.eclipse.emf.common.util.Diagnostic#INFO

The following examples show how to use org.eclipse.emf.common.util.Diagnostic#INFO . 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: AbstractDeclarativeValidator.java    From xtext-core with Eclipse Public License 2.0 6 votes vote down vote up
protected int toDiagnosticSeverity(Severity severity) {
	int diagnosticSeverity = -1;
	switch (severity) {
		case ERROR:
			diagnosticSeverity = Diagnostic.ERROR;
			break;
		case WARNING:
			diagnosticSeverity = Diagnostic.WARNING;
			break;
		case INFO:
			diagnosticSeverity = Diagnostic.INFO;
			break;
		default:
			throw new IllegalArgumentException("Unknow severity " + severity);
	}
	return diagnosticSeverity;
}
 
Example 2
Source File: DefaultCheckImpl.java    From dsl-devkit with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Gets a numeric value mapped to a given {@link Severity}. Severities are mapped to
 * <ul>
 * <li>{@link Diagnostic#ERROR}
 * <li>{@link Diagnostic#WARNING}
 * <li>{@link Diagnostic#INFO}
 * </ul>
 *
 * @param severity
 *          the issue severity
 * @return the numeric value representing a severity
 */
protected int toDiagnosticSeverity(final Severity severity) {
  int diagnosticSeverity = -1;
  switch (severity) {
  case ERROR:
    diagnosticSeverity = Diagnostic.ERROR;
    break;
  case WARNING:
    diagnosticSeverity = Diagnostic.WARNING;
    break;
  case INFO:
    diagnosticSeverity = Diagnostic.INFO;
    break;
  default:
    throw new IllegalArgumentException("Unknow severity " + severity); //$NON-NLS-1$
  }
  return diagnosticSeverity;
}
 
Example 3
Source File: ValidateAction.java    From scava with Eclipse Public License 2.0 5 votes vote down vote up
/**
* @generated
*/
private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
	if (diagnosticSeverity == Diagnostic.OK) {
		return IStatus.OK;
	} else if (diagnosticSeverity == Diagnostic.INFO) {
		return IStatus.INFO;
	} else if (diagnosticSeverity == Diagnostic.WARNING) {
		return IStatus.WARNING;
	} else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
		return IStatus.ERROR;
	}
	return IStatus.INFO;
}
 
Example 4
Source File: AbstractBodyParser.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Gets the {@link List} of {@link TemplateValidationMessage} from the given {@link Diagnostic}.
 * 
 * @param diagnostic
 *            the {@link Diagnostic}
 * @param queryText
 *            the query text
 * @param location
 *            the location of the {@link TemplateValidationMessage}
 * @return the {@link List} of {@link TemplateValidationMessage} from the given {@link Diagnostic}
 */
protected List<TemplateValidationMessage> getValidationMessage(Diagnostic diagnostic, String queryText,
        XWPFRun location) {
    final List<TemplateValidationMessage> res = new ArrayList<>();

    for (Diagnostic child : diagnostic.getChildren()) {
        final ValidationMessageLevel level;
        switch (diagnostic.getSeverity()) {
            case Diagnostic.INFO:
                level = ValidationMessageLevel.INFO;
                break;

            case Diagnostic.WARNING:
                level = ValidationMessageLevel.WARNING;
                break;

            case Diagnostic.ERROR:
                level = ValidationMessageLevel.ERROR;
                break;

            default:
                level = ValidationMessageLevel.INFO;
                break;
        }
        res.add(new TemplateValidationMessage(level,
                message(ParsingErrorMessage.INVALIDEXPR, queryText, child.getMessage()), location));
        res.addAll(getValidationMessage(child, queryText, location));
    }

    return res;
}
 
Example 5
Source File: M2DocUtils.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Appends the given {@link Diagnostic} to the given {@link XWPFParagraph}.
 * 
 * @param paragraph
 *            the {@link XWPFParagraph}
 * @param diagnostic
 *            the {@link Diagnostic}
 * @return the maximum {@link ValidationMessageLevel}
 */
public static List<TemplateValidationMessage> appendDiagnosticMessage(XWPFParagraph paragraph,
        Diagnostic diagnostic) {
    final List<TemplateValidationMessage> res = new ArrayList<>();

    for (Diagnostic child : diagnostic.getChildren()) {
        switch (child.getSeverity()) {
            case Diagnostic.INFO:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.INFO,
                        getMessageWithException(child)));
                break;
            case Diagnostic.WARNING:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.WARNING,
                        getMessageWithException(child)));
                break;
            case Diagnostic.ERROR:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.ERROR,
                        getMessageWithException(child)));
                break;

            default:
                res.add(M2DocUtils.appendMessageRun(paragraph, ValidationMessageLevel.INFO,
                        getMessageWithException(child)));
                break;
        }
        paragraph.getRuns().get(paragraph.getRuns().size() - 1).addBreak();
        if (!child.getChildren().isEmpty()) {
            res.addAll(appendDiagnosticMessage(paragraph, child));
        }
    }

    return res;
}
 
Example 6
Source File: XtextValidator.java    From xtext-core with Eclipse Public License 2.0 5 votes vote down vote up
public void doCreateMessage(String message, String code, int severity, EObject context, EStructuralFeature feature, ValidationMessageAcceptor acceptor) {
	if (severity == Diagnostic.WARNING) {
		acceptor.acceptWarning(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	} else if (severity == Diagnostic.ERROR) {
		acceptor.acceptError(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	} else if (severity == Diagnostic.INFO) {
		acceptor.acceptInfo(message, context, feature, ValidationMessageAcceptor.INSIGNIFICANT_INDEX, code);
	}
}
 
Example 7
Source File: ErrorToDiagnoticTranslator.java    From gama with GNU General Public License v3.0 5 votes vote down vote up
protected int toDiagnosticSeverity(final GamlCompilationError e) {
	int diagnosticSeverity = -1;
	if (e.isError()) {
		diagnosticSeverity = Diagnostic.ERROR;
	} else if (e.isWarning()) {
		diagnosticSeverity = Diagnostic.WARNING;
	} else if (e.isInfo()) {
		diagnosticSeverity = Diagnostic.INFO;
	}

	return diagnosticSeverity;
}
 
Example 8
Source File: ValidationMarkerProvider.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private static int diagnosticToStatusSeverity(final int diagnosticSeverity) {
    if (diagnosticSeverity == Diagnostic.OK) {
        return IStatus.OK;
    } else if (diagnosticSeverity == Diagnostic.INFO) {
        return IStatus.INFO;
    } else if (diagnosticSeverity == Diagnostic.WARNING) {
        return IStatus.WARNING;
    } else if (diagnosticSeverity == Diagnostic.ERROR
            || diagnosticSeverity == Diagnostic.CANCEL) {
        return IStatus.ERROR;
    }
    return IStatus.INFO;
}
 
Example 9
Source File: ValidateAction.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
/**
* @generated
*/
private static int diagnosticToStatusSeverity(int diagnosticSeverity) {
	if (diagnosticSeverity == Diagnostic.OK) {
		return IStatus.OK;
	} else if (diagnosticSeverity == Diagnostic.INFO) {
		return IStatus.INFO;
	} else if (diagnosticSeverity == Diagnostic.WARNING) {
		return IStatus.WARNING;
	} else if (diagnosticSeverity == Diagnostic.ERROR || diagnosticSeverity == Diagnostic.CANCEL) {
		return IStatus.ERROR;
	}
	return IStatus.INFO;
}