|
|
|
Re: How to disable error message from Composite EValidator [message #1754301 is a reply to message #1754290] |
Thu, 16 February 2017 09:29 |
|
its actually not redundant, its redundant on how you implement your sname thingy right? by making it nullsafe?
but why dont you use a op instead of a derived in your xcore?
class Greeting {
refers Test sample
int age
op String getSname() {
sample.SName
}
}
of course you can do disable the validation completely or partially
public class CustomCompositeEValidator extends CompositeEValidator {
@Override
protected void initDefaults() {
if (isUseEObjectValidator()) {
this.addValidator(new EObjectValidator() {
@Override
public boolean validate_EveryProxyResolves(EObject eObject, DiagnosticChain diagnostics,
Map<Object, Object> context) {
// don't check, we have our own implementation, which creates nicer messages
return true;
}
@Override
public boolean validate_NoCircularContainment(EObject eObject, DiagnosticChain diagnostics,
Map<Object, Object> context) {
// don't check
return true;
}
@Override
protected boolean validate_DataValueConforms(EObject eObject, EAttribute eAttribute,
DiagnosticChain diagnostics, Map<Object, Object> context) {
//maybe some custom logic, maybe always, depends on the cases where you want to disable the validation
if (1==1) return true;
return super.validate_DataValueConforms(eObject, eAttribute, diagnostics, context);
}
});
}
}
}
def Class<? extends org.eclipse.xtext.validation.CompositeEValidator> bindCompositeEValidator() {
return Custom CompositeEValidator
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03792 seconds