org.eclipse.emf.common.util.DiagnosticChain Java Examples
The following examples show how to use
org.eclipse.emf.common.util.DiagnosticChain.
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: CompositeEValidator.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override public boolean validate(EClass eClass, EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) throws OperationCanceledError { boolean result = true; for (int i = 0; i < getContents().size(); i++) { EValidatorEqualitySupport val = getContents().get(i); try { result &= val.getDelegate().validate(eClass, eObject, diagnostics, context); } catch (Throwable e) { operationCanceledManager.propagateAsErrorIfCancelException(e); logger.error("Error executing EValidator", e); diagnostics.add(createExceptionDiagnostic("Error executing EValidator", eClass, e)); } } return result; }
Example #2
Source File: MigrationValidator.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * Validates the noDanglingReference constraint of '<em>Reference Slot</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ public boolean validateReferenceSlot_noDanglingReference(ReferenceSlot referenceSlot, DiagnosticChain diagnostics, Map<Object, Object> context) { if (!validate_noDanglingReference(referenceSlot)) { if (diagnostics != null) { diagnostics.add (new BasicDiagnostic (Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0, EcorePlugin.INSTANCE.getString("_UI_GenericConstraint_diagnostic", new Object[] { //$NON-NLS-1$ "noDanglingReference", getObjectLabel((EObject) referenceSlot, context) }), //$NON-NLS-1$ new Object[] { referenceSlot })); } return false; } return true; }
Example #3
Source File: CompositeEValidator.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
@Override public boolean validate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) throws OperationCanceledError { boolean result = true; for (int i = 0; i < getContents().size(); i++) { EValidatorEqualitySupport val = getContents().get(i); try { result &= val.getDelegate().validate(eObject, diagnostics, context); } catch (Throwable e) { operationCanceledManager.propagateAsErrorIfCancelException(e); logger.error("Error executing EValidator", e); diagnostics.add(createExceptionDiagnostic("Error executing EValidator", eObject, e)); } } return result; }
Example #4
Source File: DiValidator.java From fixflow with Apache License 2.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validatePlane(Plane plane, DiagnosticChain diagnostics, Map<Object, Object> context) { boolean result = validate_EveryMultiplicityConforms(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryDataValueConforms(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryReferenceIsContained(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryProxyResolves(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_UniqueID(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryKeyUnique(plane, diagnostics, context); if (result || diagnostics != null) result &= validate_EveryMapEntryUnique(plane, diagnostics, context); if (result || diagnostics != null) result &= validatePlane_plane_element_type(plane, diagnostics, context); return result; }
Example #5
Source File: ExecComponentsValidator.java From neoscada with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateLoadAverage ( LoadAverage loadAverage, DiagnosticChain diagnostics, Map<Object, Object> context ) { if ( !validate_NoCircularContainment ( loadAverage, diagnostics, context ) ) return false; boolean result = validate_EveryMultiplicityConforms ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryDataValueConforms ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryReferenceIsContained ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryBidirectionalReferenceIsPaired ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryProxyResolves ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_UniqueID ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryKeyUnique ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validate_EveryMapEntryUnique ( loadAverage, diagnostics, context ); if ( result || diagnostics != null ) result &= validateExecJob_hasExecDriver ( loadAverage, diagnostics, context ); return result; }
Example #6
Source File: ExtensibleValidator.java From neoscada with Eclipse Public License 1.0 | 6 votes |
@Override public boolean validate ( final EObject eObject, final DiagnosticChain diagnostics, final Map<Object, Object> context ) { boolean result = true; for ( final EValidator v : this.otherValidators ) { if ( !v.validate ( eObject, diagnostics, context ) ) { result = false; } } ValidationPlugin.runValidation ( eObject, diagnostics, context ); return result; }
Example #7
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateDataPoint( DataPoint dataPoint, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) dataPoint, diagnostics, context ); }
Example #8
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateImage( Image image, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) image, diagnostics, context ); }
Example #9
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateDateFormatSpecifier( DateFormatSpecifier dateFormatSpecifier, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) dateFormatSpecifier, diagnostics, context ); }
Example #10
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateLineAttributes( LineAttributes lineAttributes, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) lineAttributes, diagnostics, context ); }
Example #11
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateMultiURLValues( MultiURLValues multiURLValues, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) multiURLValues, diagnostics, context ); }
Example #12
Source File: IEC60870Validator.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * Validates the portCheck constraint of '<em>Device</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateIEC60870Device_portCheck ( IEC60870Device iec60870Device, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate ( IEC60870Package.Literals.IEC60870_DEVICE, iec60870Device, diagnostics, context, "http://www.eclipse.org/emf/2002/Ecore/OCL", //$NON-NLS-1$ "portCheck", //$NON-NLS-1$ IEC60870_DEVICE__PORT_CHECK__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0 ); }
Example #13
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateRGBValue( int rgbValue, DiagnosticChain diagnostics, Map<Object, Object> context ) { boolean result = validateRGBValue_Min( rgbValue, diagnostics, context ); if ( result || diagnostics != null ) result &= validateRGBValue_Max( rgbValue, diagnostics, context ); return result; }
Example #14
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateExtendedProperty( ExtendedProperty extendedProperty, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) extendedProperty, diagnostics, context ); }
Example #15
Source File: ModelValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateChartWithAxes( ChartWithAxes chartWithAxes, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) chartWithAxes, diagnostics, context ); }
Example #16
Source File: ModelValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * Validate OCL constraints and return true if OCL constraint holds, false * otherwise. */ private boolean validate_EveryInvariant(Instance instance, DiagnosticChain diagnostics, Map<Object, Object> context) { final EClass eClass = instance.getEClass(); final EAnnotation annotation = eClass.getEAnnotation(OCL_SOURCE_URI); if (annotation != null) { for (final Entry<String, String> entry : annotation.getDetails()) { try { final String expression = entry.getValue(); if (!(Boolean) evaluate(instance, expression)) { if (diagnostics != null) { diagnostics.add(new BasicDiagnostic( Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0, EcorePlugin.INSTANCE.getString( "_UI_GenericConstraint_diagnostic", //$NON-NLS-1$ new Object[] { entry.getKey(), getObjectLabel( (EObject) instance, context) }), new Object[] { instance })); } return false; } } catch (final ParserException e) { System.out.println(e); } } } return true; }
Example #17
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateFractionNumberFormatSpecifier( FractionNumberFormatSpecifier fractionNumberFormatSpecifier, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) fractionNumberFormatSpecifier, diagnostics, context ); }
Example #18
Source File: GraphValidator.java From graph-editor with Eclipse Public License 1.0 | 5 votes |
/** * Validates the isContentHeightValid constraint of '<em>GModel</em>'. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateGModel_isContentHeightValid(GModel gModel, DiagnosticChain diagnostics, Map<Object, Object> context) { return validate (GraphPackage.Literals.GMODEL, gModel, diagnostics, context, "http://www.eclipse.org/emf/2002/Ecore/OCL", "isContentHeightValid", GMODEL__IS_CONTENT_HEIGHT_VALID__EEXPRESSION, Diagnostic.ERROR, DIAGNOSTIC_SOURCE, 0); }
Example #19
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateDataPointComponent( DataPointComponent dataPointComponent, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) dataPointComponent, diagnostics, context ); }
Example #20
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateScaleUnitTypeObject( ScaleUnitType scaleUnitTypeObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #21
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateFill( Fill fill, DiagnosticChain diagnostics, Map<Object, Object> context ) { return validate_EveryDefaultConstraint( (EObject) fill, diagnostics, context ); }
Example #22
Source File: MigrationValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated */ public boolean validateInstance(Instance instance, DiagnosticChain diagnostics, Map<Object, Object> context) { if (!validate_NoCircularContainment((EObject) instance, diagnostics, context)) { return false; } boolean result = validate_EveryMultiplicityConforms((EObject) instance, diagnostics, context); if (result || diagnostics != null) { result &= validate_EveryDataValueConforms((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryReferenceIsContained((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryBidirectionalReferenceIsPaired((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryProxyResolves((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_UniqueID((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryKeyUnique((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validate_EveryMapEntryUnique((EObject) instance, diagnostics, context); } if (result || diagnostics != null) { result &= validateInstance_validContainment(instance, diagnostics, context); } if (result || diagnostics != null) { result &= validateInstance_validType(instance, diagnostics, context); } return result; }
Example #23
Source File: DefaultCheckImpl.java From dsl-devkit with Eclipse Public License 1.0 | 4 votes |
/** * Executes all Check methods found. * * @param class1 * the class1 * @param object * the object * @param diagnostics * the diagnostics * @param context * the context * @return true, if successful */ @SuppressWarnings("PMD.NPathComplexity") protected final boolean internalValidate(final EClass class1, final EObject object, final DiagnosticChain diagnostics, final Map<Object, Object> context) { initCheckMethodCache(); List<MethodWrapper> methods = methodsForType.computeIfAbsent(object.getClass(), clazz -> { List<MethodWrapper> result = Lists.newArrayList(); for (MethodWrapper mw : checkMethods) { if (mw.isMatching(clazz)) { result.add(mw); } } return result; }); if (methods.isEmpty()) { return true; } CheckMode checkMode = CheckMode.getCheckMode(context); State internalState = new State(); internalState.chain = diagnostics; internalState.currentObject = object; internalState.checkMode = checkMode; internalState.context = context; ResourceValidationRuleSummaryEvent.Collector collector = traceSet.isEnabled(ResourceValidationRuleSummaryEvent.class) ? ResourceValidationRuleSummaryEvent.Collector.extractFromLoadOptions(object.eResource().getResourceSet()) : null; List<MethodWrapper> erroneousMethods = null; for (int i = 0; i < methods.size(); i++) { MethodWrapper method = methods.get(i); // FIXME the method name is actually not the real issue code String ruleName = collector != null ? method.instance.getClass().getSimpleName() + '.' + method.method.getName() : null; try { traceStart(ruleName, object, collector); method.invoke(internalState); // CHECKSTYLE:OFF Yes, we really want to catch anything here. The method invoked is user-written code that may fail arbitrarily. // If that happens, we want to exclude this check from all future executions! We catch Exception instead of InvocationTargetException // because we may also get NullPointerException or ExceptionInInitializerError here, and catching those separately would mean we had // to duplicate the logging and method removal. } catch (Exception e) { // CHECKSTYLE:ON logCheckMethodFailure(method, internalState, e); if (erroneousMethods == null) { erroneousMethods = Lists.newArrayList(); } erroneousMethods.add(method); } finally { traceEnd(ruleName, object, collector); } } if (erroneousMethods != null) { methodsForType.get(object.getClass()).removeAll(erroneousMethods); } return !internalState.hasErrors; }
Example #24
Source File: DomainValidator.java From statecharts with Eclipse Public License 1.0 | 4 votes |
@Override public boolean validate(EObject eObject, DiagnosticChain diagnostics, Map<Object, Object> context) { return true; }
Example #25
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateLineStyleObject( LineStyle lineStyleObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #26
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateOrientationObject( Orientation orientationObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #27
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ public boolean validateCursorTypeObject( CursorType cursorTypeObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #28
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateDirectionObject( Direction directionObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #29
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateTickStyleObject( TickStyle tickStyleObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }
Example #30
Source File: AttributeValidator.java From birt with Eclipse Public License 1.0 | 4 votes |
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * @generated */ public boolean validateStretchObject( Stretch stretchObject, DiagnosticChain diagnostics, Map<Object, Object> context ) { return true; }