/** * Determines whether code generation can continue, based on the given <code>Diagnostic</code>. This implementation * returns true unless the {@link org.eclipse.emf.common.util.Diagnostic#getSeverity severity} is * <code>CANCEL</code>. * * @see org.eclipse.emf.common.util.Diagnostic#getSeverity() */ protected boolean canContinue(Diagnostic diagnostic) { return diagnostic.getSeverity() != Diagnostic.CANCEL; }
protected boolean canContinue(Diagnostic diagnostic) { return diagnostic.getSeverity() != Diagnostic.CANCEL; } };
/** * Determines whether code generation can continue, based on the given <code>Diagnostic</code>. This implementation * returns true unless the {@link org.eclipse.emf.common.util.Diagnostic#getSeverity severity} is * <code>CANCEL</code>. * * @see org.eclipse.emf.common.util.Diagnostic#getSeverity() */ protected boolean canContinue(Diagnostic diagnostic) { return diagnostic.getSeverity() != Diagnostic.CANCEL; }
public int getSeverity() { return diagnostic.getSeverity(); }
public boolean isOK() { return diagnostic.getSeverity() == OK; }
public boolean matches(int severityMask) { return (diagnostic.getSeverity() & severityMask ) != 0; }
public boolean isInfo() { return diagnostic.getSeverity() == Diagnostic.INFO; }
public void add(Diagnostic diagnostic) { if (children == null) { children = new BasicEList<Diagnostic>(); } children.add(diagnostic); int childSeverity = diagnostic.getSeverity(); if (childSeverity > getSeverity()) { severity = childSeverity; } }
public boolean apply(Diagnostic d) { if (severity != null && d.getSeverity() != severity) return false; if (code != null && !code.equals(d.getCode())) return false; if (issueCode != null && d instanceof AbstractValidationDiagnostic && !((AbstractValidationDiagnostic) d).getIssueCode().equals(issueCode)) return false; if (msg != null && d.getMessage() != null && !d.getMessage().contains(msg)) return false; return true; }
public boolean apply(Diagnostic d) { if (severity != null && d.getSeverity() != severity) return false; if (code != null && !code.equals(d.getCode())) return false; if (issueCode != null && d instanceof AbstractValidationDiagnostic && !((AbstractValidationDiagnostic) d).getIssueCode().equals(issueCode)) return false; if (msg != null && d.getMessage() != null && !d.getMessage().contains(msg)) return false; return true; }
protected String normalizeInstanceTypeName(String value) { if (value != null) { Diagnostic diagnostic = EcoreValidator.EGenericTypeBuilder.INSTANCE.parseInstanceTypeName(value); if (diagnostic.getSeverity() == Diagnostic.OK) { value = EcoreUtil.toJavaInstanceTypeName(((EGenericType)diagnostic.getData().get(0))); } } return value; }
@Override public boolean apply(Diagnostic d) { if (severity != null && d.getSeverity() != severity) return false; if (code != null && !code.equals(d.getCode())) return false; if (issueCode != null && d instanceof AbstractValidationDiagnostic && !((AbstractValidationDiagnostic) d).getIssueCode().equals(issueCode)) return false; if (msg != null && d.getMessage() != null && !d.getMessage().contains(msg)) return false; return true; }
private void propageValidationResult(Diagnostic diagnostic, GeneratedMetamodel metamodel, ValidationMessageAcceptor acceptor) { if (diagnostic.getSeverity() != Diagnostic.OK) { if (diagnostic.getCode() != 0) { List<?> data = diagnostic.getData(); if (!data.isEmpty() && data.get(0) instanceof EObject) { doPropagateValidationResult(diagnostic, metamodel, acceptor); } } for(Diagnostic child: diagnostic.getChildren()) propageValidationResult(child, metamodel, acceptor); } }
protected boolean validateEcoreModelFileName(String fileName, String packageName) { Diagnostic diagnostic = getModelImporter().checkEcoreModelFileName(fileName, packageName); handleDiagnostic(diagnostic); return diagnostic.getSeverity() == Diagnostic.OK; }
public static Diagnostic createDiagnostic(Diagnostic baseDiagnostic, String source, int code) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic( baseDiagnostic.getSeverity(), source, code, baseDiagnostic.getMessage(), baseDiagnostic.getData().toArray()); basicDiagnostic.addAll(baseDiagnostic); return basicDiagnostic; }
public void handleDiagnostic(Diagnostic diagnostic, String message, String dialogTitle, String dialogMessage) { if (diagnostic.getSeverity() == Diagnostic.OK) { handleOKDiagnostic(diagnostic, message, dialogTitle, dialogMessage); } else { handleNotOKDiagnostic(diagnostic, decodeAction(diagnostic), message, dialogTitle, dialogMessage); } }
private static void handleDiagnostic(Diagnostic diagnostic, ValidationHandler handler) { switch (diagnostic.getSeverity()) { case Diagnostic.ERROR: handler.handleError(diagnostic); break; case Diagnostic.WARNING: handler.handleWarning(diagnostic); break; case Diagnostic.INFO: handler.handleInfo(diagnostic); break; } }
public boolean createMessageForSource(Diagnostic diagnostic, EObject object, ValidationMessageAcceptor acceptor) { String code = XtextValidator.class.getName() + ".PackageValidation." + diagnostic.getCode(); int severity = diagnostic.getSeverity(); if (diagnostic.getCode() == EcoreValidator.UNIQUE_CLASSIFIER_NAMES || diagnostic.getCode() == EcoreValidator.UNIQUE_FEATURE_NAMES) severity = Diagnostic.ERROR; String message = diagnostic.getMessage(); return createMessageForSource(message, code, severity, object, acceptor); }
public void doCreateMessage(Diagnostic diagnostic, EObject object, EStructuralFeature feature, ValidationMessageAcceptor acceptor) { String code = XtextValidator.class.getName() + ".PackageValidation." + diagnostic.getCode(); int severity = diagnostic.getSeverity(); if (diagnostic.getCode() == EcoreValidator.UNIQUE_CLASSIFIER_NAMES || diagnostic.getCode() == EcoreValidator.UNIQUE_FEATURE_NAMES) severity = Diagnostic.ERROR; String message = diagnostic.getMessage(); doCreateMessage(message, code, severity, object, feature, acceptor); }
@Override protected boolean validateEPackageData(EPackage ePackage, String data) { Diagnostic diagnostic = getModelExporter().checkEPackageArtifactLocation(data, getLabel(ePackage)); handleDiagnostic(diagnostic); return diagnostic.getSeverity() == Diagnostic.OK; }