try { Check annotation = method.getAnnotation(Check.class); if (!state.checkMode.shouldCheck(annotation.value())) return; try {
@Override protected final boolean internalValidate(EClass class1, EObject object, DiagnosticChain diagnostics, Map<Object, Object> context) { if (checkMethods == null) { synchronized (this) { if (checkMethods == null) { Set<MethodWrapper> checkMethods = Sets.newLinkedHashSet(); checkMethods.addAll(collectMethods(getClass())); this.checkMethods = checkMethods; } } } CheckMode checkMode = CheckMode.getCheckMode(context); State state = new State(); state.chain = diagnostics; state.currentObject = object; state.checkMode = checkMode; state.context = context; for (MethodWrapper method : methodsForType.get(object.getClass())) { method.invoke(state); } return !state.hasErrors; }
/** * Deletes {@link IFile}'s markers which type matches the given {@link CheckType}s represented by the * {@link CheckMode}. * * @see CheckType * @see CheckMode#shouldCheck(CheckType) * @see MarkerTypes#forCheckType(CheckType) */ public final void deleteMarkers(final IFile file, final CheckMode checkMode, final IProgressMonitor monitor) throws CoreException { for (CheckType chkType : CheckType.values()) { if (checkMode.shouldCheck(chkType)) { String markerType = MarkerTypes.forCheckType(chkType); file.deleteMarkers(markerType, true, IResource.DEPTH_ZERO); } } } }
/** Invoke the method. * * @param context the context. */ public void invoke(Context context) { if (!context.getCheckMode().shouldCheck(this.checkType)) { return; } try { this.method.invoke(context.getCurrentValidator(), context.getCurrentObject()); } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException exception) { context.getCurrentValidator().handleInvocationTargetException(exception, context); } }
if (mode.shouldCheck(CheckType.FAST)) { for (int i = 0; i < resource.getErrors().size(); i++) { if (monitor.isCanceled())